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

Jonathan Woods jonathan.woods at scintillance.com
Fri May 4 17:50:05 CEST 2007


Christoph -

Stream of consciousness reply follows...

I wonder if you're rewriting URLs (or using mod_proxy), and somewhere along
the line OpenCms is taking it upon itself to use a URL pattern which (i)
doesn't get rewritten, (ii) all the same gets past into Tomcat, (iii)
happens not to match your filter pattern.  That's all I can think of - if
this happened to me, it would be for that kind of reason!  I forget - is the
filter pattern relative to the webapp context path?  I guess it must be; so
I imagine the problem lies in how URL is rewritten.  At a guess, somewhere
you're presuming /opencms/opencms, and the /opencms/export case doesn't end
up in your filter being invoked.

Static export doesn't happen at all when you're in the Offline project, as
you know.  When you're online, you must have configured your XML resources
to be statically exportable, so CmsJspTag[whatever it is].link() is
generating an export path URL in page output; when the link is followed,
then as usual for on-demand export the page-not-found condition causes the
404 handler to be invoked, and the latter fires off the on-demand export
activity.

Good luck...

Jon

-----Original Message-----
From: Christoph Schönfeld [mailto:cschoenfeld at sylphen.com] 
Sent: 04 May 2007 15:26
To: The OpenCms mailing list
Subject: [opencms-dev] Servlet Filter not applied when custom XML content
file clicked in "Online" project

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(Http
11Protocol.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(CmsStaticExportManage
r.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=/mycustomxmlc
ontentfile.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

_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev






More information about the opencms-dev mailing list