yes, that's right. only it's not really a dummy page.
it's a redirect page whose function is to locate the
right server.
public class ServerLocatorPage extends WebPage { ... // what you said }
btw, you can do anything in Wicket you can do in a servlet
because you can always drill down to the HttpServlet classes:
getWebRequestCycle().getWebRequest().getHttpServletRequest()
getWebRequestCycle().getWebRequest().getHttpServletRequest().getSession()
getWebRequestCycle().getWebResponse().getHttpServletResponse()
Warren Bell wrote:
>
> I don't always have access to those resources. I will try the
> setRequestTarget code. I would still have to set-up a dummy page to do
> this, since I am coming in from an external source, correct? Where else
> could I place this code?
>
> public class DummyPage extends ...
> {
> public DummyPage()
> {
> super ...
> RequestCycle.get().setRequestTarget(new
> RedirectRequestTarget(url));
> }
> }
>
>
> http://HQserverIP/appname/DummyPage
>
>
>
> 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]
>>>
>>>
>>>
>>
>
>
>
> --
> 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-tp21245727p21247461.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]