Remy Maucherat wrote:
On Wed, 2008-03-19 at 18:17 -0600, Filip Hanik - Dev Lists wrote:
Remy Maucherat wrote:
On Wed, 2008-03-19 at 22:43 +0000, [EMAIL PROTECTED] wrote:
   +1 : remm, markt
-  -1 : fhanik - I tried this patch, and it doesn't work, it hangs. I also saw 
the bug report, informing about further issues that are still valid
+  +1 : fhanik - I don't think we should support mark/reset, we can supply a 
filter that does it at the app level by wrapping getReader with a reader that 
bufferes
That's used by that stupid readLine feature, I didn't add it to have
fun :(
sure doesn't sound like fun :)
but given what a complicated impl that would end up being, I'd remove the support for it all together and have a Filter that does it with extreme simplicity just configured in the global web.xml file.
the benefits are many
1. we don't need to have that kind of code support in our buffers, since it proves to be very complicated
2. users still get the support if wanted (one can of course turn it off)
3. the actual implementation of mark,reset and readLine becomes very easy
any thoughts on taking that approach?
Since a BufferedReader is provided, I would say it's better to support
mark/reset. If removing it anyway, readLine should be redone.
If I got this right, and correct me if I don't, This could have been so much easier, instead of Tomcat's complex implementation of the buffered reader. basically, if Tomcat implemented was just java.io.Reader, no buffering, no readline, no nothing, then the whole problem would have been solved by this simple filter (and I believe this still will solve the problem, even with todays code)
   public void doFilter(ServletRequest request, ServletResponse 
response, FilterChain chain) throws IOException, ServletException {
       HttpServletRequest req = (HttpServletRequest)request;
HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper(req) {
           BufferedReader reader = null;
           public BufferedReader getReader() throws IOException {
               if (reader==null) {
                   BufferedReader bf = super.getReader();
                   reader = new BufferedReader(bf);
               }
               return reader;
           }
       };
       chain.doFilter(req, response);
   }

what this filter does, is it relies on the already implemented BufferedReader, no need to reinvent the wheel. The java.io.BufferedReader, already has this logic implemented, and it works, so CoyoteReader, will only be treated as a java.io.Reader, and we can bypass all the stuff in Tomcat's code base
Filip


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to