You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Douglas Ferguson <th...@gmail.com> on 2012/03/02 15:13:50 UTC
Wicket 1.5 - Accessing the "Previously Requested Page"
I want to save off the previous page at then end of each request.
Can be handy for things like oauth (making sure we return to the correct spot in the app).
In 1.4 I could just pull the page class and parameters off the RequestCycle.
Not I have to check to see if the active handler is IPageRequestHandler.
Is this safe? What scenarios exist where the RequestHandler will not be an IPageClassRequestHandler?
This is the only thing I could come up with.
public void onEndRequest(RequestCycle cycle)
{
if(cycle.getActiveRequestHandler() instanceof IPageClassRequestHandler){
previousPageClass = ((IPageClassRequestHandler)cycle.getActiveRequestHandler()).getPageClass()
}else{
log.error("cycle is not an IpageClassRequesthandler "+cycle);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 - Accessing the "Previously Requested Page"
Posted by Martin Grigorov <mg...@apache.org>.
On Sat, Mar 3, 2012 at 4:48 PM, Douglas Ferguson <th...@gmail.com> wrote:
> I think something else was interfering because it is working now. If you put the setRootRequstMapper after all the other mounts it works.
> It's a shame it has to be order dependent.
With the current way you can handle some pages with HttpsMapper and
leave other to not be checked for @RequireHttps.
The developer decides whether all pages should be checked or just some of them.
>
>
> The null pointer happens when you do this:
>
>>>> mount(new HttpsMapper(new MountedMapper("myPage", page, new UrlPathPageParametersEncoder()), httpsConfig));
>
> Then hit localhost/myPage in a browser.
>
> I've been burning the candle at both ends. Gonna get some rest. I'll post a quick start in a couple days.
Thanks!
Attach it to Jira and we will improve to not see NPEs in the future.
> Cheers.
>
> Douglas
>
> On Mar 3, 2012, at 2:37 AM, Martin Grigorov wrote:
>
>> See the code of http://www.wicket-library.com/wicket-examples/mappers/ example.
>>
>> Create a quickstart app with the NullPointerException and attach it to a ticket.
>>
>> On Sat, Mar 3, 2012 at 9:06 AM, Douglas Ferguson <th...@gmail.com> wrote:
>>> I just read that the setRootRequestMapper should be after all the mounts.
>>>
>>> I tried it and it still down't work.
>>>
>>> setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), httpsConfig));
>>>
>>>
>>>
>>> On Mar 3, 2012, at 12:12 AM, Douglas Ferguson wrote:
>>>
>>>> After tracing through the code, I see that when mounting pages, those mappers will bypass the root mapper by wrapping it in a "composite"
>>>>
>>>> So then I tried this:
>>>>
>>>> mount(new HttpsMapper(new MountedMapper(PAGE_MOUNT_MAP.get(page), page, new UrlPathPageParametersEncoder()), httpsConfig));
>>>>
>>>> Now my pages are redirecting as I would expect, however, I get a null pointer:
>>>>
>>>> java.lang.NullPointerException
>>>> at org.apache.wicket.protocol.https.HttpsMapper.mapHandler(HttpsMapper.java:129)
>>>> at org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:157)
>>>>
>>>> On Mar 2, 2012, at 11:00 AM, Douglas Ferguson wrote:
>>>>
>>>>> Thanks. I just found that and was about to report back. ;)
>>>>>
>>>>> One thing I just noticed is that my @RequireHttps annotation doesn't appear to be working.
>>>>> Do I need to configure that app to work with that?
>>>>>
>>>>> Douglas
>>>>>
>>>>> On Mar 2, 2012, at 10:20 AM, Igor Vaynberg wrote:
>>>>>
>>>>>> write your own irequestcyclelistener, implement
>>>>>> onrequesthandlerresolved() and in that method check if the handler is
>>>>>> a IPageRequestHandler and stash the page anywhere you want, like in
>>>>>> the request cycle's metadata.
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On Fri, Mar 2, 2012 at 8:08 AM, Douglas Ferguson <th...@gmail.com> wrote:
>>>>>>> This doesn't work.
>>>>>>>
>>>>>>> Seems like cycle.getActiveRequestHandler() always returns null when in the endRequest call back.
>>>>>>>
>>>>>>> Thoughts?
>>>>>>>
>>>>>>> Douglas
>>>>>>>
>>>>>>> On Mar 2, 2012, at 8:13 AM, Douglas Ferguson wrote:
>>>>>>>
>>>>>>>> I want to save off the previous page at then end of each request.
>>>>>>>> Can be handy for things like oauth (making sure we return to the correct spot in the app).
>>>>>>>>
>>>>>>>> In 1.4 I could just pull the page class and parameters off the RequestCycle.
>>>>>>>> Not I have to check to see if the active handler is IPageRequestHandler.
>>>>>>>>
>>>>>>>> Is this safe? What scenarios exist where the RequestHandler will not be an IPageClassRequestHandler?
>>>>>>>>
>>>>>>>> This is the only thing I could come up with.
>>>>>>>>
>>>>>>>> public void onEndRequest(RequestCycle cycle)
>>>>>>>> {
>>>>>>>> if(cycle.getActiveRequestHandler() instanceof IPageClassRequestHandler){
>>>>>>>> previousPageClass = ((IPageClassRequestHandler)cycle.getActiveRequestHandler()).getPageClass()
>>>>>>>> }else{
>>>>>>>> log.error("cycle is not an IpageClassRequesthandler "+cycle);
>>>>>>>> }
>>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: Wicket 1.5 - Accessing the "Previously Requested Page"
Posted by Douglas Ferguson <th...@gmail.com>.
I think something else was interfering because it is working now. If you put the setRootRequstMapper after all the other mounts it works.
It's a shame it has to be order dependent.
The null pointer happens when you do this:
>>> mount(new HttpsMapper(new MountedMapper("myPage", page, new UrlPathPageParametersEncoder()), httpsConfig));
Then hit localhost/myPage in a browser.
I've been burning the candle at both ends. Gonna get some rest. I'll post a quick start in a couple days.
Cheers.
Douglas
On Mar 3, 2012, at 2:37 AM, Martin Grigorov wrote:
> See the code of http://www.wicket-library.com/wicket-examples/mappers/ example.
>
> Create a quickstart app with the NullPointerException and attach it to a ticket.
>
> On Sat, Mar 3, 2012 at 9:06 AM, Douglas Ferguson <th...@gmail.com> wrote:
>> I just read that the setRootRequestMapper should be after all the mounts.
>>
>> I tried it and it still down't work.
>>
>> setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), httpsConfig));
>>
>>
>>
>> On Mar 3, 2012, at 12:12 AM, Douglas Ferguson wrote:
>>
>>> After tracing through the code, I see that when mounting pages, those mappers will bypass the root mapper by wrapping it in a "composite"
>>>
>>> So then I tried this:
>>>
>>> mount(new HttpsMapper(new MountedMapper(PAGE_MOUNT_MAP.get(page), page, new UrlPathPageParametersEncoder()), httpsConfig));
>>>
>>> Now my pages are redirecting as I would expect, however, I get a null pointer:
>>>
>>> java.lang.NullPointerException
>>> at org.apache.wicket.protocol.https.HttpsMapper.mapHandler(HttpsMapper.java:129)
>>> at org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:157)
>>>
>>> On Mar 2, 2012, at 11:00 AM, Douglas Ferguson wrote:
>>>
>>>> Thanks. I just found that and was about to report back. ;)
>>>>
>>>> One thing I just noticed is that my @RequireHttps annotation doesn't appear to be working.
>>>> Do I need to configure that app to work with that?
>>>>
>>>> Douglas
>>>>
>>>> On Mar 2, 2012, at 10:20 AM, Igor Vaynberg wrote:
>>>>
>>>>> write your own irequestcyclelistener, implement
>>>>> onrequesthandlerresolved() and in that method check if the handler is
>>>>> a IPageRequestHandler and stash the page anywhere you want, like in
>>>>> the request cycle's metadata.
>>>>>
>>>>> -igor
>>>>>
>>>>> On Fri, Mar 2, 2012 at 8:08 AM, Douglas Ferguson <th...@gmail.com> wrote:
>>>>>> This doesn't work.
>>>>>>
>>>>>> Seems like cycle.getActiveRequestHandler() always returns null when in the endRequest call back.
>>>>>>
>>>>>> Thoughts?
>>>>>>
>>>>>> Douglas
>>>>>>
>>>>>> On Mar 2, 2012, at 8:13 AM, Douglas Ferguson wrote:
>>>>>>
>>>>>>> I want to save off the previous page at then end of each request.
>>>>>>> Can be handy for things like oauth (making sure we return to the correct spot in the app).
>>>>>>>
>>>>>>> In 1.4 I could just pull the page class and parameters off the RequestCycle.
>>>>>>> Not I have to check to see if the active handler is IPageRequestHandler.
>>>>>>>
>>>>>>> Is this safe? What scenarios exist where the RequestHandler will not be an IPageClassRequestHandler?
>>>>>>>
>>>>>>> This is the only thing I could come up with.
>>>>>>>
>>>>>>> public void onEndRequest(RequestCycle cycle)
>>>>>>> {
>>>>>>> if(cycle.getActiveRequestHandler() instanceof IPageClassRequestHandler){
>>>>>>> previousPageClass = ((IPageClassRequestHandler)cycle.getActiveRequestHandler()).getPageClass()
>>>>>>> }else{
>>>>>>> log.error("cycle is not an IpageClassRequesthandler "+cycle);
>>>>>>> }
>>>>>>> }
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 - Accessing the "Previously Requested Page"
Posted by Martin Grigorov <mg...@apache.org>.
See the code of http://www.wicket-library.com/wicket-examples/mappers/ example.
Create a quickstart app with the NullPointerException and attach it to a ticket.
On Sat, Mar 3, 2012 at 9:06 AM, Douglas Ferguson <th...@gmail.com> wrote:
> I just read that the setRootRequestMapper should be after all the mounts.
>
> I tried it and it still down't work.
>
> setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), httpsConfig));
>
>
>
> On Mar 3, 2012, at 12:12 AM, Douglas Ferguson wrote:
>
>> After tracing through the code, I see that when mounting pages, those mappers will bypass the root mapper by wrapping it in a "composite"
>>
>> So then I tried this:
>>
>> mount(new HttpsMapper(new MountedMapper(PAGE_MOUNT_MAP.get(page), page, new UrlPathPageParametersEncoder()), httpsConfig));
>>
>> Now my pages are redirecting as I would expect, however, I get a null pointer:
>>
>> java.lang.NullPointerException
>> at org.apache.wicket.protocol.https.HttpsMapper.mapHandler(HttpsMapper.java:129)
>> at org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:157)
>>
>> On Mar 2, 2012, at 11:00 AM, Douglas Ferguson wrote:
>>
>>> Thanks. I just found that and was about to report back. ;)
>>>
>>> One thing I just noticed is that my @RequireHttps annotation doesn't appear to be working.
>>> Do I need to configure that app to work with that?
>>>
>>> Douglas
>>>
>>> On Mar 2, 2012, at 10:20 AM, Igor Vaynberg wrote:
>>>
>>>> write your own irequestcyclelistener, implement
>>>> onrequesthandlerresolved() and in that method check if the handler is
>>>> a IPageRequestHandler and stash the page anywhere you want, like in
>>>> the request cycle's metadata.
>>>>
>>>> -igor
>>>>
>>>> On Fri, Mar 2, 2012 at 8:08 AM, Douglas Ferguson <th...@gmail.com> wrote:
>>>>> This doesn't work.
>>>>>
>>>>> Seems like cycle.getActiveRequestHandler() always returns null when in the endRequest call back.
>>>>>
>>>>> Thoughts?
>>>>>
>>>>> Douglas
>>>>>
>>>>> On Mar 2, 2012, at 8:13 AM, Douglas Ferguson wrote:
>>>>>
>>>>>> I want to save off the previous page at then end of each request.
>>>>>> Can be handy for things like oauth (making sure we return to the correct spot in the app).
>>>>>>
>>>>>> In 1.4 I could just pull the page class and parameters off the RequestCycle.
>>>>>> Not I have to check to see if the active handler is IPageRequestHandler.
>>>>>>
>>>>>> Is this safe? What scenarios exist where the RequestHandler will not be an IPageClassRequestHandler?
>>>>>>
>>>>>> This is the only thing I could come up with.
>>>>>>
>>>>>> public void onEndRequest(RequestCycle cycle)
>>>>>> {
>>>>>> if(cycle.getActiveRequestHandler() instanceof IPageClassRequestHandler){
>>>>>> previousPageClass = ((IPageClassRequestHandler)cycle.getActiveRequestHandler()).getPageClass()
>>>>>> }else{
>>>>>> log.error("cycle is not an IpageClassRequesthandler "+cycle);
>>>>>> }
>>>>>> }
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> 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: Wicket 1.5 - Accessing the "Previously Requested Page"
Posted by Douglas Ferguson <th...@gmail.com>.
I just read that the setRootRequestMapper should be after all the mounts.
I tried it and it still down't work.
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), httpsConfig));
On Mar 3, 2012, at 12:12 AM, Douglas Ferguson wrote:
> After tracing through the code, I see that when mounting pages, those mappers will bypass the root mapper by wrapping it in a "composite"
>
> So then I tried this:
>
> mount(new HttpsMapper(new MountedMapper(PAGE_MOUNT_MAP.get(page), page, new UrlPathPageParametersEncoder()), httpsConfig));
>
> Now my pages are redirecting as I would expect, however, I get a null pointer:
>
> java.lang.NullPointerException
> at org.apache.wicket.protocol.https.HttpsMapper.mapHandler(HttpsMapper.java:129)
> at org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:157)
>
> On Mar 2, 2012, at 11:00 AM, Douglas Ferguson wrote:
>
>> Thanks. I just found that and was about to report back. ;)
>>
>> One thing I just noticed is that my @RequireHttps annotation doesn't appear to be working.
>> Do I need to configure that app to work with that?
>>
>> Douglas
>>
>> On Mar 2, 2012, at 10:20 AM, Igor Vaynberg wrote:
>>
>>> write your own irequestcyclelistener, implement
>>> onrequesthandlerresolved() and in that method check if the handler is
>>> a IPageRequestHandler and stash the page anywhere you want, like in
>>> the request cycle's metadata.
>>>
>>> -igor
>>>
>>> On Fri, Mar 2, 2012 at 8:08 AM, Douglas Ferguson <th...@gmail.com> wrote:
>>>> This doesn't work.
>>>>
>>>> Seems like cycle.getActiveRequestHandler() always returns null when in the endRequest call back.
>>>>
>>>> Thoughts?
>>>>
>>>> Douglas
>>>>
>>>> On Mar 2, 2012, at 8:13 AM, Douglas Ferguson wrote:
>>>>
>>>>> I want to save off the previous page at then end of each request.
>>>>> Can be handy for things like oauth (making sure we return to the correct spot in the app).
>>>>>
>>>>> In 1.4 I could just pull the page class and parameters off the RequestCycle.
>>>>> Not I have to check to see if the active handler is IPageRequestHandler.
>>>>>
>>>>> Is this safe? What scenarios exist where the RequestHandler will not be an IPageClassRequestHandler?
>>>>>
>>>>> This is the only thing I could come up with.
>>>>>
>>>>> public void onEndRequest(RequestCycle cycle)
>>>>> {
>>>>> if(cycle.getActiveRequestHandler() instanceof IPageClassRequestHandler){
>>>>> previousPageClass = ((IPageClassRequestHandler)cycle.getActiveRequestHandler()).getPageClass()
>>>>> }else{
>>>>> log.error("cycle is not an IpageClassRequesthandler "+cycle);
>>>>> }
>>>>> }
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 - Accessing the "Previously Requested Page"
Posted by Douglas Ferguson <th...@gmail.com>.
After tracing through the code, I see that when mounting pages, those mappers will bypass the root mapper by wrapping it in a "composite"
So then I tried this:
mount(new HttpsMapper(new MountedMapper(PAGE_MOUNT_MAP.get(page), page, new UrlPathPageParametersEncoder()), httpsConfig));
Now my pages are redirecting as I would expect, however, I get a null pointer:
java.lang.NullPointerException
at org.apache.wicket.protocol.https.HttpsMapper.mapHandler(HttpsMapper.java:129)
at org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:157)
On Mar 2, 2012, at 11:00 AM, Douglas Ferguson wrote:
> Thanks. I just found that and was about to report back. ;)
>
> One thing I just noticed is that my @RequireHttps annotation doesn't appear to be working.
> Do I need to configure that app to work with that?
>
> Douglas
>
> On Mar 2, 2012, at 10:20 AM, Igor Vaynberg wrote:
>
>> write your own irequestcyclelistener, implement
>> onrequesthandlerresolved() and in that method check if the handler is
>> a IPageRequestHandler and stash the page anywhere you want, like in
>> the request cycle's metadata.
>>
>> -igor
>>
>> On Fri, Mar 2, 2012 at 8:08 AM, Douglas Ferguson <th...@gmail.com> wrote:
>>> This doesn't work.
>>>
>>> Seems like cycle.getActiveRequestHandler() always returns null when in the endRequest call back.
>>>
>>> Thoughts?
>>>
>>> Douglas
>>>
>>> On Mar 2, 2012, at 8:13 AM, Douglas Ferguson wrote:
>>>
>>>> I want to save off the previous page at then end of each request.
>>>> Can be handy for things like oauth (making sure we return to the correct spot in the app).
>>>>
>>>> In 1.4 I could just pull the page class and parameters off the RequestCycle.
>>>> Not I have to check to see if the active handler is IPageRequestHandler.
>>>>
>>>> Is this safe? What scenarios exist where the RequestHandler will not be an IPageClassRequestHandler?
>>>>
>>>> This is the only thing I could come up with.
>>>>
>>>> public void onEndRequest(RequestCycle cycle)
>>>> {
>>>> if(cycle.getActiveRequestHandler() instanceof IPageClassRequestHandler){
>>>> previousPageClass = ((IPageClassRequestHandler)cycle.getActiveRequestHandler()).getPageClass()
>>>> }else{
>>>> log.error("cycle is not an IpageClassRequesthandler "+cycle);
>>>> }
>>>> }
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 - Accessing the "Previously Requested Page"
Posted by Douglas Ferguson <th...@gmail.com>.
Thanks. I just found that and was about to report back. ;)
One thing I just noticed is that my @RequireHttps annotation doesn't appear to be working.
Do I need to configure that app to work with that?
Douglas
On Mar 2, 2012, at 10:20 AM, Igor Vaynberg wrote:
> write your own irequestcyclelistener, implement
> onrequesthandlerresolved() and in that method check if the handler is
> a IPageRequestHandler and stash the page anywhere you want, like in
> the request cycle's metadata.
>
> -igor
>
> On Fri, Mar 2, 2012 at 8:08 AM, Douglas Ferguson <th...@gmail.com> wrote:
>> This doesn't work.
>>
>> Seems like cycle.getActiveRequestHandler() always returns null when in the endRequest call back.
>>
>> Thoughts?
>>
>> Douglas
>>
>> On Mar 2, 2012, at 8:13 AM, Douglas Ferguson wrote:
>>
>>> I want to save off the previous page at then end of each request.
>>> Can be handy for things like oauth (making sure we return to the correct spot in the app).
>>>
>>> In 1.4 I could just pull the page class and parameters off the RequestCycle.
>>> Not I have to check to see if the active handler is IPageRequestHandler.
>>>
>>> Is this safe? What scenarios exist where the RequestHandler will not be an IPageClassRequestHandler?
>>>
>>> This is the only thing I could come up with.
>>>
>>> public void onEndRequest(RequestCycle cycle)
>>> {
>>> if(cycle.getActiveRequestHandler() instanceof IPageClassRequestHandler){
>>> previousPageClass = ((IPageClassRequestHandler)cycle.getActiveRequestHandler()).getPageClass()
>>> }else{
>>> log.error("cycle is not an IpageClassRequesthandler "+cycle);
>>> }
>>> }
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 - Accessing the "Previously Requested Page"
Posted by Igor Vaynberg <ig...@gmail.com>.
write your own irequestcyclelistener, implement
onrequesthandlerresolved() and in that method check if the handler is
a IPageRequestHandler and stash the page anywhere you want, like in
the request cycle's metadata.
-igor
On Fri, Mar 2, 2012 at 8:08 AM, Douglas Ferguson <th...@gmail.com> wrote:
> This doesn't work.
>
> Seems like cycle.getActiveRequestHandler() always returns null when in the endRequest call back.
>
> Thoughts?
>
> Douglas
>
> On Mar 2, 2012, at 8:13 AM, Douglas Ferguson wrote:
>
>> I want to save off the previous page at then end of each request.
>> Can be handy for things like oauth (making sure we return to the correct spot in the app).
>>
>> In 1.4 I could just pull the page class and parameters off the RequestCycle.
>> Not I have to check to see if the active handler is IPageRequestHandler.
>>
>> Is this safe? What scenarios exist where the RequestHandler will not be an IPageClassRequestHandler?
>>
>> This is the only thing I could come up with.
>>
>> public void onEndRequest(RequestCycle cycle)
>> {
>> if(cycle.getActiveRequestHandler() instanceof IPageClassRequestHandler){
>> previousPageClass = ((IPageClassRequestHandler)cycle.getActiveRequestHandler()).getPageClass()
>> }else{
>> log.error("cycle is not an IpageClassRequesthandler "+cycle);
>> }
>> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket 1.5 - Accessing the "Previously Requested Page"
Posted by Douglas Ferguson <th...@gmail.com>.
This doesn't work.
Seems like cycle.getActiveRequestHandler() always returns null when in the endRequest call back.
Thoughts?
Douglas
On Mar 2, 2012, at 8:13 AM, Douglas Ferguson wrote:
> I want to save off the previous page at then end of each request.
> Can be handy for things like oauth (making sure we return to the correct spot in the app).
>
> In 1.4 I could just pull the page class and parameters off the RequestCycle.
> Not I have to check to see if the active handler is IPageRequestHandler.
>
> Is this safe? What scenarios exist where the RequestHandler will not be an IPageClassRequestHandler?
>
> This is the only thing I could come up with.
>
> public void onEndRequest(RequestCycle cycle)
> {
> if(cycle.getActiveRequestHandler() instanceof IPageClassRequestHandler){
> previousPageClass = ((IPageClassRequestHandler)cycle.getActiveRequestHandler()).getPageClass()
> }else{
> log.error("cycle is not an IpageClassRequesthandler "+cycle);
> }
> }
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org