dev@grizzly.java.net

RE: How to return a different response status

From: James Lorenzen <jlorenzen_at_gestalt-llc.com>
Date: Fri, 1 Jun 2007 10:43:21 -0500

OK I will thanks.

Previously we were doing this in our afterService. Do I still need
request.action(...)

public void afterService(Request request, Response response)
           throws Exception {
    request.action(ActionCode.ACTION_POST_REQUEST, null);
}

BTW, can you guys make some public javadocs? I can't find them anywhere
and it would really be helpful if the community had them.

-----Original Message-----
From: Jeanfrancois.Arcand_at_Sun.COM [mailto:Jeanfrancois.Arcand_at_Sun.COM]
Sent: Friday, June 01, 2007 10:32 AM
To: James Lorenzen
Cc: dev_at_grizzly.dev.java.net; Chad Gallemore
Subject: Re: How to return a different response status



James Lorenzen wrote:
> POST



>
> -----Original Message-----
> From: Jeanfrancois.Arcand_at_Sun.COM [mailto:Jeanfrancois.Arcand_at_Sun.COM]

> Sent: Thursday, May 31, 2007 5:16 PM
> To: dev_at_grizzly.dev.java.net
> Cc: Chad Gallemore; James Lorenzen
> Subject: Re: How to return a different response status
>
> Hi,
>
> James Lorenzen wrote:
>> I am using Grizzly in a simple way to process HTTP GET requests for
an
>
>> RSS Reader.
>>
>> However I am trying to set the response status for different events.
>> Unfortunately this doesn't work.
>>
>>
>>
>> public void service(final Request request, final Response response)
>> throws Exception {
>>
>> if (!request.method().toString().equalsIgnoreCase("GET")) {
>>
>> response.setStatus(HttpURLConnection.HTTP_BAD_METHOD);
>>
>> response.finish();

Remove the response.finish() and do, in afterService(Req,res):

> public void afterService(Request req, Response res)
> throws Exception {
> // Recycle the wrapper request and response
> req.recycle();
> res.recycle();
> }

Thanks will works.

-- Jeanfrancois


>>
>> return;
>>
>> }
>>
>>
>>
>> When this starts up and I send a POST request I expect a 405, but
that
>
>> doesn't happen. What am I doing wrong?
>
> When you do a POST, what request.method().toString() return?
>
> Thanks
>
> -- Jeanfrancois
>
>
>
>
>