You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by paul_s <pa...@gmail.com> on 2012/07/26 15:29:38 UTC

Change http status code on ajax response redirect?

Hi,

During the handling of an ajax request I have an exception thrown, this is
then managed by wicket to have an ajax-response returned with a redirect.

The response returns an http status code 200. I would like to change this to
be a 301/2 (still with the ajax-response redirect) but am not sure of the
best approach.

I need to do this as the response goes through our load balancer which
manages ssh keys. It won't rewrite the redirect URL from http to https if
the code is 200.

Any tips much appreciated.

Thanks.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Change-http-status-code-on-ajax-response-redirect-tp4650793.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: Change http status code on ajax response redirect?

Posted by paul_s <pa...@gmail.com>.
Thanks, Martin - will give that a go!



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Change-http-status-code-on-ajax-response-redirect-tp4650793p4651050.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: Change http status code on ajax response redirect?

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

You can use IResponseFilter to check the content of the response (as
String) and then set the custom status code.
MyApp#init(): getRequestCycleSettings().add(new MyCustomResponseFilter())

You may also need to set the 'Location' response header just in case
something in the middle tries to process this 302 redirect.

On Thu, Jul 26, 2012 at 4:29 PM, paul_s <pa...@gmail.com> wrote:
> Hi,
>
> During the handling of an ajax request I have an exception thrown, this is
> then managed by wicket to have an ajax-response returned with a redirect.
>
> The response returns an http status code 200. I would like to change this to
> be a 301/2 (still with the ajax-response redirect) but am not sure of the
> best approach.
>
> I need to do this as the response goes through our load balancer which
> manages ssh keys. It won't rewrite the redirect URL from http to https if
> the code is 200.
>
> Any tips much appreciated.
>
> Thanks.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Change-http-status-code-on-ajax-response-redirect-tp4650793.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