Since Wicket .1.4.7 (I think) you can do as well:
out.println("<?xml version='1.0'
encoding='UTF-8'?><ajax-response><ajax-redirect>"
+ httpRequest.getContextPath() + "</ajax-redirect></ajax-response>");
I am not completely sure about the syntax, but it something like this.
I'll add wiki page for this if there is no such already.
On Fri, Jul 23, 2010 at 1:07 AM, <[email protected]> wrote:
> Somehow below code worked, I thought it be helpful for someone else to.
>
> if(httpRequest.getSession(false) == null){
> Enumeration headerNames = httpRequest.getHeaderNames();
> while(headerNames.hasMoreElements()) {
> String headerName = (String)headerNames.nextElement();
> if(headerName.equalsIgnoreCase("Wicket-Ajax")){
> PrintWriter out = httpResponse.getWriter();
> out.println("<?xml version='1.0'
> encoding='UTF-8'?><ajax-response><header-contribution encoding='wicket1'
> ><![CDATA[<head xmlns:wicket='http://wicket.apache.org'>");
>
> out.println("</head>]]></header-contribution><evaluate><![CDATA[
> location.href='" + httpRequest.getContextPath() +
> "';]]></evaluate></ajax-response>");
> return;
>
> }
>
> }
> }
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Thursday, July 22, 2010 12:49 PM
> To: [email protected]
> Subject: Session time out for Ajax requests
>
> Hi All,
>
> Any one tried this :
>
> "In your served filter you will have to check for Wicket-Ajax header
> and if it is present return a properly formatted Ajax-response that
> contains JavaScript to redirect to your login page.
>
>
> I am not sure what exactly I need to return. I tried with
>
> <ajax-reponse><script
> language="javascript">location.href="mypage"</script></ajax-response>
>
> And
> <ajax-response><![CDATA[<script
> langauge='javascript'>location.href="mypage"</script>]]</ajax-response>
>
>
>
> But nothing seem to be working. Any idea what's wrong here
>
> Thanks in Advance.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>