users@grizzly.java.net

Re: disabling expect continue handling

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Thu, 08 Dec 2011 11:09:14 +0100

Hi Brad,

you need to override sendAcknowledgment method in your ServletHandler like:

class MyServletHandler extends ServletHandler {

     protected boolean sendAcknowledgment(final Request request,
             final Response response)
             throws IOException {

             if (authClient(request, response) {
                   return super.sendAcknowledgment(request, response);
             } else {
                   response.setStatus(HttpStatus.EXPECTATION_FAILED_417);
                   return false;
             }
     }
}

Hope it will help.

WBR,
Alexey.

On 12/08/2011 02:59 AM, Brad McEvoy wrote:
> Hi All,
>
> I'm the developer of milton, a webdav server library.
>
> I've had some milton users asking about expect: continue handling as
> there seems to be a bit of a conflict. It seems that grizzly (like
> other servlet containers, i think) transparently responds with the
> 100- continue, causing the client to upload the file/data, and the
> milton servlet is only invoked after the file is completely uploaded.
>
> The problem is that milton implements authentication and
> authorisation, so will reject the upload if not-authorised (eg if no
> credentials were sent) with a http challenge, causing the client to
> then reupload the file again with credentials.
>
> This process completely breaks the expect-continue mechanism, since
> its purpose is to check authorisation prior to the file being uploaded.
>
> Can anyone let me know if there is a way to disable transparent
> handling of the expect/continue header?
>
> details here:
> http://stackoverflow.com/questions/8380324/how-to-get-http-100-continue-to-work-for-webdav-on-embedded-grizzly
>
> http://jira.ettrema.com:8080/browse/MIL-98
>
> Thanks,
> Brad