[Resin-interest] in Resin 4.0.7 HtttpServletRequest needs to an instance of CauchoRequest

2010-06-30 Thread Andrea Sodomaco

Hi!

To obtain some URI manipulation I implemented an instance of 
javax.servlet.http.HttpServletRequest.


public class MultiLingueHSR implements HttpServletRequest {
HttpServletRequest httpServletRequest=null;

public MultiLingueHSR(HttpServletRequest httpServletRequest) {
this.httpServletRequest = httpServletRequest;
// custom code...
}


public String getRequestURI() {

return // return custom values ;
}

//all the other methos are implemented like these...

public Object getAttribute(String arg0) {
return httpServletRequest.getAttribute(arg0);
}

public String getAuthType() {
return httpServletRequest.getAuthType();
}

public String getCharacterEncoding() {
return httpServletRequest.getCharacterEncoding();
}

public int getContentLength() {
return httpServletRequest.getContentLength();
}

public String getContentType() {
return httpServletRequest.getContentType();
}

public String getContextPath() {
return httpServletRequest.getContextPath();
}

...
}


Then I used this in a filter in the following way

public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain nextFilter)
 throws ServletException, IOException
   {

MultiLingueHSR mlHSR=new MultiLingueHSR(req);

mlHSR.getRequestDispatcher(mlHSR.getRequestURI()).include(mlHSR,response);

   }

This code worked fine in resin 3.0 and 3.1 but on resin 4.0.7 I get this 
exception


java.lang.ClassCastException: it.sodomaco.turcom.lingue.MultiLingueHSR cannot 
be cast to com.caucho.server.http.CauchoRequest
it.sodomaco.turcom.lingue.MultiLingueHSR cannot be cast to 
com.caucho.server.http.CauchoRequest
com.caucho.server.http.CauchoRequestWrapper.getCauchoRequest(CauchoRequestWrapper.java:790)
com.caucho.server.http.CauchoRequestWrapper.getSessionId(CauchoRequestWrapper.java:476)
com.caucho.server.http.AbstractCauchoRequest.finishRequest(AbstractCauchoRequest.java:588)
com.caucho.server.webapp.IncludeRequest.finishRequest(IncludeRequest.java:365)
com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:431)
com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:342)
it.sodomaco.turcom.MainFilter.doFilter(MainFilter.java:107)



Any ideas or suggestions?
Is this beaviour to be considered a bug of resin?

thank you in advance

Andrea


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] in Resin 4.0.7 HtttpServletRequest needs to an instance of CauchoRequest

2010-06-30 Thread Emil Ong
On Wed, Jun 30, 2010 at 06:04:21PM +0200, Andrea Sodomaco wrote:


[snip]

 
 Any ideas or suggestions?
 Is this beaviour to be considered a bug of resin?

Yes, it is a bug that Alex recently fixed:

http://bugs.caucho.com/view.php?id=4073

It should be fixed for Resin 4.0.8 due out soon (a week or two).

Emil


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest