Paul Sandoz wrote:
> Paul Sandoz wrote:
>> Jersey can support a method signature:
>>
>> public void getParts(HttpRequestContext request,
>> HttpResponseContext response)
>>
>> but this is non-standard and has not been properly tested since the
>> focus has been on getting the standard method signatures implemented.
>> It is very likely to fail because the runtime does not know if a
>> response has been written or not.
>>
>
> I am working to fix things related to using the low-level response
> context, should be ready by tomorrow.
>
Done. So you can do stuff like this:
@ProduceMime("text/html")
@HttpMethod
public void getParts(HttpRequestContext request,
HttpResponseContext response) {
// Set the response using a Response builder
response.setResponse(Response.Builder.created(someURI).build());
// Get the OutputStream
// Status and headers will be committed to container
// on first call of write or close.
OutputStream o = response.getOutputStream();
o.write(...);
}
Unfortunately HttpRequestContext and HttpResponseContext cannot
currently be intermixed with other parameters.
One way to obtain the URI params is create a constructor that has those
parameters. This is a new feature to 0.3 in the trunk that Marc implemented.
Paul.
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109