Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get correct format for date with Odata 2.0 service #953

Open
avaud opened this issue Sep 9, 2014 · 10 comments
Open

Unable to get correct format for date with Odata 2.0 service #953

avaud opened this issue Sep 9, 2014 · 10 comments

Comments

@avaud
Copy link

avaud commented Sep 9, 2014

Hello,

We're trying to implement a client for an odata service using 2.0 version of odata.

From official spec we can see that format should be:
datetime’yyyy-mm-ddThh:mm[:ss[.fffffff]]‘ (keyword "datetime" and no timezone)

http://www.odata.org/documentation/odata-version-2-0/atom-format
http://www.odata.org/documentation/odata-version-2-0/overview

However, we can not make restlet to use the correct format,
From the code we can see that it uses the format defined in field dateTimeFormats of TypeUtils (org.restlet.ext.odata.internal.edm) which is "yyyy-MM-dd'T'HH:mm:ssz".

This is valid for the 3.0 version of odata but not in 2.0.

@jlouvel
Copy link
Member

jlouvel commented Sep 9, 2014

Thanks for the report. Would you be able to submit a patch?

@avaud
Copy link
Author

avaud commented Sep 9, 2014

Hello,

We suggest to rely on the client version that can be defined in the Service class. Then we change the methods in TypeUtils (toEdm, toEdmDateTime) to pass the version as parameter, and finally introduce some logic to choose the date format based on the version (with the adding of the new format)

If you're fine with this solution we can submit it, we just wanted to check with you first as we're new to this framework, we wanted to be sure we got it right.

Cheers
Antoine

@avaud
Copy link
Author

avaud commented Sep 9, 2014

BTW, We just saw that implementation for Odata 3.0 is not done yet so we were wondering which version is officially supported by Restlet. Was it just a bug or is it an older version (before 2.0) which is supported.
I did not find the information :(
Thank you!

@jlouvel
Copy link
Member

jlouvel commented Sep 9, 2014

There was a recent contribution to support OData 3.0 here that looks great:
#940

Note that there is no guarantee at this point that this contribution will be merged in the RF code base, but we hope so :)

There is an ongoing legal process to complete the submission, but you might want to have a look and try the new code. I'm cc:ing @Landmark-LGC who might be able to update us.

@jlouvel
Copy link
Member

jlouvel commented Sep 9, 2014

I think we support OData 1.0 as this feature was added back in 2010:
http://restlet.com/learn/guide/2.3/extensions/odata/

I've updated the user guide source to reflect this:
https://github.com/restlet/restlet-sites/blob/master/modules/com.restlet/learn/guide/2.2/extensions/odata/index.md

Regarding your patch idea, it sounds good to me. Distinguishing between different versions of OData protocol seems important.

@grammophone
Copy link
Contributor

Is this related to #946?

@avaud
Copy link
Author

avaud commented Sep 22, 2014

Hello,

I don't think so, the issue #946 is about receiving dates while we are talking about choosing the format for sending it.

@avaud
Copy link
Author

avaud commented Sep 24, 2014

Hello,

we have implemented a fix but i can't succeed in building the framework locally, the ant command stays stuck on [junit] Running org.restlet.test.RestletTestSuite. Even though i did not change anything in the Test module yet.

Have you ever experienced that issue ?

Would you have any documentation on building locally ?

I'm not used to Ant so maybe it's just a small thing... Would it be possible to have a direct contact to discuss it ? (skype or phone..)

Thank you

@jlouvel
Copy link
Member

jlouvel commented Sep 24, 2014

Hello, you could rely on Travis CI to check if your code works:
https://travis-ci.org/restlet/restlet-framework-java

Otherwise, you can find instructions to build here:
https://github.com/restlet/restlet-framework-java/wiki

@jlouvel
Copy link
Member

jlouvel commented Sep 24, 2014

BTW, you have my email on my GitHub profile page if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants