You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Ziegler, Christian" <ch...@pentasys.de> on 2013/08/27 18:04:42 UTC
Redirect within a RequestCycleListener's onBeginRequest
Hi all,
I'm trying implement a RequestCycleListener which redirects the user to the same page he initially requested but which adds a query string parameter in certain cases. It has to be a redirect response since the parameter is interpreted by an external system before it's forwarded to my application. In onBeginRequest i tried
public void onBeginRequest(RequestCycle cycle) {
throw new RedirectToUrlException("http://test?bla=true");
}
which didn't work. Then tried altering the Response object obtained from the RequestCycle object like
public void onBeginRequest(RequestCycle cycle) {
WebResponse response = (WebResponse) cycle.getResponse();
response.sendRedirect("http://test?bla=true");
}
which also didn't work.
Any ideas?
Cheers,
Chris
AW: AW: Redirect within a RequestCycleListener's onBeginRequest
Posted by "Ziegler, Christian" <ch...@pentasys.de>.
Sven,
thanks for the input! I will look into that. At a first glance it looks promising.
Regards,
Chris
________________________________________
Von: Sven Meier [sven@meiers.net]
Gesendet: Donnerstag, 29. August 2013 11:08
An: users@wicket.apache.org
Betreff: Re: AW: Redirect within a RequestCycleListener's onBeginRequest
Hi,
RedirectToUrlException is a ReplaceHandlerException, which is handled in
RequestHandlerStack#execute() only (which is called after the listeners
have been notified).
> In onBeginRequest im throwing a custom runtime exception which I
handle in onException
> by returning a RedirectRequestHandler.
Yeah, that works. Alternatively you might look into implementing your
own IRequestMapper.
Have fun
Sven
On 08/29/2013 09:33 AM, Ziegler, Christian wrote:
> Hi again,
>
> for documentation purposes, it seems I found a way. In onBeginRequest im throwing a custom runtime exception which I handle in onException by returning a RedirectRequestHandler.
>
> Regards,
> Chris
>
> ________________________________________
> Von: Ziegler, Christian [christian.ziegler@pentasys.de]
> Gesendet: Dienstag, 27. August 2013 18:04
> An: users@wicket.apache.org
> Betreff: Redirect within a RequestCycleListener's onBeginRequest
>
> Hi all,
>
> I'm trying implement a RequestCycleListener which redirects the user to the same page he initially requested but which adds a query string parameter in certain cases. It has to be a redirect response since the parameter is interpreted by an external system before it's forwarded to my application. In onBeginRequest i tried
>
> public void onBeginRequest(RequestCycle cycle) {
> throw new RedirectToUrlException("http://test?bla=true");
> }
>
> which didn't work. Then tried altering the Response object obtained from the RequestCycle object like
>
> public void onBeginRequest(RequestCycle cycle) {
> WebResponse response = (WebResponse) cycle.getResponse();
> response.sendRedirect("http://test?bla=true");
> }
>
> which also didn't work.
>
> Any ideas?
>
> Cheers,
> Chris
>
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AW: Redirect within a RequestCycleListener's onBeginRequest
Posted by Sven Meier <sv...@meiers.net>.
Hi,
RedirectToUrlException is a ReplaceHandlerException, which is handled in
RequestHandlerStack#execute() only (which is called after the listeners
have been notified).
> In onBeginRequest im throwing a custom runtime exception which I
handle in onException
> by returning a RedirectRequestHandler.
Yeah, that works. Alternatively you might look into implementing your
own IRequestMapper.
Have fun
Sven
On 08/29/2013 09:33 AM, Ziegler, Christian wrote:
> Hi again,
>
> for documentation purposes, it seems I found a way. In onBeginRequest im throwing a custom runtime exception which I handle in onException by returning a RedirectRequestHandler.
>
> Regards,
> Chris
>
> ________________________________________
> Von: Ziegler, Christian [christian.ziegler@pentasys.de]
> Gesendet: Dienstag, 27. August 2013 18:04
> An: users@wicket.apache.org
> Betreff: Redirect within a RequestCycleListener's onBeginRequest
>
> Hi all,
>
> I'm trying implement a RequestCycleListener which redirects the user to the same page he initially requested but which adds a query string parameter in certain cases. It has to be a redirect response since the parameter is interpreted by an external system before it's forwarded to my application. In onBeginRequest i tried
>
> public void onBeginRequest(RequestCycle cycle) {
> throw new RedirectToUrlException("http://test?bla=true");
> }
>
> which didn't work. Then tried altering the Response object obtained from the RequestCycle object like
>
> public void onBeginRequest(RequestCycle cycle) {
> WebResponse response = (WebResponse) cycle.getResponse();
> response.sendRedirect("http://test?bla=true");
> }
>
> which also didn't work.
>
> Any ideas?
>
> Cheers,
> Chris
>
> ---------------------------------------------------------------------
> 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
AW: Redirect within a RequestCycleListener's onBeginRequest
Posted by "Ziegler, Christian" <ch...@pentasys.de>.
Hi again,
for documentation purposes, it seems I found a way. In onBeginRequest im throwing a custom runtime exception which I handle in onException by returning a RedirectRequestHandler.
Regards,
Chris
________________________________________
Von: Ziegler, Christian [christian.ziegler@pentasys.de]
Gesendet: Dienstag, 27. August 2013 18:04
An: users@wicket.apache.org
Betreff: Redirect within a RequestCycleListener's onBeginRequest
Hi all,
I'm trying implement a RequestCycleListener which redirects the user to the same page he initially requested but which adds a query string parameter in certain cases. It has to be a redirect response since the parameter is interpreted by an external system before it's forwarded to my application. In onBeginRequest i tried
public void onBeginRequest(RequestCycle cycle) {
throw new RedirectToUrlException("http://test?bla=true");
}
which didn't work. Then tried altering the Response object obtained from the RequestCycle object like
public void onBeginRequest(RequestCycle cycle) {
WebResponse response = (WebResponse) cycle.getResponse();
response.sendRedirect("http://test?bla=true");
}
which also didn't work.
Any ideas?
Cheers,
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org