the code i gave you above does, by the way, redirect to an arbitrary url.
Jonathan Locke wrote: > > > isn't this outside the scope of wicket? it sounds like it might be > solvable > with some kind of load balancer, router or DNS resolver... > > > Warren Bell wrote: >> >> I need to explain myself a little better. This is the situation, I have >> several locations that are on different subnets. They are all connected >> with a VPN. Each subnet has its own server running this wicket app. The >> app clients are running on mobile scanning PDAs. These PDAs get moved >> between each subnet. The PDAs need to know what server to access the app >> at. One of the subnets has a Headquarters server. How I see this working >> is that each PDA would access the HQ server and then be redirected to >> its subnet server. For instance the PDA client would have its browsers >> home page set to the HQs url: >> >> http://HQserverIP/redirectPDA >> >> The HQ server would then redirect to the PDAs local server based on the >> ip address the response came from: >> >> http://LocalserverIP/login >> >> I did not want to create a page on the HQ server just so that it could >> be redirected thinking there could be some issues doing that. I was >> going to do this redirecting in a separate servlet, but I wanted to keep >> it all in one app. I saw the RedirectToExternalException solution >> thinking that this could be used. >> >> Jonathan Locke wrote: >>> try: >>> >>> RequestCycle.get().setRequestTarget(new RedirectRequestTarget(url)); >>> >>> >>> Warren Bell wrote: >>>> I need to redirect to an external page. I saw this solution, but was >>>> not >>>> sure how to use it. Where does this exception get thrown? I do not want >>>> to instantiate some kind of dummy page. >>>> >>>> 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)); >>>> } >>>> } >>>> } >>>> >>>> Thanks, >>>> >>>> Warren >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>>> >>> >> >> >> -- >> Thanks, >> >> Warren Bell >> 909-645-8864 >> [email protected] >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> >> > > -- View this message in context: http://www.nabble.com/Redirecting-to-external-URL-tp21245727p21246705.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]
