One more suggestion is to declare the filter so that it is invoked when
request dispatcher methods are called:

<filter-mapping>
  <filter-name>WicketSessionFilter</filter-name>
  <url-pattern>*.do</url-pattern>
  <dispatcher>REQUEST</dispatcher>
  <dispatcher>INCLUDE</dispatcher>
</filter-mapping>

I'm not sure if that is what is happening in this situation, but it
might be worth a shot.

-----Original Message-----
From: James Perry [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 30, 2008 7:31 AM
To: [email protected]
Subject: Re: WicketSessionFilter Problem:
java.lang.IllegalStateException

I can't work out why it doesn't work so I decided to subclass the
WebRequestCycle and access the HTTPSession's attributes via my
PharmisisSession.

Cheers,
Jim.

On Wed, Jul 30, 2008 at 11:19 AM, James Perry
<[EMAIL PROTECTED]> wrote:
> Thanks for the swift reply. That's what I originally had but it didn't
> work and just tried again to re-confirm. :-)
>
> Any other suggestions? I've checkout the source code to see if that
helps.
>
> On Wed, Jul 30, 2008 at 10:42 AM, Martijn Dashorst
> <[EMAIL PROTECTED]> wrote:
>> I think you have to wrap the wicket session filter around your *.do
>> mapping, not your new/* mapping.
>>
>> Martijn
>>
>> On Wed, Jul 30, 2008 at 11:35 AM, James Perry
>> <[EMAIL PROTECTED]> wrote:
>>> Hello!
>>>
>>> I would be grateful for any advice with the below problem I am
>>> encountering with the WicketSessionFilter.
>>>
>>> I managed to convince my colleagues to migrate our
www.mypharmisis.com
>>> (a drug ordering system for the Pharmaceutical industry) from Struts
>>> to Wicket after the success of a greenfield project using Wicket. I
>>> don't have the resources to migrate all at once so Struts 1 and
Wicket
>>> so I have set them up to coexist congruently. However! I am having
>>> problems sharing necessary state between Struts 1 and Wicket using
the
>>> WicketSessionFilter :-(
>>>
>>> When my Strut controllers tries to access my WebSession, it throws a
>>> java.lang.IllegalStateException: you can only locate or create
>>> sessions in the context of a request cycle. My stack trace is:
>>>
>>> org.apache.wicket.Session.findOrCreate(Session.java:206)
>>> org.apache.wicket.Session.get(Session.java:250)
>>>
com.mypharmsisis.pages.session.PharmisisSession.get(PharmisisSession.jav
a:24)
>>>
com.mypharmisis.struts.isis.actions.AbstractEasyAction.displayPage(Abstr
actEasyAction.java:52)
>>>
com.mypharmisis.struts.isis.actions.EasyOrderHomeAction.displayPage(Easy
OrderHomeAction.java:53)
>>>
>>> Here is a snippet of my web.xml:
>>>
>>>    <!-- Wicket configuration using standard JEE filter -->
>>>    <filter>
>>>        <filter-name>wicket.pharmisis</filter-name>
>>>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class
>
>>>        <init-param>
>>>            <param-name>applicationClassName</param-name>
>>>
<param-value>com.mypharmisis.pages.PharmisisApplication</param-value>
>>>        </init-param>
>>>    </filter>
>>>
>>>    <filter>
>>>        <filter-name>WicketSessionFilter</filter-name>
>>>
<filter-class>org.apache.wicket.protocol.http.servlet.WicketSessionFilte
r</filter-class>
>>>        <init-param>
>>>            <param-name>filterName</param-name>
>>>            <param-value>wicket.pharmisis</param-value>
>>>        </init-param>
>>>    </filter>
>>>
>>>    <filter-mapping>
>>>        <filter-name>wicket.pharmisis</filter-name>
>>>        <url-pattern>/secure/new/*</url-pattern>
>>>    </filter-mapping>
>>>
>>>    <filter-mapping>
>>>        <filter-name>WicketSessionFilter</filter-name>
>>>        <url-pattern>*.do</url-pattern>
>>>    </filter-mapping>
>>>
>>>    <!-- End of Wicket configuration -->
>>>
>>>    <context-param>
>>>        <param-name>
>>>            javax.servlet.jsp.jstl.fmt.localizationContext
>>>        </param-name>
>>>        <param-value>
>>>            com.mypharmisis.isis.ApplicationResources
>>>        </param-value>
>>>    </context-param>
>>>
>>>    <context-param>
>>>        <param-name>crystal_image_uri</param-name>
>>>        <param-value>/isis2/crystalreportviewers11</param-value>
>>>    </context-param>
>>>
>>>    <distributable/>
>>>    <listener>
>>>
<listener-class>com.mypharmisis.struts.isis.framework.IsisContextListene
r</listener-class>
>>>    </listener>
>>>
>>>    <servlet>
>>>        <servlet-name>action</servlet-name>
>>>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>>>
>>>        <init-param>
>>>            <param-name>config</param-name>
>>>            <param-value>/WEB-INF/struts-config.xml</param-value>
>>>        </init-param>
>>>        <init-param>
>>>            <param-name>debug</param-name>
>>>            <param-value>true</param-value>
>>>        </init-param>
>>>        <init-param>
>>>            <param-name>detail</param-name>
>>>            <param-value>9</param-value>
>>>        </init-param>
>>>        <init-param>
>>>            <param-name>nocache</param-name>
>>>            <param-value>true</param-value>
>>>        </init-param>
>>>        <init-param>
>>>            <param-name>validate</param-name>
>>>            <param-value>true</param-value>
>>>        </init-param>
>>>
>>>        <load-on-startup>1</load-on-startup>
>>>
>>>
>>>    </servlet>
>>>
>>>    <!-- DWR configuration -->
>>>    <servlet>
>>>        <servlet-name>dwr-invoker</servlet-name>
>>>        <display-name>DWR Servlet</display-name>
>>>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
>>>        <init-param>
>>>            <param-name>debug</param-name>
>>>            <param-value>true</param-value>
>>>        </init-param>
>>>    </servlet>
>>>
>>>    <!-- Action Servlet Mappings -->
>>>
>>>    <servlet-mapping>
>>>        <servlet-name>action</servlet-name>
>>>        <url-pattern>*.do</url-pattern>
>>>    </servlet-mapping>
>>>
>>>    <servlet-mapping>
>>>        <servlet-name>dwr-invoker</servlet-name>
>>>        <url-pattern>/dwr/*</url-pattern>
>>>    </servlet-mapping>
>>>
>>>    <!-- The Welcome File List    -->
>>>    <welcome-file-list>
>>>        <welcome-file>index.jsp</welcome-file>
>>>    </welcome-file-list>
>>>
>>>    <error-page>
>>>        <error-code>400</error-code>
>>>        <location>/isisErrorAction.do?code=400</location>
>>>    </error-page>
>>>
>>>    <error-page>
>>>        <error-code>404</error-code>
>>>        <location>/isisErrorAction.do?code=404</location>
>>>    </error-page>
>>>
>>>    <error-page>
>>>        <error-code>500</error-code>
>>>        <location>/isisErrorAction.do?code=500</location>
>>>    </error-page>
>>>
>>>
>>>    <!-- Start: Struts Tag Library Descriptors  -->
>>>    <!--
>>>       <taglib>
>>>           <taglib-uri>struts.jar</taglib-uri>
>>>           <taglib-location>/meta-inf/taglib.tld</taglib-location>
>>>       </taglib>
>>>    -->
>>>
>>>    <taglib>
>>>        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
>>>        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
>>>    </taglib>
>>>    <taglib>
>>>        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
>>>        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
>>>    </taglib>
>>>    <taglib>
>>>        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
>>>        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
>>>    </taglib>
>>>    <taglib>
>>>        <taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
>>>
<taglib-location>/WEB-INF/struts-template.tld</taglib-location>
>>>    </taglib>
>>>    <taglib>
>>>        <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
>>>        <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
>>>    </taglib>
>>>    <taglib>
>>>        <taglib-uri>/WEB-INF/sslext.tld</taglib-uri>
>>>        <taglib-location>/WEB-INF/sslext.tld</taglib-location>
>>>    </taglib>
>>>
>>>    <!-- End: Struts Tag Library Descriptors -->
>>>
>>>    <security-constraint>
>>>        <web-resource-collection>
>>>            <web-resource-name>ActionClasses</web-resource-name>
>>>            <url-pattern>/secure/*</url-pattern>
>>>            <url-pattern>/redirect_home.jsp</url-pattern>
>>>        </web-resource-collection>
>>>        <auth-constraint>
>>>            <role-name>*</role-name>
>>>        </auth-constraint>
>>>    </security-constraint>
>>>
>>>
>>>    <login-config>
>>>        <auth-method>FORM</auth-method>
>>>        <realm-name>ISISModule</realm-name>
>>>        <form-login-config>
>>>
<form-login-page>/realLogin.do?method=login</form-login-page>
>>>
<form-error-page>/realLogin.do?method=loginFailed</form-error-page>
>>>        </form-login-config>
>>>    </login-config>
>>>
>>>    <security-role>
>>>        <description>A user with no permissions</description>
>>>        <role-name>nobody</role-name>
>>>    </security-role>
>>>
>>>    <security-role>
>>>        <description>Administrator Web</description>
>>>        <role-name>Admin Web</role-name>
>>>    </security-role>
>>>
>>>    <security-role>
>>>        <description>Head Office</description>
>>>        <role-name>Head Office</role-name>
>>>    </security-role>
>>>
>>>
>>> </web-app>
>>>
>>> Cheers,
>>> Jim.
>>>
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best:
http://wicketinaction.com
>> Apache Wicket 1.3.4 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

_____________

The information contained in this message is proprietary and/or confidential. 
If you are not the 
intended recipient, please: (i) delete the message and all copies; (ii) do not 
disclose, 
distribute or use the message in any manner; and (iii) notify the sender 
immediately. In addition, 
please be aware that any message addressed to our domain is subject to 
archiving and review by 
persons other than the intended recipient. Thank you.
_____________

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to