I will post my codes. But now i catched a very very strange position in
WicketSessionFilter .  Let me explain :

I used WicketSessionFilter and a Simple UploadServlet as Igor said.

I tested my application using Firefox 3. It gives :

java.lang.IllegalStateException: you can only locate or create sessions in
the context of a request cycle

bla bla bla ...

I tried to debug WicketSessionFilter , I can see that Filter runs and sets
the Session into Thread but then My Servlet doesn't get the Session because
some how WicketSessionFilter 's finally block runs and Session.unset()
method executes.

I think my Servlet can't catch the Session in Thread that
WicketSessionFilter puts or something like that.

The most strange part is : When I tested my application using Internet
Explorer 8, WOOWs , It works. My Upload servlet can reach the same Session
without any exception.  I think It means WicketSessionFilter and
UploadServlet runs in proper order.

Also I tested my application in Chrome, and I get the same exception :

java.lang.IllegalStateException: you can only locate or create sessions in
the context of a request cycle

It likes  producer and consumer problem.

Sessions in Wicket will kill me :)

Also I set up Wicket examples and I can see WicketSessionFilter  runs
properly.

Any suggestions ?

Thank you everybody.

Altug.


2009/7/23 Fernando Wermus <fernando.wer...@gmail.com>

> Could you show to us the whole code? I mean, the page or panel that upload
> the files as well the IRequestTarget class you have implemented?
>
> On Thu, Jul 23, 2009 at 10:31 AM, Altuğ B. Altıntaş <alt...@gmail.com
> >wrote:
>
> > Hi all ;
> >
> > I can't use WicketSessionFilter maybe because I am using Apache Shiro
> (old
> > name is Apache Kİ).
> >
> > In fact Fernando's solution works; Now I can reach and use Session inside
> > UploadRequestTarget which implements IRequestTarget.
> >
> > But then I realized that I reach a different Session object in
> > UploadRequestTarget class. It creates a new Session so i can  NOT access
> it
> > in other WebPages.
> >
> > In my Application class;
> >
> >  @Override
> >    public final Session newSession(Request request, Response response)
> > {
> >            return new MySession(request);
> >    }
> >
> > Are there any way to access all Sessions or stop creating a new Session
> in
> > UploadRequestTarget (which implements IRequestTarget)
> >
> > Thanks.
> >
> > Altug.
> >
> > 2009/7/20 Igor Vaynberg <igor.vaynb...@gmail.com>
> >
> > > see WicketSessionFilter
> > >
> > > -igor
> > >
> > > On Sun, Jul 19, 2009 at 3:20 PM, Altuğ B. Altıntaş<alt...@gmail.com>
> > > wrote:
> > > > Hi Igor;
> > > >
> > > > I found the problem; problem is when i hit my UploadServlet via
> > http-get
> > > > method , i simply write the url and hit the enter then below code is
> > > working
> > > >
> > > >  Session wicketSession = Session.get();
> > > >
> > > > I can get wicket Session, wow !! it is great...
> > > >
> > > > BUT ...
> > > >
> > > > When i hit  my UploadServlet via http-post method, swfupload access
> in
> > > that
> > > > way then i can NOT access wicketSession.
> > > >
> > > > I mean this code :
> > > >
> > > >  Session wicketSession = Session.get();
> > > >
> > > > it throws :
> > > >
> > > > java.lang.IllegalStateException: you can only locate or create
> sessions
> > > in
> > > > the context of a request cycle
> > > >
> > > > Any idea ?
> > > >
> > > > Thanks
> > > >
> > > > Altug..
> > > >
> > > >
> > > > 2009/7/14 Igor Vaynberg <igor.vaynb...@gmail.com>
> > > >
> > > >> that doesnt make any sense. all things within the webapp share the
> > > >> session. you guys are welcome to create a quickstart that replicates
> > > >> this.
> > > >>
> > > >> -igor
> > > >>
> > > >> On Tue, Jul 14, 2009 at 3:47 AM, Altuğ B. Altıntaş<alt...@gmail.com
> >
> > > >> wrote:
> > > >> > Also I have a problem like yours.
> > > >> >
> > > >> > Servlet session and Wicket's session are different so you are
> > getting
> > > >> nul.
> > > >> > Just debug your application and you will see that they have
> > different
> > > >> > session Id's.
> > > >> >
> > > >> > I tried to use WicketSessionFilter but it doesn't work.
> > > >> >
> > > >> > I am using wicket 1.3.5.
> > > >> >
> > > >> > Cheers...
> > > >> >
> > > >> > Altug.
> > > >> >
> > > >> > 2009/6/23 danisevsky <danisev...@gmail.com>
> > > >> >
> > > >> >> hello, I am using MyMultiFileUploadServlet for uploading files
> and
> > in
> > > >> some
> > > >> >> wicket component I need find out how many files was uploaded.
> > > >> >> I was trying to set this number to the HttpSession in
> > > >> >> MyMultiFileUploadServlet and get it in the component:
> > > >> >>
> > > >> >>                    HttpSession httpSession = ((WebRequest)
> > > >> >> getRequest()).getHttpServletRequest()
> > > >> >>                            .getSession();
> > > >> >> String count = httpSession
> > > >> >>                            .getAttribute("filesCount");
> > > >> >>
> > > >> >> but count is always null. Is there any way how to get some data
> > from
> > > >> >> servlet? Thanks
> > > >> >>
> > > >> >
> > > >> >
> > > >> >
> > > >> > --
> > > >> > Altuğ.
> > > >> >
> > > >>
> > > >>
> ---------------------------------------------------------------------
> > > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > >> For additional commands, e-mail: users-h...@wicket.apache.org
> > > >>
> > > >>
> > > >
> > > >
> > > > --
> > > > Altuğ.
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Altuğ.
> >
>
>
>
> --
> Fernando Wermus.
>
> www.linkedin.com/in/fernandowermus
>



-- 
Altuğ.

Reply via email to