[opencms-dev] How to use filters in OpenCMS module
Christian Steinert
christian_steinert at web.de
Wed Jan 3 20:03:25 CET 2007
> -----Ursprüngliche Nachricht-----
> Von: The OpenCms mailing list <opencms-dev at opencms.org>
> Gesendet: 02.01.07 23:26:01
> An: opencms-dev at opencms.org
> Betreff: [opencms-dev] How to use filters in OpenCMS module
> Hi,
>
> I have created an javax.servlet.Filter in my module. I have created the
> Filter class, loaded to OpenCMS, published it as usually . I have
> registered this filter class to opencms web.xml as I usually do with web
> application. I have restarted the web server (Tomcat 5.5) but the only
> answer was:
>
>
> A server error occured!
>
>
> Server error 500
>
>
> Internal Server Error
>
> The server encountered an unexpected condition which prevented it from
> fulfilling the request.
>
> The server cannot complete the request because it encountered an error.
>
> Please try it again in a few minutes, or contact the server administrator.
>
> Powered by OpenCms - the open source content management system
> <http://www.opencms.org>
>
>
> My class name is: cz.zcu.fav.FavLoadFilter.java
>
> web.xml mapping I have added:
> <filter>
> <filter-name>FavLoadFilter</filter-name>
> <filter-class>cz.zcu.fav.filter.FavLoadFilter</filter-class>
> </filter>
> <filter-mapping>
> <filter-name>FavLoadFilter</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
>
>
> 1. Whats wrong?
> 2. Do I have to register it somewhere else?
> 3. When I export the module, how this filter setting will be exported?
> Does the importer needs to do some correction itself?
> 4. Is there any other way, how to work with filters? Or does something
> similar exist in OpenCMS?
>
> I was looking around and didn't find a thing.
>
> thanks for ideas
>
I have only one idea - I think it's a hostname problem with the pseudo-request from your servlet filter: the request management of opencms uses the hostname to determine which website should be served. For example if your server has two names site1.com and site2.com and if the client sent the request to www.site1.com/... then in the opencms configuration you define which website should be triggered.
If you use a servlet filter, then I would imagine that the name of the target host is something like 'localhost' or 127.0.0.1 so you should try to add an additional website setting in opencms that maps these names and your main server name to the website that your servlet filter tries to reach.
hth
christian
__________________________________________________________________________
Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach!
Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
More information about the opencms-dev
mailing list