[opencms-dev] Servlet Filter not applied when custom XML content file clicked in "Online" project

Christoph Schönfeld cschoenfeld at sylphen.com
Fri May 4 16:25:33 CEST 2007


Dear fellow list readers,

I have a custom XML content type. The XML content files are associated 
with a JSP page via template-elements which requires a Hibernate 
session. When I click on one of my custom XML content files in the 
OpenCms Explorer to preview it I receive an exception stating that no 
Hibernate Session is available. This happens only in the "Online" project.

Obviously the servlet filter I normally use to ensure that Hibernate 
sessions are opened is not called. I cannot find it in the stack trace. 
This is my filter mapping:

    <filter-mapping>
        <filter-name>hibernateFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

In the stack trace starts like

at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:595)

Thus, I assume it is not incomplete and should show any filter called. 
But neither the Hibernate filter nor my other filter which is in place 
for the "/*" url-pattern are getting called. However, I noticed that the 
static export is called:

at 
org.opencms.staticexport.CmsStaticExportManager.export(CmsStaticExportManager.java:498)

I suppose it is normal that the static export is run when files are 
accessed in the "Online" project.

Strangely, the access log contains a handle404 message as the first log 
entry at click time.

127.0.0.1 - - [04/May/2007:15:42:29 +0200] "GET 
/handle404/export/mycustomxmlcontentfile.html HTTP/1.1" 404 1130
127.0.0.1 - - [04/May/2007:15:42:29 +0200] "GET 
/opencms/system/workplace/commons/displayresource.jsp?resource=/mycustomxmlcontentfile.html 
HTTP/1.1" 302 -
127.0.0.1 - - [04/May/2007:15:42:29 +0200] "GET 
/mycustomxmlcontentfile.html HTTP/1.1" 200 7935

Displayresource.jsp seems to be the mechanism the OpenCms Explorer uses 
to show files.

I am wondering:
- how is it possible that the servlet filters are not called in the 
"Online" project
- what causes the handle404 being invoked even before displayresource.jsp?


Best regards,
Christoph



More information about the opencms-dev mailing list