You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by rsi610 <ra...@lntinfotech.com> on 2014/07/08 09:31:27 UTC
Not able to get Wicket Session even though WicketSessionFilter has
been added
Hi,
I am not able to obtain the wicketsession even though sessionFilter has been
added
My requirement
1. Click of button on Page 1 (url : http://localhost:7001/abc/def/). open
editable Pdf form in new window.
2. on click of submit present on pdf form , call a servlet (configured at
http://localhost:7001/abc/def/fgh/ijk).
3. Trying to access the session in this servlet . But of no avail.
The session is configured at (/def/* )
*****Code in web.xml ******
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>configuration</param-name>
<param-value>deployment</param-value>
</context-param>
<filter>
<filter-name>loadablePdfWicketSessionFilter</filter-name>
<filter-class>
org.apache.wicket.protocol.http.servlet.WicketSessionFilter
</filter-class>
<init-param>
<param-name>filterName</param-name>
<param-value>applicationSession</param-value>
</init-param>
</filter>
<filter>
<filter-name>applicationSession</filter-name>
<filter-class>
com.marsh.itg.ddeepa.presentation.appcore.MWicketFilter
</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>
com.marsh.itg.abc.presentation.app.view.ApplicationSession
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>loadablePdfWicketSessionFilter</filter-name>
<url-pattern>/abc/def/ghi</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>applicationSession</filter-name>
<url-pattern>/abc/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>loadablePdf</servlet-name>
<servlet-class>
com.marsh.itg.abc.presentation.quote.servlet.ghi
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ProlStartUpServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>loadablePdf</servlet-name>
<url-pattern>/abc/def/ghi</url-pattern>
</servlet-mapping>
</web-app>
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Not-able-to-get-Wicket-Session-even-though-WicketSessionFilter-has-been-added-tp4666469.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Not able to get Wicket Session even though WicketSessionFilter
has been added
Posted by Peter Henderson <pe...@starjar.com>.
On 17 July 2014 09:24, Martin Grigorov <mg...@apache.org> wrote:
> I'd suggest you to upgrade to something we support (1.5.11+).
> 1.3.5 is very old. There is 1.3.7 but I cannot guarantee that it will solve
> the issue.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Thu, Jul 17, 2014 at 10:59 AM, rsi610 <ra...@lntinfotech.com>
> wrote:
>
> > Any suggestions on the above issue ?
> >
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Not-able-to-get-Wicket-Session-even-though-WicketSessionFilter-has-been-added-tp4666469p4666634.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
I was curious about when 1.3.5 was released. A little big of git magic.
(thanks to
http://stackoverflow.com/questions/6269927/how-can-i-list-all-tags-in-my-git-repository-by-the-date-they-were-created
)
refs/tags/wicket-1.3.5 Wed Oct 15 21:16:22 2008 +0000
Very old indeed.
--
Peter Henderson
Re: Not able to get Wicket Session even though WicketSessionFilter
has been added
Posted by Martin Grigorov <mg...@apache.org>.
I'd suggest you to upgrade to something we support (1.5.11+).
1.3.5 is very old. There is 1.3.7 but I cannot guarantee that it will solve
the issue.
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Thu, Jul 17, 2014 at 10:59 AM, rsi610 <ra...@lntinfotech.com> wrote:
> Any suggestions on the above issue ?
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Not-able-to-get-Wicket-Session-even-though-WicketSessionFilter-has-been-added-tp4666469p4666634.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Not able to get Wicket Session even though WicketSessionFilter
has been added
Posted by rsi610 <ra...@lntinfotech.com>.
Any suggestions on the above issue ?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Not-able-to-get-Wicket-Session-even-though-WicketSessionFilter-has-been-added-tp4666469p4666634.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Not able to get Wicket Session even though WicketSessionFilter
has been added
Posted by rsi610 <ra...@lntinfotech.com>.
My Wicket version is 1.3.5
The doFiler is as follows :
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException
{
HttpServletRequest httpServletRequest = ((HttpServletRequest)request);
*HttpSession httpSession = httpServletRequest.getSession(false);* if
(httpSession != null)
{
Session session = (Session)httpSession.getAttribute(sessionKey);
if (session != null)
{
// set the session's threadlocal
Session.set(session);
if (log.isDebugEnabled())
{
log.debug("session " + session + " set as current for " +
httpServletRequest.getContextPath() + "," +
httpServletRequest.getServerName());
}
}
else
{
if (log.isDebugEnabled())
{
log.debug("could not set Wicket session: key " + sessionKey +
" not found in http session for " +
httpServletRequest.getContextPath() +
"," + httpServletRequest.getServerName());
}
}
}
else
{
if (log.isDebugEnabled())
{
log.debug("could not set Wicket session: no http session was created yet
for " +
httpServletRequest.getContextPath() + "," +
httpServletRequest.getServerName());
}
}
try
{
// go on with processing
chain.doFilter(request, response);
}
finally
{
Session.unset();
}
}
The httpsession in the WicketSessionFilter is null.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Not-able-to-get-Wicket-Session-even-though-WicketSessionFilter-has-been-added-tp4666469p4666516.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Not able to get Wicket Session even though WicketSessionFilter
has been added
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
WicketSessionFilter#doFilter() code looks like:
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException
{
try
{
WebApplication application = bindApplication();
bindSession(request, application);
chain.doFilter(request, response);
}
finally
{
cleanupBoundApplicationAndSession();
}
}
bindApplication() and bindSession() methods set the Application and Session
as thread locals and they are available for the "chain".
You need to attach the Wicket sources and see what happens in
#bindSession() method. The code is:
private void bindSession(ServletRequest request, WebApplication application)
{
// find wicket session and bind it to thread
HttpSession httpSession = ((HttpServletRequest)request).getSession(false);
Session session = getSession(httpSession, application);
if (session == null)
{
if (logger.isDebugEnabled())
{
logger.debug("could not set Wicket session: key " + sessionKey +
" not found in http session for " +
((HttpServletRequest)request).getContextPath() + "," +
request.getServerName() +
", or http session does not exist");
}
}
else
{
ThreadContext.setSession(session);
}
}
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Wed, Jul 9, 2014 at 7:49 AM, rsi610 <ra...@lntinfotech.com> wrote:
> WicketSessionFilter gets called..Also it has a session with it.
> <
> http://apache-wicket.1842946.n4.nabble.com/file/n4666503/WicketSession.jpg
> >
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Not-able-to-get-Wicket-Session-even-though-WicketSessionFilter-has-been-added-tp4666469p4666503.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Not able to get Wicket Session even though WicketSessionFilter
has been added
Posted by rsi610 <ra...@lntinfotech.com>.
WicketSessionFilter gets called..Also it has a session with it.
<http://apache-wicket.1842946.n4.nabble.com/file/n4666503/WicketSession.jpg>
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Not-able-to-get-Wicket-Session-even-though-WicketSessionFilter-has-been-added-tp4666469p4666503.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Not able to get Wicket Session even though WicketSessionFilter
has been added
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
Put a breakpoint in WicketSessionFilter#doFilter() and see what happens.
Is it called at all ? Is there Session thread local ? Etc.
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Tue, Jul 8, 2014 at 1:46 PM, rsi610 <ra...@lntinfotech.com> wrote:
> I have also added Session.get().bind() on page 1.. that also doesnt help
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Not-able-to-get-Wicket-Session-even-though-WicketSessionFilter-has-been-added-tp4666469p4666476.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Not able to get Wicket Session even though WicketSessionFilter
has been added
Posted by rsi610 <ra...@lntinfotech.com>.
I have also added Session.get().bind() on page 1.. that also doesnt help
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Not-able-to-get-Wicket-Session-even-though-WicketSessionFilter-has-been-added-tp4666469p4666476.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org