Here is what I am trying to do:
@POST
@Path("/MyPath")
@Produces("text/xml")
@RolesAllowed({"user"})
public Output myMethod (@QueryParam("itemId") long ItemId,
@QueryParam("plannedstartdate") Calendar plannedStartDate,
@QueryParam("plannedreturndate") Calendar plannedReturnDate)
I am using JBoss AS7. As far as I understan, resteasy is integrated into JBoss AS7. I am able to run simple rest services.
The only documentation I found about passing dates is at the link :
http://docs.jboss.org/resteasy/2.0.0.GA/userguide/html/StringConverter.html#StringParamUnmarshaller
I am not able to follow this and fix the issue as the instructions are not clear.
When I try to create an annotation DateFormat as given in the example, it does not recognize StringParamUnmarshaller. I don’t know where to get it from. If resteasy is already integrated into JBoss AS7, is this not supposed to be recognized?
My pom.xml has the following dependency:
<!-- Import the JAX-RS API, we use provided scope as the API is included
in JBoss AS 7 -->
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
The calls to this method fail as the String to Calendar conversion does not happen. I dont want to pass String instead of Calendar as there are other clients that make java call directly. Can anyone help with how I can pass dates to Rest Calls?
Thanks
Veer
This issue is resolved. See the following code.
Create an Annotation class
CalendarFormat.java:Add a class
CalendarFormatter.java:Add to POM
Change the method signature to use the annotation
That’s it.