You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Florian B." <fl...@gmail.com> on 2011/09/20 18:27:50 UTC

How to get request page in Wicket 1.5

Hi 

I'm looking for a way to get the page of the current request on Wicket 1.5.
I found an wiki entry about this but unfortunately I don't understand how to
retrieve the page.  

https://cwiki.apache.org/WICKET/requestcycle-in-wicket-15.html

Perhaps someone can push me in the right direction. I've already look at the 
http://svn.apache.org/repos/asf/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/RequestLoggerRequestCycleListener.java
RequestLoggerRequestCycleListener  class, but I don't see where the page of
the current request is retrieved there. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p3827411.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: How to get request page in Wicket 1.5

Posted by robmcguinness <ro...@gmail.com>.
i build something like this for Wicket 1.3 that can give you can idea for
Wicket 1.5

https://github.com/robmcguinness/wicket-events/blob/master/src/main/java/com/robmcguinness/WicketApplication.java#L30

https://github.com/robmcguinness/wicket-events/blob/master/src/main/java/com/robmcguinness/events/LastPageAccessedMetaData.java

i built this to send events across all pages in active session (modal =>
parent page and parent => modal)

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p4650153.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: How to get request page in Wicket 1.5

Posted by vineet semwal <vi...@gmail.com>.
hi martin,
 i can try but i am not as fast as you ;)

On Thu, Jun 21, 2012 at 1:27 PM, Martin Grigorov <mg...@apache.org> wrote:
> I think we should add an implementation of IRequestCycleListener in
> wicket-core that tracks the request and response pages and save this
> info in the request cycle's metadata
>
> @Vineet, Thomas, Andrea: do you want to contribute this ?
>
> On Thu, Jun 21, 2012 at 10:52 AM, vineet semwal
> <vi...@gmail.com> wrote:
>> i can think of these 2 ways..
>>
>> 1) you can create a requestcycle listener which
>> onRequestHandlerResolved checks if it's the pagrequesthandler ,if it's
>> set the pagename or whatever you want to into requestcycle metadata
>> and retrieve it later when you want to.
>>
>> 2) there is this another way but it will only work in case of your
>> customexception ,just save pagename or what ever you want to in your
>> customexception and onexception check if it's your customexception and
>> retrieve whatever you have saved.
>>
>> On Thu, Jun 21, 2012 at 12:37 PM, Martin Grigorov <mg...@apache.org> wrote:
>>> Hi,
>>>
>>> See https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5
>>> Also take a look at
>>> org.apache.wicket.protocol.http.RequestLoggerRequestCycleListener. It
>>> tracks the requested requesthandler and the response requesthandler.
>>> If the handler is an instance of IPageRequestHandler then you can get
>>> the page instance with #getPage().
>>>
>>> On Thu, Jun 21, 2012 at 12:01 AM, LeaveNewb <my...@gmail.com> wrote:
>>>> I'm having the same problem, but passing a page through will not work for me.
>>>>
>>>> I used to use the Page passed in to onRuntimeException to send an error
>>>> report to the developers that included the page the user was on.  I can't
>>>> seem to get that information with the RequestCycle.
>>>>
>>>> Is this still possible with 1.5?
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p4650140.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
>>>>
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>>
>>
>> --
>> thanks,
>>
>> Vineet Semwal
>>
>> ---------------------------------------------------------------------
>> 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
>



-- 
thanks,

Vineet Semwal

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


Re: How to get request page in Wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
I think we should add an implementation of IRequestCycleListener in
wicket-core that tracks the request and response pages and save this
info in the request cycle's metadata

@Vineet, Thomas, Andrea: do you want to contribute this ?

On Thu, Jun 21, 2012 at 10:52 AM, vineet semwal
<vi...@gmail.com> wrote:
> i can think of these 2 ways..
>
> 1) you can create a requestcycle listener which
> onRequestHandlerResolved checks if it's the pagrequesthandler ,if it's
> set the pagename or whatever you want to into requestcycle metadata
> and retrieve it later when you want to.
>
> 2) there is this another way but it will only work in case of your
> customexception ,just save pagename or what ever you want to in your
> customexception and onexception check if it's your customexception and
> retrieve whatever you have saved.
>
> On Thu, Jun 21, 2012 at 12:37 PM, Martin Grigorov <mg...@apache.org> wrote:
>> Hi,
>>
>> See https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5
>> Also take a look at
>> org.apache.wicket.protocol.http.RequestLoggerRequestCycleListener. It
>> tracks the requested requesthandler and the response requesthandler.
>> If the handler is an instance of IPageRequestHandler then you can get
>> the page instance with #getPage().
>>
>> On Thu, Jun 21, 2012 at 12:01 AM, LeaveNewb <my...@gmail.com> wrote:
>>> I'm having the same problem, but passing a page through will not work for me.
>>>
>>> I used to use the Page passed in to onRuntimeException to send an error
>>> report to the developers that included the page the user was on.  I can't
>>> seem to get that information with the RequestCycle.
>>>
>>> Is this still possible with 1.5?
>>>
>>>
>>>
>>> --
>>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p4650140.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
>>>
>>
>>
>>
>> --
>> 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
>>
>
>
>
> --
> thanks,
>
> Vineet Semwal
>
> ---------------------------------------------------------------------
> 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: How to get request page in Wicket 1.5

Posted by vineet semwal <vi...@gmail.com>.
i can think of these 2 ways..

1) you can create a requestcycle listener which
onRequestHandlerResolved checks if it's the pagrequesthandler ,if it's
set the pagename or whatever you want to into requestcycle metadata
and retrieve it later when you want to.

2) there is this another way but it will only work in case of your
customexception ,just save pagename or what ever you want to in your
customexception and onexception check if it's your customexception and
retrieve whatever you have saved.

On Thu, Jun 21, 2012 at 12:37 PM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> See https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5
> Also take a look at
> org.apache.wicket.protocol.http.RequestLoggerRequestCycleListener. It
> tracks the requested requesthandler and the response requesthandler.
> If the handler is an instance of IPageRequestHandler then you can get
> the page instance with #getPage().
>
> On Thu, Jun 21, 2012 at 12:01 AM, LeaveNewb <my...@gmail.com> wrote:
>> I'm having the same problem, but passing a page through will not work for me.
>>
>> I used to use the Page passed in to onRuntimeException to send an error
>> report to the developers that included the page the user was on.  I can't
>> seem to get that information with the RequestCycle.
>>
>> Is this still possible with 1.5?
>>
>>
>>
>> --
>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p4650140.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
>>
>
>
>
> --
> 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
>



-- 
thanks,

Vineet Semwal

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


Re: How to get request page in Wicket 1.5

Posted by vineet semwal <vi...@gmail.com>.
you can just log the client url in onexception if it's what you want ..
but i have written a requestcyclelistener today that registers
lastresponsepage ,i am trying to improve it..

On Thu, Jun 21, 2012 at 6:39 PM, LeaveNewb <my...@gmail.com> wrote:
> Yeah, I've been to the RequestCycle page and saw the suggestion.  I was just
> hoping for an easier solution, since the previous version worked so well.
>
> I guess I just need to get off my lazy butt and do the work.  ;)
>
> Thanks for the suggestions
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p4650163.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
>



-- 
thanks,

Vineet Semwal

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


Re: How to get request page in Wicket 1.5

Posted by LeaveNewb <my...@gmail.com>.
Yeah, I've been to the RequestCycle page and saw the suggestion.  I was just
hoping for an easier solution, since the previous version worked so well.

I guess I just need to get off my lazy butt and do the work.  ;)

Thanks for the suggestions

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p4650163.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: How to get request page in Wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

See https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5
Also take a look at
org.apache.wicket.protocol.http.RequestLoggerRequestCycleListener. It
tracks the requested requesthandler and the response requesthandler.
If the handler is an instance of IPageRequestHandler then you can get
the page instance with #getPage().

On Thu, Jun 21, 2012 at 12:01 AM, LeaveNewb <my...@gmail.com> wrote:
> I'm having the same problem, but passing a page through will not work for me.
>
> I used to use the Page passed in to onRuntimeException to send an error
> report to the developers that included the page the user was on.  I can't
> seem to get that information with the RequestCycle.
>
> Is this still possible with 1.5?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p4650140.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
>



-- 
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: How to get request page in Wicket 1.5

Posted by LeaveNewb <my...@gmail.com>.
I'm having the same problem, but passing a page through will not work for me.

I used to use the Page passed in to onRuntimeException to send an error
report to the developers that included the page the user was on.  I can't
seem to get that information with the RequestCycle.

Is this still possible with 1.5?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p4650140.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: How to get request page in Wicket 1.5

Posted by "Florian B." <fl...@gmail.com>.
Ah ok I see. I'll give it a try. Thanks!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p3832806.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: How to get request page in Wicket 1.5

Posted by Igor Vaynberg <ig...@gmail.com>.
you can pass a PageReference to the edit page, something like
setResponsePage(new EditPage(itemModel, getPageReference())
then when its time to go back you can say
setResponsePage(reference.getPage())

-igor



On Wed, Sep 21, 2011 at 1:11 AM, Florian B. <fl...@gmail.com> wrote:
> My idea is to store the current page within the session and use it on later
> pages to navigate back to the previous page.
>
> For example I've got several pages with pageable lists of items the user can
> edit. When the use edits an item and clicks the save button he gets back to
> the previous page. This is done by simply calling
> setResponsePage(<PageClassName>.class);. The problem here is that always the
> first page of the list will be displayed and not the one when the user
> clicked the item for editing.
>
> As setResponePage() also takes an Page object I thought about passing the
> object of the Page from the previous Request to the method which was stored
> in the session so the page with the list would show exactly the state when
> the user clicked the item for editing.
>
> Perhaps I'm totally wrong on this. But I thought it would be easier than
> passing the current page number of the list to the edit page and use it
> there to jump back to the correct list page after editing of the item was
> finished.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p3829284.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
>
>

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


Re: How to get request page in Wicket 1.5

Posted by "Florian B." <fl...@gmail.com>.
My idea is to store the current page within the session and use it on later
pages to navigate back to the previous page. 

For example I've got several pages with pageable lists of items the user can
edit. When the use edits an item and clicks the save button he gets back to
the previous page. This is done by simply calling
setResponsePage(<PageClassName>.class);. The problem here is that always the
first page of the list will be displayed and not the one when the user
clicked the item for editing. 

As setResponePage() also takes an Page object I thought about passing the
object of the Page from the previous Request to the method which was stored
in the session so the page with the list would show exactly the state when
the user clicked the item for editing. 

Perhaps I'm totally wrong on this. But I thought it would be easier than
passing the current page number of the list to the edit page and use it
there to jump back to the correct list page after editing of the item was
finished. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p3829284.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: How to get request page in Wicket 1.5

Posted by Igor Vaynberg <ig...@gmail.com>.
why do you need the page?

-igor

On Tue, Sep 20, 2011 at 9:27 AM, Florian B. <fl...@gmail.com> wrote:
> Hi
>
> I'm looking for a way to get the page of the current request on Wicket 1.5.
> I found an wiki entry about this but unfortunately I don't understand how to
> retrieve the page.
>
> https://cwiki.apache.org/WICKET/requestcycle-in-wicket-15.html
>
> Perhaps someone can push me in the right direction. I've already look at the
> http://svn.apache.org/repos/asf/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/RequestLoggerRequestCycleListener.java
> RequestLoggerRequestCycleListener  class, but I don't see where the page of
> the current request is retrieved there.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-request-page-in-Wicket-1-5-tp3827411p3827411.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
>
>

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