Yes I know, I do this most of the time.  However, I'm redirecting from http
to https.  When I wrote this app, this was what everyone was recommending.
Is there another way?

On Thu, Dec 17, 2009 at 2:45 PM, Alex Objelean <alex_objel...@yahoo.com>wrote:

>
> You shouldn't have a code like this:
>       getRequestCycle().setRedirect(false);
>      getRequestCycle().setRequestTarget(EmptyRequestTarget.getInstance());
>      getResponse().redirect("
> https://mysite/app/?wicket:bookmarkablePage=:com.myapp.UserAccount";);
>
> A more 'wicket way' of doing thins is this:
>
> setResponsePage(UserAccount.class);
>
> That means that a bookmarkable page will be created (a new instance of the
> page will be instantiated).
> You can also do something like this:
>
> setResponsePage(new UserAccount(account));
>
> Or you could try to make this page as stateless as possible by passing
> account id or other parameters to the page.... that depends..
>
> Alex
>
>
> V. Jenks wrote:
> >
> > Hit a snag!  At the cart page (going into the login page), I redirect to
> > https like so:
> >
> >       getRequestCycle().setRedirect(false);
> >
> > getRequestCycle().setRequestTarget(EmptyRequestTarget.getInstance());
> >       getResponse().redirect("https://mysite/app/account";);
> >
> > "user-account" being mapped like so in the "app" class:
> >
> > mount(new HybridUrlCodingStrategy("/account", UserAccount.class));
> >
> > ...gets me this exception:
> >
> > org.apache.wicket.WicketRuntimeException: Can't instantiate page using
> > constructor public com.agribeef.abcommerce.ui.UserAccount()
> >         at
> >
> org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:212)
> >         at
> >
> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:57)
> >         at
> >
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:299)
> >         at
> >
> org.apache.wicket.request.target.coding.HybridUrlCodingStrategy$HybridBookmarkablePageRequestTarget.newPage(HybridUrlCodingStrategy.java:887)
> >         at
> >
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:321)
> >         at
> >
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
> >         at
> >
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
> >         at
> >
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
> > ...............................
> > Caused by: java.lang.reflect.InvocationTargetException
> >         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > Method)
> >         at
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> >         at
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> >         at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> >         at
> >
> org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:192)
> >         ... 40 more
> > Caused by: java.lang.NullPointerException
> >         at com.myapp.UserAccount.<init>(UserAccount.java:44)
> >         ... 45 more
> >
> > ...which is of course, where I try to reference the stateful bean
> > (ShoppingCartBean) that I'm passing around.
> >
> > Prior to now, I just did this:
> >
> >       getRequestCycle().setRedirect(false);
> >
> > getRequestCycle().setRequestTarget(EmptyRequestTarget.getInstance());
> >       getResponse().redirect("
> > https://mysite/app/?wicket:bookmarkablePage=:com.myapp.UserAccount";);
> >
> > I could stick with that I guess, since it's trackable.  It would have
> been
> > nice to use the Hybrid approach consistently, though.
> >
> > -v
> >
> >
> > On Thu, Dec 17, 2009 at 2:12 PM, Alex Objelean
> > <alex_objel...@yahoo.com>wrote:
> >
> >>
> >> Also, it could be useful to check this out:
> >>
> >>
> http://day-to-day-stuff.blogspot.com/2008/10/wicket-extreme-consistent-urls.html
> >>
> >> Alex
> >>
> >>
> >> V. Jenks wrote:
> >> >
> >> > Excellent, excellent!  This is exactly what I was after!  That
> >> is...unless
> >> > this SEO can find another monkey wrench to throw in it.  But...it
> looks
> >> > like
> >> > it's exactly what I need.  Thanks!
> >> >
> >> > Alex R. - good point on tracking info internally.  I think it'd be
> very
> >> > useful but I'm dealing w/ the marketing dept.  They're so wowed by GA,
> >> I
> >> > doubt there's any turning back.
> >> >
> >> > Thanks guys.
> >> >
> >> > On Thu, Dec 17, 2009 at 12:08 PM, Alex Objelean
> >> > <alex_objel...@yahoo.com>wrote:
> >> >
> >> >>
> >> >> There are two possibilities:
> >> >> 1) In your application class add the following:
> >> >> mount(new HybridUrlCodingStrategy("/checkout", CheckoutPage.class));
> >> >>
> >> >> 2) If you have wicket-stuff annotation dependency
> >> >> (
> >> >>
> >>
> http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-annotation
> >> >> )
> >> >> you can annotate your page class with:
> >> >>
> >> >> @MountPath(path="/checkout")
> >> >> @MountHybrid
> >> >> public class CheckoutPage extends WebPage {}
> >> >>
> >> >> Alex
> >> >>
> >> >>
> >> >>
> >> >> V. Jenks wrote:
> >> >> >
> >> >> > Thanks Alex.
> >> >> >
> >> >> > I just had another meeting w/ the SEO guy today and the idea is to
> >> >> track
> >> >> > orders moving through our storefront in order go gauge sales based
> >> on
> >> >> the
> >> >> > SEO strategy.  In other words, where did our customers come from
> >> >> (Google
> >> >> > search?), what did they buy, and did they make it all the way
> >> through
> >> >> the
> >> >> > checkout process.  We need to be able to track pages in Google
> >> >> Analytics.
> >> >> >
> >> >> > If we could append/prepend some sort of value to the pages, while
> >> >> keeping
> >> >> > the dynamic Wicket page version parameter info in there, it would
> be
> >> >> > sufficient.  In Analytics, the Wicket portion of the URL can be
> >> removed
> >> >> > and
> >> >> > the rest would be used to identify traffic moving through the site.
> >> >> >
> >> >> > Is HybridUrlCodingStrategy the way to go, with this in mind?  Where
> >> are
> >> >> > some
> >> >> > good examples as to how to implement it and do what I'm describing?
> >> >> >
> >> >> > Thanks again!
> >> >> >
> >> >> > -v
> >> >> >
> >> >> > On Tue, Dec 1, 2009 at 6:04 AM, Alex Objelean
> >> >> > <alex_objel...@yahoo.com>wrote:
> >> >> >
> >> >> >>
> >> >> >> You can mount your page with HybridUrlCodingStrategy. This way,
> >> even
> >> >> >> session
> >> >> >> relative url's will be SEO friendly.
> >> >> >>
> >> >> >> But you must be aware of one thing, it makes sense to make SEO
> only
> >> >> >> bookmarkable pages (stateless pages). It is meaningless to make
> SEO
> >> >> aware
> >> >> >> session relative pages, because these will be shown as expired
> when
> >> >> >> somebody
> >> >> >> else will use these links.
> >> >> >>
> >> >> >> Regards,
> >> >> >> Alex Objelean
> >> >> >>
> >> >> >>
> >> >> >> V. Jenks wrote:
> >> >> >> >
> >> >> >> > I'm working on some changes for our storefront (Wicket 1.4, Java
> >> EE
> >> >> 5,
> >> >> >> > Glassfish 2.1) based on some recommendations made to us by an
> SEO
> >> >> >> > consultant.  One of them is re-writing some of the URLs so as to
> >> >> have
> >> >> >> them
> >> >> >> > indexed by Google, etc.
> >> >> >> >
> >> >> >> > My concern is the Wicket WebSession that I use to pass around an
> >> >> >> instance
> >> >> >> > of
> >> >> >> > a stateful session bean.  If I redirect to a mounted
> bookmarkable
> >> >> page
> >> >> >> > when
> >> >> >> > going through pages in the checkout process, vs redirecting to a
> >> new
> >> >> >> > instances of the page class, will there be any adverse effects
> on
> >> >> the
> >> >> >> > session?  Will customers experience a problem with their
> shopping
> >> >> cart
> >> >> >> > sessions?
> >> >> >> >
> >> >> >> > Thanks!
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >>
> http://old.nabble.com/%22Pretty%22-URLs-and-sessions-tp26581608p26591380.html
> >> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://old.nabble.com/%22Pretty%22-URLs-and-sessions-tp26581608p26833349.html
> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/%22Pretty%22-URLs-and-sessions-tp26581608p26835013.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/%22Pretty%22-URLs-and-sessions-tp26581608p26835517.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to