That would be awesome Eelco if that happens.  It does make more sense to have the request available before the session is created.  Please let me know if and when you make this change so I can change my code and/or test this for you.

On 3/16/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
It's actually pretty awfull. I don't really see the point of having to
create the session upfront AND delegating the creation of the request
cycle to the session which in turn delegates it to the factory which
is set in the application. The problems I have with the current
handling:
1) It seems to stem from an optimization (RequestCycle sets the
Session as a final field so it doesn't have to use the thread local)
only. I don't think we need the optimization and besides the same
could have been accomplished by just lazy loading it.
2) I find it illogical that the session is there before the
request(cycle). The other way around would be more initiutive and
useful.
3) All that that one-liner delegation method does is tighten coupling.
The factory method in session is meant for internal use only. We
should loose it.

What I propose:
1) Create RequestCycle before the session.
2) Use the Application's factory directly instead of passing via
Session, and remove the method in Session.
3) The session is lazily created in getSession of Application. I
propose to 'touch' that method in RequestCycle's constructor to ensure
it is available for any user that wants to access it in the
constructor of any custom RequestCycle.
4) Make the change ASAP/ before beta 2.

Eelco


On 3/16/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> great.
>
>
> On 3/16/06, Andrew Berman <[EMAIL PROTECTED]> wrote:
> >
> > Yeah it works.  However, since the new request cycle is called on every
> request I had to put in an if statement to test for session.isNew().
> >
> >
> >
> > On 3/16/06, Igor Vaynberg <[EMAIL PROTECTED] > wrote:
> > >
> > > let me know if that worked.
> > >
> > >
> > > -Igor
> > >
> > >
> > >
> > > On 3/16/06, Andrew Berman < [EMAIL PROTECTED]> wrote:
> > > >
> > > > Cool.  Thanks Igor.
> > > >
> > > >
> > > >
> > > > On 3/16/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > instead of using a session factory try using a request cycle factory
> and setting the style into the created websession there.
> > > > >
> > > > >
> > > > > -Igor
> > > > >
> > > > >
> > > > >
> > > > > On 3/16/06, Andrew Berman < [EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > It looks like the RequestCycle is not filled in until RequestCycle
> cycle = session.newRequestCycle (request, response); in WicketServlet (line
> 209 for Wicket 1.2 Beta 1)
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 3/16/06, Andrew Berman < [EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > I should've mentioned that I already tried that and when I call
> RequestCycle.get (), I get a null.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On 3/16/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> > > > > > > >
> > > > > > > > you can try:
> ((WebRequest)RequestCycle.get().getRequest()).....
> > > > > > > >
> > > > > > > >
> > > > > > > > -Igor
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On 3/16/06, Andrew Berman <[EMAIL PROTECTED] > wrote:
> > > > > > > > >
> > > > > > > > > I have a requirement where I need to parse the URL to
> extract a username on session creation.  For example,
> http://username.foo.com/.. ., I need to pull out the username and set a style
> in the session.  So, I figured that upon session creation I could parse the
> request and set the style.  In my application class I have:
> > > > > > > > >
> > > > > > > > > protected ISessionFactory getSessionFactory() {
> > > > > > > > >         return new ISessionFactory() {
> > > > > > > > >             private static final long serialVersionUID = 1L;
> > > > > > > > >
> > > > > > > > >             public Session newSession() {
> > > > > > > > >                 return new FooSession();
> > > > > > > > >             }
> > > > > > > > >         };
> > > > > > > > >     }
> > > > > > > > >
> > > > > > > > > So in the newSession method how can I get the URL or request
> object?
> > > > > > > > >
> > > > > > > > > Thanks,
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Andrew
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to