Re: Dynamic PageExpiredPage

2008-09-23 Thread Markus Haspl
hi martijn,

your tipp with the cookie works! thank you!
markus

On Tue, Sep 23, 2008 at 10:19 AM, Martijn Dashorst <
[EMAIL PROTECTED]> wrote:

> In your case I would set a client side cookie that stores the portal
> id. This way you can identify which portal the user was visiting and
> make your PageExpiredPage customized.
>
> Martijn
>
> On Tue, Sep 23, 2008 at 10:00 AM, Markus Haspl <[EMAIL PROTECTED]> wrote:
> > On Mon, Sep 22, 2008 at 6:04 PM, Justin Morgan - Logic Sector <
> > [EMAIL PROTECTED]> wrote:
> >
> >> Create a custom Wicket session subclass that holds your portal:
> >>
> >> public class MySession extends WebSession {
> >>private Portal  _portal;
> >>public MySession(Request request) {
> >>super(request);
> >>LOGGER.debug("Instantiated");
> >>_portal = new Portal();
> >>}
> >>public Portal getPortal() { return _portal; }
> >>public void setPortal(Portal portal) { _portal = portal; }
> >> }
> >>
> >> Somewhere in your "normal" page:
> >> ((MySession) getSession()).setPortal(myPortal);
> >>
> >> Somewhere in your PageExpiredPage:
> >> Portal myPortal = ((MySession) getSession()).getPortal();
> >>
> >> In your Wicket Application subclass:
> >>/** @see org.apache.wicket.Application#newSession(Request, Response)
> */
> >>@Override
> >>public Session newSession(Request request, Response response) {
> >>return new MySession(request);
> >>}
> >>
> >> Best regards,
> >>
> >> Justin
> >
> >
> > Thanks! But i thought that the Session will be invalide when the
> PageExpired
> > Error comes? Isn't that true? If not so, than your approach will be very
> > fine.
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.4 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Dynamic PageExpiredPage

2008-09-23 Thread Martijn Dashorst
In your case I would set a client side cookie that stores the portal
id. This way you can identify which portal the user was visiting and
make your PageExpiredPage customized.

Martijn

On Tue, Sep 23, 2008 at 10:00 AM, Markus Haspl <[EMAIL PROTECTED]> wrote:
> On Mon, Sep 22, 2008 at 6:04 PM, Justin Morgan - Logic Sector <
> [EMAIL PROTECTED]> wrote:
>
>> Create a custom Wicket session subclass that holds your portal:
>>
>> public class MySession extends WebSession {
>>private Portal  _portal;
>>public MySession(Request request) {
>>super(request);
>>LOGGER.debug("Instantiated");
>>_portal = new Portal();
>>}
>>public Portal getPortal() { return _portal; }
>>public void setPortal(Portal portal) { _portal = portal; }
>> }
>>
>> Somewhere in your "normal" page:
>> ((MySession) getSession()).setPortal(myPortal);
>>
>> Somewhere in your PageExpiredPage:
>> Portal myPortal = ((MySession) getSession()).getPortal();
>>
>> In your Wicket Application subclass:
>>/** @see org.apache.wicket.Application#newSession(Request, Response) */
>>@Override
>>public Session newSession(Request request, Response response) {
>>return new MySession(request);
>>}
>>
>> Best regards,
>>
>> Justin
>
>
> Thanks! But i thought that the Session will be invalide when the PageExpired
> Error comes? Isn't that true? If not so, than your approach will be very
> fine.
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic PageExpiredPage

2008-09-23 Thread Nino Saturnino Martinez Vazquez Wael
That should work very well, as you can pass all sort of data into the 
constructor.. This is also the aproach i've used if we should to a 
little more than display a "static" error page.


Michael Sparer wrote:

we handle it like that:
[in your application-class]

@Override
protected IRequestCycleProcessor newRequestCycleProcessor() {
return new WebRequestCycleProcessor() {

@Override
protected Page onRuntimeException(final Page page, 
final RuntimeException
e) {
if (e instanceof PageExpiredException) {
return new 
PageExpiredPage(((MyPage)page).getPortalId());
}
return new InternalServerError(page, e);

}

};
}

Markus Haspl wrote:
  

On Mon, Sep 22, 2008 at 3:48 PM, Uwe Schäfer
<[EMAIL PROTECTED]>wrote:



Markus Haspl schrieb:

 getApplicationSettings().setPageExpiredErrorPage(Page.class); In the
  

Page.class i can't work with the PageParameters, so i can't make it
dynamic.



what kind of data would you like to pass to it, and - more important -
where could you possibly get it from ?

  

i have a PageParameter (portalId) which indicates on which Portal the User
is on. In the database there are a lot of portals, every portal has it's
own
users, pages and so on. So, every portal should have its own
PageExpiredErrorPage.






-
Michael Sparer
http://talk-on-tech.blogspot.com
  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic PageExpiredPage

2008-09-23 Thread Markus Haspl
On Mon, Sep 22, 2008 at 6:04 PM, Justin Morgan - Logic Sector <
[EMAIL PROTECTED]> wrote:

> Create a custom Wicket session subclass that holds your portal:
>
> public class MySession extends WebSession {
>private Portal  _portal;
>public MySession(Request request) {
>super(request);
>LOGGER.debug("Instantiated");
>_portal = new Portal();
>}
>public Portal getPortal() { return _portal; }
>public void setPortal(Portal portal) { _portal = portal; }
> }
>
> Somewhere in your "normal" page:
> ((MySession) getSession()).setPortal(myPortal);
>
> Somewhere in your PageExpiredPage:
> Portal myPortal = ((MySession) getSession()).getPortal();
>
> In your Wicket Application subclass:
>/** @see org.apache.wicket.Application#newSession(Request, Response) */
>@Override
>public Session newSession(Request request, Response response) {
>return new MySession(request);
>}
>
> Best regards,
>
> Justin


Thanks! But i thought that the Session will be invalide when the PageExpired
Error comes? Isn't that true? If not so, than your approach will be very
fine.


Re: Dynamic PageExpiredPage

2008-09-22 Thread Michael Sparer

we handle it like that:
[in your application-class]

@Override
protected IRequestCycleProcessor newRequestCycleProcessor() {
return new WebRequestCycleProcessor() {

@Override
protected Page onRuntimeException(final Page page, 
final RuntimeException
e) {
if (e instanceof PageExpiredException) {
return new 
PageExpiredPage(((MyPage)page).getPortalId());
}
return new InternalServerError(page, e);

}

};
}

Markus Haspl wrote:
> 
> On Mon, Sep 22, 2008 at 3:48 PM, Uwe Schäfer
> <[EMAIL PROTECTED]>wrote:
> 
>> Markus Haspl schrieb:
>>
>>  getApplicationSettings().setPageExpiredErrorPage(Page.class); In the
>>> Page.class i can't work with the PageParameters, so i can't make it
>>> dynamic.
>>>
>>
>> what kind of data would you like to pass to it, and - more important -
>> where could you possibly get it from ?
>>
> 
> 
> i have a PageParameter (portalId) which indicates on which Portal the User
> is on. In the database there are a lot of portals, every portal has it's
> own
> users, pages and so on. So, every portal should have its own
> PageExpiredErrorPage.
> 
> 


-
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/Dynamic-PageExpiredPage-tp19608106p19611998.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic PageExpiredPage

2008-09-22 Thread Justin Morgan - Logic Sector

Create a custom Wicket session subclass that holds your portal:

public class MySession extends WebSession {
private Portal  _portal;
public MySession(Request request) {
super(request);
LOGGER.debug("Instantiated");
_portal = new Portal();
}
public Portal getPortal() { return _portal; }
public void setPortal(Portal portal) { _portal = portal; }
}

Somewhere in your "normal" page:
((MySession) getSession()).setPortal(myPortal);

Somewhere in your PageExpiredPage:
Portal myPortal = ((MySession) getSession()).getPortal();

In your Wicket Application subclass:
/** @see org.apache.wicket.Application#newSession(Request,  
Response) */

@Override
public Session newSession(Request request, Response response) {
return new MySession(request);
}

Best regards,

Justin

On Sep 22, 2008, at 8:18 AM, Uwe Schäfer wrote:


Markus Haspl schrieb:

i have a PageParameter (portalId) which indicates on which Portal  
the User
is on. In the database there are a lot of portals, every portal has  
it's own

users, pages and so on. So, every portal should have its own
PageExpiredErrorPage.


that is all fine, but where could you possibly get the 'current'  
protal ID from if the page expired? isn´t it contained in a session  
or something? and if so, couldn´t the expirePage itself find that  
out (nad maybe forward to a specific one) ?


cu uwe


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic PageExpiredPage

2008-09-22 Thread Uwe Schäfer

Markus Haspl schrieb:


i have a PageParameter (portalId) which indicates on which Portal the User
is on. In the database there are a lot of portals, every portal has it's own
users, pages and so on. So, every portal should have its own
PageExpiredErrorPage.


that is all fine, but where could you possibly get the 'current' protal 
ID from if the page expired? isn´t it contained in a session or 
something? and if so, couldn´t the expirePage itself find that out (nad 
maybe forward to a specific one) ?


cu uwe


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic PageExpiredPage

2008-09-22 Thread Markus Haspl
On Mon, Sep 22, 2008 at 3:48 PM, Uwe Schäfer <[EMAIL PROTECTED]>wrote:

> Markus Haspl schrieb:
>
>  getApplicationSettings().setPageExpiredErrorPage(Page.class); In the
>> Page.class i can't work with the PageParameters, so i can't make it
>> dynamic.
>>
>
> what kind of data would you like to pass to it, and - more important -
> where could you possibly get it from ?
>


i have a PageParameter (portalId) which indicates on which Portal the User
is on. In the database there are a lot of portals, every portal has it's own
users, pages and so on. So, every portal should have its own
PageExpiredErrorPage.


Re: Dynamic PageExpiredPage

2008-09-22 Thread Uwe Schäfer

Markus Haspl schrieb:


getApplicationSettings().setPageExpiredErrorPage(Page.class); In the
Page.class i can't work with the PageParameters, so i can't make it dynamic.


what kind of data would you like to pass to it, and - more important - 
where could you possibly get it from ?


cu uwe

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Dynamic PageExpiredPage

2008-09-22 Thread Markus Haspl
hi,

i've searched the mailing List and the docs but i didn't find a solution for
my problem. I need a custom dynamic PageExpiredErrorPage. I don't know how
to make this because i only see the method:
getApplicationSettings().setPageExpiredErrorPage(Page.class); In the
Page.class i can't work with the PageParameters, so i can't make it dynamic.

thanks
markus