You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by fachhoch <fa...@gmail.com> on 2011/06/28 21:57:02 UTC

jsp check AuthenticatedWebSession.get().isSignedIn()

I have very few jsp pages and for these pages I want to check that user is
authenticated. I tried calling 

AuthenticatedWebSession.get().isSignedIn()   and I getting this exception 

  java.lang.IllegalStateException: you can only locate or create sessions in
the context of a request cycle
	at org.apache.wicket.Session.findOrCreate(Session.java:208)
	at org.apache.wicket.Session.get(Session.java:252)
	at
org.apache.wicket.authentication.AuthenticatedWebSession.get(AuthenticatedWebSession.java:40)
	at
gov.hhs.acf.web.filter.JspSecurityFilter.doFilter(JspSecurityFilter.java:29)
	at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
	at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
	at
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
	at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
	at
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
	at
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
	at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
	at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
	at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
	at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:421)
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
	at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:493)
	at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:924)
	at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:358)
	at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
	at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:860)
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
	at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
	at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
	at org.eclipse.jetty.server.Server.handle(Server.java:335)
	at
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:588)
	at
org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1029)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:549)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:211)
	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:418)
	at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:476)
	at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
	at java.lang.Thread.run(Thread.java:619)


please suggest me how check if user is authenticated in case of jsp pages ?


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/jsp-check-AuthenticatedWebSession-get-isSignedIn-tp3631307p3631307.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: jsp check AuthenticatedWebSession.get().isSignedIn()

Posted by Martin Grigorov <mg...@apache.org>.
WicketSessionFilter is also an option.

On Thu, Jun 30, 2011 at 9:59 PM, Bruno Borges <br...@gmail.com> wrote:
> If you are calling a jsp file, Wicket is not being processed.
>
> And so, Application.get() won't return a valid object.
>
> In your newSession() method, add something your project understand to
> HttpSession as Pedro said.
>
>
> *Bruno Borges*
> www.brunoborges.com.br
> +55 21 76727099
>
>
>
> On Thu, Jun 30, 2011 at 3:52 PM, Pedro Santos <pe...@gmail.com> wrote:
>
>> Hi, you can share this info in the HttpServletSession.
>>
>> On Tue, Jun 28, 2011 at 4:57 PM, fachhoch <fa...@gmail.com> wrote:
>> > I have very few jsp pages and for these pages I want to check that user
>> is
>> > authenticated. I tried calling
>> >
>> > AuthenticatedWebSession.get().isSignedIn()   and I getting this exception
>> >
>> >  java.lang.IllegalStateException: you can only locate or create sessions
>> in
>> > the context of a request cycle
>> >        at org.apache.wicket.Session.findOrCreate(Session.java:208)
>> >        at org.apache.wicket.Session.get(Session.java:252)
>> >        at
>> >
>> org.apache.wicket.authentication.AuthenticatedWebSession.get(AuthenticatedWebSession.java:40)
>> >        at
>> >
>> gov.hhs.acf.web.filter.JspSecurityFilter.doFilter(JspSecurityFilter.java:29)
>> >        at
>> >
>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
>> >        at
>> >
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
>> >        at
>> >
>> org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
>> >        at
>> >
>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
>> >        at
>> >
>> org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
>> >        at
>> >
>> org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
>> >        at
>> >
>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
>> >        at
>> >
>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>> >        at
>> >
>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>> >        at
>> >
>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
>> >        at
>> >
>> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:421)
>> >        at
>> >
>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
>> >        at
>> >
>> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:493)
>> >        at
>> >
>> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
>> >        at
>> >
>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:924)
>> >        at
>> > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:358)
>> >        at
>> >
>> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
>> >        at
>> >
>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:860)
>> >        at
>> >
>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
>> >        at
>> >
>> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
>> >        at
>> >
>> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
>> >        at
>> >
>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
>> >        at org.eclipse.jetty.server.Server.handle(Server.java:335)
>> >        at
>> >
>> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:588)
>> >        at
>> >
>> org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1029)
>> >        at
>> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:549)
>> >        at
>> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:211)
>> >        at
>> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:418)
>> >        at
>> >
>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:476)
>> >        at
>> >
>> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
>> >        at java.lang.Thread.run(Thread.java:619)
>> >
>> >
>> > please suggest me how check if user is authenticated in case of jsp pages
>> ?
>> >
>> >
>> > --
>> > View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/jsp-check-AuthenticatedWebSession-get-isSignedIn-tp3631307p3631307.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
>> >
>> >
>>
>>
>>
>> --
>> Pedro Henrique Oliveira dos Santos
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: jsp check AuthenticatedWebSession.get().isSignedIn()

Posted by Bruno Borges <br...@gmail.com>.
If you are calling a jsp file, Wicket is not being processed.

And so, Application.get() won't return a valid object.

In your newSession() method, add something your project understand to
HttpSession as Pedro said.


*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Thu, Jun 30, 2011 at 3:52 PM, Pedro Santos <pe...@gmail.com> wrote:

> Hi, you can share this info in the HttpServletSession.
>
> On Tue, Jun 28, 2011 at 4:57 PM, fachhoch <fa...@gmail.com> wrote:
> > I have very few jsp pages and for these pages I want to check that user
> is
> > authenticated. I tried calling
> >
> > AuthenticatedWebSession.get().isSignedIn()   and I getting this exception
> >
> >  java.lang.IllegalStateException: you can only locate or create sessions
> in
> > the context of a request cycle
> >        at org.apache.wicket.Session.findOrCreate(Session.java:208)
> >        at org.apache.wicket.Session.get(Session.java:252)
> >        at
> >
> org.apache.wicket.authentication.AuthenticatedWebSession.get(AuthenticatedWebSession.java:40)
> >        at
> >
> gov.hhs.acf.web.filter.JspSecurityFilter.doFilter(JspSecurityFilter.java:29)
> >        at
> >
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
> >        at
> >
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
> >        at
> >
> org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
> >        at
> >
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
> >        at
> >
> org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
> >        at
> >
> org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
> >        at
> >
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
> >        at
> >
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
> >        at
> >
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
> >        at
> >
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
> >        at
> >
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:421)
> >        at
> >
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
> >        at
> >
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:493)
> >        at
> >
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
> >        at
> >
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:924)
> >        at
> > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:358)
> >        at
> >
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
> >        at
> >
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:860)
> >        at
> >
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
> >        at
> >
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
> >        at
> >
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
> >        at
> >
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
> >        at org.eclipse.jetty.server.Server.handle(Server.java:335)
> >        at
> >
> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:588)
> >        at
> >
> org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1029)
> >        at
> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:549)
> >        at
> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:211)
> >        at
> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:418)
> >        at
> >
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:476)
> >        at
> >
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
> >        at java.lang.Thread.run(Thread.java:619)
> >
> >
> > please suggest me how check if user is authenticated in case of jsp pages
> ?
> >
> >
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/jsp-check-AuthenticatedWebSession-get-isSignedIn-tp3631307p3631307.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
> >
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: jsp check AuthenticatedWebSession.get().isSignedIn()

Posted by Pedro Santos <pe...@gmail.com>.
Hi, you can share this info in the HttpServletSession.

On Tue, Jun 28, 2011 at 4:57 PM, fachhoch <fa...@gmail.com> wrote:
> I have very few jsp pages and for these pages I want to check that user is
> authenticated. I tried calling
>
> AuthenticatedWebSession.get().isSignedIn()   and I getting this exception
>
>  java.lang.IllegalStateException: you can only locate or create sessions in
> the context of a request cycle
>        at org.apache.wicket.Session.findOrCreate(Session.java:208)
>        at org.apache.wicket.Session.get(Session.java:252)
>        at
> org.apache.wicket.authentication.AuthenticatedWebSession.get(AuthenticatedWebSession.java:40)
>        at
> gov.hhs.acf.web.filter.JspSecurityFilter.doFilter(JspSecurityFilter.java:29)
>        at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
>        at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
>        at
> org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
>        at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
>        at
> org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
>        at
> org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
>        at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
>        at
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>        at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>        at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
>        at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:421)
>        at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
>        at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:493)
>        at
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
>        at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:924)
>        at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:358)
>        at
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
>        at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:860)
>        at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
>        at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
>        at
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
>        at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
>        at org.eclipse.jetty.server.Server.handle(Server.java:335)
>        at
> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:588)
>        at
> org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1029)
>        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:549)
>        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:211)
>        at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:418)
>        at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:476)
>        at
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
>        at java.lang.Thread.run(Thread.java:619)
>
>
> please suggest me how check if user is authenticated in case of jsp pages ?
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/jsp-check-AuthenticatedWebSession-get-isSignedIn-tp3631307p3631307.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
>
>



-- 
Pedro Henrique Oliveira dos Santos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org