01: /*
02: * $Id: org.eclipse.jdt.ui.prefs 5004 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) eelco12 $
03: * $Revision: 5004 $
04: * $Date: 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) $
05: *
06: * ==============================================================================
07: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
08: * use this file except in compliance with the License. You may obtain a copy of
09: * the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16: * License for the specific language governing permissions and limitations under
17: * the License.
18: */
19: package wicket.request.target.basic;
20:
21: import wicket.IRequestTarget;
22: import wicket.RequestCycle;
23: import wicket.markup.html.pages.RedirectPage;
24:
25: /**
26: * A RequestTarget that will sent a redirect url to the browser. Use this if you
27: * want to direct the browser to some external URL, like Google etc, immediantly.
28: * or if you want to redirect to a Wicket page.
29: *
30: * If you want to redirect with a delay the {@link RedirectPage} will do a meta
31: * tag redirect with a delay.
32: *
33: * @author jcompagner
34: */
35: public class RedirectRequestTarget implements IRequestTarget {
36:
37: private final String redirectUrl;
38:
39: /**
40: * Construct.
41: * @param redirectUrl
42: */
43: public RedirectRequestTarget(String redirectUrl) {
44: this .redirectUrl = redirectUrl;
45:
46: }
47:
48: /**
49: * @see wicket.IRequestTarget#detach(wicket.RequestCycle)
50: */
51: public void detach(RequestCycle requestCycle) {
52: }
53:
54: /**
55: * @see wicket.IRequestTarget#getLock(wicket.RequestCycle)
56: */
57: public Object getLock(RequestCycle requestCycle) {
58: return null;
59: }
60:
61: /**
62: * @see wicket.IRequestTarget#respond(wicket.RequestCycle)
63: */
64: public void respond(RequestCycle requestCycle) {
65: requestCycle.getResponse().redirect(redirectUrl);
66: }
67:
68: }
|