Thanks for the follow up Martijn, i will look into this...

though I just discovered something which i cant comprehend, but before that
below is what i do in my logout page..

----
   String identityToken = MySession.get().getIdentityToken();
  
   Cookie cookie = new Cookie("_JSESSIONID","");
   cookie.setPath("/xyz");
   ((WebResponse)RequestCycle.get().getResponse()).addCookie(cookie);

   // invalidating session
   getSession().invalidate();

   RequestCycle.get().setRequestTarget(
         new RedirectRequestTarget(Host.getHttpsUrl()
             + utils.getLogoutURL(identityToken)));
----

Now calling the above code on LogoutLink.onClick() { setResponse(new
LogoutPage()) } does invoke the page, does the session invalidation, but
instead of taking to the external logout url (as in the last line), it takes
me to the session-expiry page, BUT if i invoke the above page using lets say
ExternalLink("logoutLink",logout") (where the logout page is mounted as
/logout) the above code works like a charm and does take me to the external
logout page...Can you please explain as to why this is the case...

Also, If this works i can avoid creating/throwing the new exception, unless
there are any issues u see with it? I certainly dont have a problem using
ExternalLink since i already have to expose the logout page to an external
app...

Please comment..




Martijn Dashorst wrote:
> 
> I think we need a RedirectToExternalException extends
> AbortRestartResponseException that sets the RedirectRequestTarget to
> an external page. Isn't too hard to implement I suppose...
> 
> public class RedirectToExternalException extends
> AbstractRestartResponseException
> {
>       private static final long serialVersionUID = 1L;
> 
>       public RedirectToExternalException(String url)
>       {
> 
>               RequestCycle rc = RequestCycle.get();
>               if (rc == null)
>               {
>                       throw new IllegalStateException(
>                                       "This exception can only be thrown from 
> within request processing
> cycle");
>               }
>               else
>               {
>                       Response r = rc.getResponse();
>                       if (!(r instanceof WebResponse))
>                       {
>                               throw new IllegalStateException(
>                                               "This exception can only be 
> thrown when wicket is processing an
> http request");
>                       }
> 
>                       // abort any further response processing
>                       rc.setRequestTarget(new RedirectRequestTarget(url));
>               }
>       }
> }
> 
> 
> Martijn
> 
> On 5/4/08, mfs <[EMAIL PROTECTED]> wrote:
>>
>>  Also my major problem is that when i do an invalidate() in the
>> constructor
>>  (with or without any redirection) i am taken to the session-expiry
>> page..I
>>  wonder why is that happening...can you please explain that behavior
>> please ?
>>  ..the reason as i explained earlier i had to do the same in the in the
>>  LogoutPage Constructor is because i need to expose this page to an
>> external
>>  non-wicket app (which on logout) would be redirecting to this page (if a
>>  wicket session exists)..so as to invalidate my wicket session app..
>>
>>
>>
>>
>>  Johan Compagner wrote:
>>  >
>>  > In a constructor of another page is just fine, but use an
>>  > RestartXxxException. Else you have 2 things that wants to be the
>>  > response, the redirect and the page you are in.
>>  >
>>  > On 5/4/08, mfs <[EMAIL PROTECTED]> wrote:
>>  >>
>>  >> Looking for some follow up on this..
>>  >>
>>  >> 1) Just wondering as to why isnt a constructor a good place to do the
>>  >> redirection to an external url , ?
>>  >> 2) What should be the right place for it, given my use-case..
>>  >>
>>  >> Thanks in advance..
>>  >>
>>  >> Johan Compagner wrote:
>>  >> >
>>  >> > I think this usecase should be supported but isnt the best way, you
>>  >> > should throw an AbortException when you want to redirect in the
>>  >> > constructor. Dont know from top of my head if we have one just for
>> an
>>  >> > url but that is easily made
>>  >> >
>>  >> > On 4/30/08, mfs <[EMAIL PROTECTED]> wrote:
>>  >> >>
>>  >> >> Guys,
>>  >> >>
>>  >> >> I have a LogoutPage which does the following in its constructor
>>  >> >>
>>  >> >> LogoutPage()
>>  >> >> {
>>  >> >>     getSession().invalidate();
>>  >> >>
>>  >> >>     // redirecting to the external app logout page
>>  >> >>     RequestCycle.get().setRequestTarget(
>>  >> >>         new RedirectRequestTarget(Host.getHttpsUrl()
>>  >> >>             + xyz.getLogoutURL()));
>>  >> >>
>>  >> >>     getRequestCycle().setRedirect(true);
>>  >> >> }
>>  >> >>
>>  >> >> Now, for some reasons the redirect to the specified external app
>> page
>>  >> >> doesnt
>>  >> >> happen, infact i am taken to the session-expired page (which is
>>  >> because
>>  >> >> the
>>  >> >> request comes to wicket app, instead of redirection to this
>> external
>>  >> app)
>>  >> >> .
>>  >> >> Let me add that i am using wiket-auth-roles for authorization...
>>  >> >>
>>  >> >> Also the reason i am doing this inside the Page itself (and not in
>> the
>>  >> >> onClick or some other event as suggested in another other thread)
>> is
>>  >> >> because
>>  >> >> i need to expose this LogoutPage to an external app as well, which
>>  >> will
>>  >> >> redirect to this page after invalidating the session....This part
>> of
>>  >> >> Interoperability/SingleSignon Support.
>>  >> >>
>>  >> >> Thanks in advance.
>>  >> >>
>>  >> >> --
>>  >> >> View this message in context:
>>  >> >>
>>  >>
>> http://www.nabble.com/LogoutPage---Responsible-for-invalidation-and-redirection-to-non-wicket-page-tp16974119p16974119.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]
>>  >> >>
>>  >> >>
>>  >> >
>>  >> >
>> ---------------------------------------------------------------------
>>  >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>>  >> > For additional commands, e-mail: [EMAIL PROTECTED]
>>  >> >
>>  >> >
>>  >> >
>>  >>
>>  >> --
>>  >> View this message in context:
>>  >>
>> http://www.nabble.com/LogoutPage---Responsible-for-invalidation-and-redirection-to-non-wicket-page-tp16974119p17042343.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]
>>  >>
>>  >>
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>>  > For additional commands, e-mail: [EMAIL PROTECTED]
>>  >
>>  >
>>  >
>>
>>
>> --
>>  View this message in context:
>> http://www.nabble.com/LogoutPage---Responsible-for-invalidation-and-redirection-to-non-wicket-page-tp16974119p17050703.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]
>>
>>
> 
> 
> -- 
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.3 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/LogoutPage---Responsible-for-invalidation-and-redirection-to-non-wicket-page-tp16974119p17052158.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]

Reply via email to