Thanks a lot for you help,
I guess I found a solution that works at least for me now. I took your "jax-rs
extension" sample that was provided with the Restlet download to see the figure
it out - thanks for the hint.
The @Context UriInfo does not work for parameter that are send within the HTTP
body. So UriInfo can only be uses with a parameter list within a url (GET
requests). For the other methods that use the HTTP body you have to use the
MulitvalueMap in the method definition. Within this mulitvaluemap you can find
all the parameter. Using uriInfo.getQueryParameter works only for Get requests.
But using the MultivalueMap requires to set the content-type of the client
request to "application/x-www-form-urlencoded" (at least for the ruby client I
used, a HTTP form worked without this) Using other content types like
"application/json", "text/plain"... doesn't work for me. I got a 415 always,
don't know why. Any idea?
Another thing is, when the MultivalueMap is defined in the method definition
the request must contain any parameter data otherwise it will cash because of
"no http form data".
So a small example how I made it running:
...
@Context UriInfo uriInfo;
@HeaderParam("Accept") String requestedMimeType;
@javax.ws.rs.GET
@Path("{blogId}")
public Response getBlog(@PathParam("blogId") java.lang.Integer blogId) {
return getResourceHandler().getBlog(new
BlogGetParameter(uriInfo.getQueryParameters(false), blogId), requestedMimeType,
uriInfo);
}
@javax.ws.rs.DELETE
@Path("{blogId}")
public Response deleteBlog(@PathParam("blogId") java.lang.Integer blogId) {
return getResourceHandler().deleteBlog(new BlogDeleteParameter(blogId),
requestedMimeType, uriInfo);
}
@javax.ws.rs.POST
public Response createBlog(MultivaluedMap<String, String> params) {
return getResourceHandler().createBlog(new BlogCreateParameter(params),
requestedMimeType, uriInfo);
}
...
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2669313