KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > execution > support > ExternalRedirect


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.springframework.webflow.execution.support;
17
18 import org.springframework.util.Assert;
19 import org.springframework.webflow.execution.ViewSelection;
20
21 /**
22  * Concrete response type that requests a redirect to an external URL outside of
23  * Spring Web Flow.
24  *
25  * @author Keith Donald
26  * @author Erwin Vervaet
27  */

28 public final class ExternalRedirect extends ViewSelection {
29
30     /**
31      * The arbitrary url path to redirect to.
32      */

33     private final String JavaDoc url;
34
35     /**
36      * Creates an external redirect request.
37      * @param url the url path to redirect to
38      */

39     public ExternalRedirect(String JavaDoc url) {
40         Assert.notNull(url, "The external URL to redirect to is required");
41         this.url = url;
42     }
43     
44     /**
45      * Returns the external URL to redirect to.
46      */

47     public String JavaDoc getUrl() {
48         return url;
49     }
50
51     public boolean equals(Object JavaDoc o) {
52         if (!(o instanceof ExternalRedirect)) {
53             return false;
54         }
55         ExternalRedirect other = (ExternalRedirect)o;
56         return url.equals(other.url);
57     }
58
59     public int hashCode() {
60         return url.hashCode();
61     }
62
63     public String JavaDoc toString() {
64         return "externalRedirect:'" + url + "'";
65     }
66 }
Popular Tags