Mantis - Resin
Viewing Issue Advanced Details
2444 major always 02-17-08 04:18 02-21-08 10:49
stbu  
ferg  
normal  
closed 3.1.5  
fixed  
none    
none 3.1.5  
0002444: Snapshot s080215: <rewrite-real-path> with ${webApp.root} in target does not work on Windows
I'm having the following rewrite-real-path tag defined in resin-web.xml of a webapp "rewrite-test". (See also attached rewrite-test.war for reproducing this bug report):

  <rewrite-real-path>
    <real-path regexp="/images" target="${webApp.root}/target/"/>
  </rewrite-real-path>

In this web-app there is a folder target that contains the file check.html. Because of the above <rewrite-real-path> tag a request to images/check.html should show the content of check.html to the browser:

URL to Test:
http://localhost:8080/rewrite-test/images/check.html [^]


On a Linux Platform everything works fine:

[12:56:10.531] {main} FINEST com.caucho.server.webapp.WebAppController WebAppController$12915247[/rewrite-test] active
[12:56:10.533] {main} FINEST com.caucho.server.webapp.WebAppController WebAppAdmin[resin:type=WebApp,Host=default,name=/rewrite-test] lifecycleEvent `active'
[12:56:11.217] {http--8080-1} FINEST com.caucho.server.webapp.WebApp real-path /images/check.html -> /home/user/resin-pro-3.1.s080215/webapps/rewrite-test/target/check.html
[12:56:11.219] {http--8080-1} FINE com.caucho.server.dispatch.ServletMapper invoke (uri:/images/check.html -> resin-file)
[12:56:11.325] {http--8080-1} FINEST com.caucho.server.webapp.WebApp com.caucho.server.dispatch.ServletConfigException: 'directory' is not a known servlet. Servlets must be defined by <servlet> before being used.
[12:56:11.325] {http--8080-1} at com.caucho.server.dispatch.ServletManager.createServletChain(ServletManager.java:180)
[12:56:11.325] {http--8080-1} at com.caucho.server.webapp.WebApp.getNamedDispatcher(WebApp.java:2378)
[12:56:11.325] {http--8080-1} at com.caucho.servlets.FileServlet.init(FileServlet.java:98)
[12:56:11.325] {http--8080-1} at com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:830)
[12:56:11.325] {http--8080-1} at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:732)
[12:56:11.325] {http--8080-1} at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:94)
[12:56:11.325] {http--8080-1} at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:187)
[12:56:11.325] {http--8080-1} at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:181)
[12:56:11.325] {http--8080-1} at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
[12:56:11.325] {http--8080-1} at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:269)
[12:56:11.325] {http--8080-1} at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
[12:56:11.325] {http--8080-1} at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
[12:56:11.325] {http--8080-1} at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
[12:56:11.325] {http--8080-1} at java.lang.Thread.run(Thread.java:595)
[12:56:11.325] {http--8080-1}
[12:56:11.327] {http--8080-1} FINER com.caucho.server.dispatch.ServletConfigImpl Servlet[resin-file] active
[12:56:11.328] {http--8080-1} FINEST com.caucho.server.dispatch.ServletConfigImpl javax.management.NotCompliantMBeanException: resin:type=FileServlet,Host=default,WebApp=/rewrite-test,name=resin-file mbean has no MBean interface
[12:56:11.329] {http--8080-1} FINER com.caucho.server.dispatch.ServletConfigImpl Servlet[resin-file] active
[12:56:11.371] {http--8080-1} FINE com.caucho.db.store.Store Store[4] allocating block 2 fragment
[12:56:11.378] {http--8080-1} FINEST com.caucho.db.store.Block ReadBlock[Store[4],2] create
[12:56:11.378] {http--8080-1} FINEST com.caucho.db.store.Block ReadBlock[Store[4],2] allocate
[12:56:11.397] {http--8080-1} FINEST com.caucho.db.store.Block write db-block ReadBlock[Store[4],2] [0, 65536]
[12:56:11.401] {http--8080-1} FINEST com.caucho.db.store.Block ReadBlock[Store[4],2] free
[12:56:11.402] {http--8080-1} FINEST com.caucho.db.store.Block ReadBlock[Store[4],2] free
[12:56:11.403] {http--8080-1} FINEST com.caucho.db.store.Block ReadBlock[Store[4],2] allocate
[12:56:11.403] {http--8080-1} FINEST com.caucho.db.store.Block ReadBlock[Store[4],2] free
[12:56:11.415] {http--8080-1} FINE com.caucho.server.cache.CacheFilterChain caching: /rewrite-test/images/check.html etag="/FWAuAxKltH" length=14


On a Windows Platform it is NOT working:

[12:59:38.968] {main} FINEST com.caucho.server.webapp.WebAppController WebAppController$14633980[/rewrite-test] active
[12:59:38.968] {main} FINEST com.caucho.server.webapp.WebAppController WebAppAdmin[resin:type=WebApp,Host=default,name=/rewrite-test] lifecycleEvent `active'
[12:59:44.828] {http--8080-1} FINEST com.caucho.server.webapp.WebApp real-path /images/check.html -> C:Downloadsresin-pro-3.1.s080215webappsrewrite-test\target\check.html
[12:59:44.828] {http--8080-1} FINEST com.caucho.server.webapp.WebApp real-path /images/check.html/index.jsp -> C:Downloadsresin-pro-3.1.s080215webappsrewrite-test\target\check.html\index.jsp
[12:59:44.828] {http--8080-1} FINEST com.caucho.server.webapp.WebApp real-path /images/check.html/index.php -> C:Downloadsresin-pro-3.1.s080215webappsrewrite-test\target\check.html\index.php
[12:59:44.828] {http--8080-1} FINEST com.caucho.server.webapp.WebApp real-path /images/check.html/index.html -> C:Downloadsresin-pro-3.1.s080215webappsrewrite-test\target\check.html\index.html
[12:59:44.828] {http--8080-1} FINE com.caucho.server.dispatch.ServletMapper invoke (uri:/images/check.html -> resin-file)
[12:59:44.859] {http--8080-1} FINEST com.caucho.server.webapp.WebApp com.caucho.server.dispatch.ServletConfigException: 'directory' is not a known servlet. Servlets must be defined by <servlet> before being used.
[12:59:44.859] {http--8080-1} at com.caucho.server.dispatch.ServletManager.createServletChain(ServletManager.java:180)
[12:59:44.859] {http--8080-1} at com.caucho.server.webapp.WebApp.getNamedDispatcher(WebApp.java:2378)
[12:59:44.859] {http--8080-1} at com.caucho.servlets.FileServlet.init(FileServlet.java:98)
[12:59:44.859] {http--8080-1} at com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:830)
[12:59:44.859] {http--8080-1} at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:732)
[12:59:44.859] {http--8080-1} at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:94)
[12:59:44.859] {http--8080-1} at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:187)
[12:59:44.859] {http--8080-1} at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:181)
[12:59:44.859] {http--8080-1} at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
[12:59:44.859] {http--8080-1} at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:269)
[12:59:44.859] {http--8080-1} at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
[12:59:44.859] {http--8080-1} at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
[12:59:44.859] {http--8080-1} at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
[12:59:44.859] {http--8080-1} at java.lang.Thread.run(Thread.java:619)
[12:59:44.859] {http--8080-1}
[12:59:44.859] {http--8080-1} FINER com.caucho.server.dispatch.ServletConfigImpl Servlet[resin-file] active
[12:59:44.859] {http--8080-1} FINEST com.caucho.server.dispatch.ServletConfigImpl javax.management.NotCompliantMBeanException: resin:type=FileServlet,Host=default,WebApp=/rewrite-test,name=resin-file mbean has no MBean interface
[12:59:44.859] {http--8080-1} FINER com.caucho.server.dispatch.ServletConfigImpl Servlet[resin-file] active


As you can see, the rewrite is triggered by the request, but the value of target contains not the proper path:

FINEST com.caucho.server.webapp.WebApp real-path /images/check.html -> C:Downloadsresin-pro-3.1.s080215webappsrewrite-test\target\check.html


C:Downloadsresin-pro-3.1.s080215webappsrewrite-test\target\check.html
should be:
C:\Downloads\resin-pro-3.1.s080215\webapps\rewrite-test\target\check.html

The EL variable ${webApp.root} (http://www.caucho.com/resin/doc/el-var.xtp#webApp) [^] should be able to handle the Windows file.separator "\".

Resin Professional 3.1.s080215 (built Fri, 15 Feb 2008 12:10:51 PST)

Windows Platform is:
Windows XP 5.1 x86
Java 1.6.0_02-b06, 32, mixed mode, Cp1252, de, Sun Microsystems Inc

Linux Platform is:
Linux 2.6.9-55.0.0.0.2.ELsmp i386
Java 1.5.0_14-b03, 32, mixed mode, sharing, UTF-8, de, Sun Microsystems Inc.


 C:\Downloads\resin-pro-3.1.s080215\webapps\rewrite-test.war [^] (1,242 bytes) 02-17-08 04:18

Notes
(0002791)
ferg   
02-21-08 10:49   
server/13nb