Re: Allow Servlet to Control 100-continue response

2011-06-19 Thread Pid
On 18/06/2011 06:53, Rehtron wrote:
 Hi
 
 Currently if a client supplies the Expect: 100-continue header on a POST
 or PUT, Tomcat appears to send the response header (100-continue) before
 passing control to the servlet.

Out of interest, are you asking to control specifically the 100
response, or all access to the servlet?

Are you currently implementing access control logic inside the servlet?


p

 I need to use the servlet  to control this response and accept/reject the
 request before receiving the request content, Is there anyone could give me
 some advice?
 
 Thanks.
 




signature.asc
Description: OpenPGP digital signature


Re: Allow Servlet to Control 100-continue response

2011-06-19 Thread Simon Olofsson

On 2011-06-18 13:46, Mark Thomas wrote:

  You can use a Filter as mack Lu suggested

Wrong.


Thanks for the correction.
In StandardWrapperValve the request is acknowledged before the 
FilterChain is constructed. I should've looked it up :)


Simon


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Allow Servlet to Control 100-continue response

2011-06-19 Thread Rehtron
Thanks to all who reply.

Yes, I am developing a REST interface for a large file storage system by
Servlet  Tomcat.

The Expect 100-continue is highly inefficient for LARGE file transfer, I
need to validate HTTP header by our access control logic when PUT a file, if
the headers is invalid, the transfer request  will be refused before the
client to send the body.

But I cannot implement this scenario by Servlet, Tomcat will always pass the
request header  body to my Servlet at once.

I will investigate the Tomcat Valve mechanism, but one thing is for sure,
the Valve based implementation depend on the Tomcat private implementation,
that means I cannot use Jetty to do unit test.

Can Servlet 3.0 Comet implement this?

Thanks.

Zijian.

2011/6/19 Pid p...@pidster.com

 On 18/06/2011 06:53, Rehtron wrote:
  Hi
 
  Currently if a client supplies the Expect: 100-continue header on a
 POST
  or PUT, Tomcat appears to send the response header (100-continue)
 before
  passing control to the servlet.

 Out of interest, are you asking to control specifically the 100
 response, or all access to the servlet?

 Are you currently implementing access control logic inside the servlet?


 p

  I need to use the servlet  to control this response and accept/reject the
  request before receiving the request content, Is there anyone could give
 me
  some advice?
 
  Thanks.
 





Re: Allow Servlet to Control 100-continue response

2011-06-19 Thread Pid
On 19/06/2011 11:59, Rehtron wrote:
 I will investigate the Tomcat Valve mechanism, but one thing is for sure,
 the Valve based implementation depend on the Tomcat private implementation,
 that means I cannot use Jetty to do unit test.

Why not test with Tomcat instead?


 Can Servlet 3.0 Comet implement this?

Servlet 3.0 OR Comet.  They are not the same, in any case Async requests
are unrelated to your original inquiry.


p



signature.asc
Description: OpenPGP digital signature


Re: Allow Servlet to Control 100-continue response

2011-06-18 Thread 国清 mack Lu
Try to use the filter.


2011-06-18 



mack Lu 



发件人: Rehtron 
发送时间: 2011-06-18  13:53:58 
收件人: users 
抄送: 
主题: Allow Servlet to Control 100-continue response 
 
Hi
Currently if a client supplies the Expect: 100-continue header on a POST
or PUT, Tomcat appears to send the response header (100-continue) before
passing control to the servlet.
I need to use the servlet  to control this response and accept/reject the
request before receiving the request content, Is there anyone could give me
some advice?
Thanks.


Re: Allow Servlet to Control 100-continue response

2011-06-18 Thread Mark Thomas
On 18/06/2011 11:56, Simon Olofsson wrote:
 Rehtron,
 
 On 2011-06-18 7:53, Rehtron wrote:
 I need to use the servlet  to control this response and accept/reject the
 request before receiving the request content, Is there anyone could
 give me
 some advice?
 
 as you noticed it's too late when your Servlet is invoked: The request
 is already acknowledged.

Correct.

 You can use a Filter as mack Lu suggested

Wrong.

 or you could use a Valve

Correct. A Valve is the only option.

Mark



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Allow Servlet to Control 100-continue response

2011-06-17 Thread Rehtron
Hi

Currently if a client supplies the Expect: 100-continue header on a POST
or PUT, Tomcat appears to send the response header (100-continue) before
passing control to the servlet.

I need to use the servlet  to control this response and accept/reject the
request before receiving the request content, Is there anyone could give me
some advice?

Thanks.