Hi all,
I would appreciate any help on the following problem. It is holding me for
now several days, and I am getting completely lost.
I have a struts portlet which uses a filter. The SvcIFilter call has to be
the first on the way in and the last on the way out. It is used to
open/close Connections to a database.
* We assume that any SvcI object must remain open until after the jsp
* has done its stuff, i.e. after the action returns but before we finally
* deliver the response. This filter allows us to implant a callback object
* which has a close method which will be called when the request returns.
I also have a second filter, which is a badic XSLT filter.
The stand-alone struts application works fine, with the following
configuration:
<filter-mapping>
<filter-name>SvcI Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>XSLT Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
For the Portlet, I started getting into troubles because the close method
of the SvcI filter was called more than once. That is, we have a strict
open-close sequence which works fine in the stand alone application.
Basically, open opens connection and close commits transactions and closes
connections. I first tried to configure the web.xml file like this:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
.
.
.
<filter-mapping>
<filter-name>SvcI Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>XSLT Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
Then I tried this: (change in the url-patttern)
<filter-mapping>
<filter-name>SvcI Filter</filter-name>
<url-pattern>*.do</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>XSLT Filter</filter-name>
<url-pattern>*.do</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
The last configuration gave better results (I could get up to the
initial display of the portlet), but any click on a link (invoking a
struts action) gave Exceptions because the close method of the filter was
executed more than once. I also noticed that everything relied on the
INCLUDE method of the dispatcher, (REQUEST and FORWARD don't seem to have
any effect). If I don't put INCLUDE the filter is not called on the way
out. So I have a situation where with some config the filter is called too
often and the other not often enough :(
A strange thing was that when I tried to launch the portlet, Jetspeed
started to print out these lines, just after the XSLT filter was called:
cheater: target value = 99
cheater: target value = 59
cheater: target value = 55
cheater: target value = 29
So what is going on ? It seems that the filter reloads the Number Guess
portlet ??? Why would it do so ?
How should I configure the url-pattern so the SVCI filter gets called the
firston the way in and the last on the way out ??? I repeat, the
stand-alone struts application works fine, and I am a bit lost at the
moment.
Note that I am using the struts-bridge 0.1.
Thanks in advance for any help.
Regards
Xavier
--
-------------=[ xlawrence at jahia dot com ]=-------------
Jahia : A collaborative source CMS and Portal Server
www.jahia.org Community and product web site
www.jahia.com Commercial services company
www.collaborativesource.org Jahia's collaborative license
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]