Joel Hill wrote:
> We have a JSP servlet application that we're slowing beginning to
> convert over to wicket.  Our first wicket page is a form with submit and
> cancel buttons, either of which (unless there is a validation error)
> will redirect the user back to the old servlet using the following
> code:
> 
> protected void onSubmit() {
>   String contextPath =
> getApplication().getApplicationSettings().getContextPath();
>   String url = contextPath + "/servletPath?queryString";
>   getRequestCycle().setRequestTarget(new RedirectRequestTarget(url));
> }
> 
> The problem is that our app is behind a reverse proxy and
> getContextPath() is getting the path of the webserver our app is running
> on, not the reverse proxy's path, and so the redirect fails.  Is there
> another way to redirect our form back to the non-wicket servlet after a
> form submit/cancel?  So far the only way I've been able to get it to
> work is by grabbing the "Referer" header of the http request, and then
> parsing it so I can replace the path of our wicket servlet with our
> non-wicket servlet, but I've read it's up to the client whether or not
> that header gets sent, so if it's not there, there's no other way I know
> of to get the correct path.
> 
> We're using wicket 1.2.5 on an OC4J 10.1.3 webserver.

Yeah, in 1.2.x you'll have to call setContextPath() on the application 
settings object so it does the right thing (probably returns "/" in this 
case).

There's very little you can do with version 1.2.x to make this nice, I'm 
afraid. We've put a whole load of work in for 1.3.x to make it work 
transparently behind a reverse proxy. For example, this case could be 
handled elegantly using Request.getRelativePathPrefixToContextRoot(), 
which will give you an appropriate number of "../" to prepend to make it 
all work.

Al

-- 
Alastair Maw
Wicket-biased blog at http://herebebeasties.com

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to