Mantis - Resin
Viewing Issue Advanced Details
1010 minor always 03-23-06 14:18 03-24-06 11:20
ferg  
 
urgent  
closed 3.0.18  
fixed  
none    
none 3.0.19  
0001010: rewrite-dispatch issues
(rep by Bill Au)

I have two webapps, webapp1 and webapp2, installed in my resin server.
For URL that looks like "/webapp1/select", I actually
need to have it handed by webapp2 (ie /webapp2/select).
So I somehow need to rewrite/map/forward/redirect requests with the
URL /webapp1/select to /webapp2/select.

I came across <rewrite-dispatch>. I tried putting the following
under <host>:

  <rewrite-dispatch>
    <forward regexp='^/webapp1/select' target='/webapp2/select'/>
  </rewrite-dispatch>

But got a 500 response:
500 Servlet Exception
java.lang.NullPointerException
    at com.caucho.server.connection.AbstractHttpRequest.getRequestDispatcher(AbstractHttpRequest.java:2016)
    at com.caucho.server.dispatch.ForwardFilterChain.doFilter(ForwardFilterChain.java:78)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
    at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:492)
    at com.caucho.util.ThreadPool.run(ThreadPool.java:425)
    at java.lang.Thread.run(Thread.java:595)

When I tried:

  <rewrite-dispatch>
    <redirect regexp='^/webapp1/select' target='/webapp2/select'/>
  </rewrite-dispatch>

I got a different 500 response:
500 Servlet Exception
java.lang.NullPointerException
    at com.caucho.server.connection.AbstractHttpResponse.getAbsolutePath(AbstractHttpResponse.java:633)
    at com.caucho.server.connection.AbstractHttpResponse.sendRedirect(AbstractHttpResponse.java:557)
    at com.caucho.server.dispatch.RedirectFilterChain.doFilter(RedirectFilterChain.java:87)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
    at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:492)
    at com.caucho.util.ThreadPool.run(ThreadPool.java:425)
    at java.lang.Thread.run(Thread.java:595)

/webapp2/select is mapped to a servlet but there is no mapping for
/webapp1/select. Is that the cause of the NullPointerException?

Should the RewriteFilter be used instead?


Notes
(0000944)
ferg   
03-24-06 11:20   
server/13sf