dev@grizzly.java.net

Re: How to return a different response status

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 31 May 2007 18:16:10 -0400

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();
>
> 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





>