01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * $Header:$
18: */
19: package org.apache.beehive.netui.core.urls;
20:
21: /**
22: * Passed to {@link URLRewriter#rewriteURL} for normal (non-resource) and resource, non-secure and
23: * secure URLs.
24: */
25: public class URLType {
26: protected static final int INT_ACTION = 0;
27: protected static final int INT_RESOURCE = 1;
28:
29: public static final URLType ACTION = new URLType(INT_ACTION);
30: public static final URLType RESOURCE = new URLType(INT_RESOURCE);
31:
32: private int _val;
33:
34: private URLType(int val) {
35: _val = val;
36: }
37:
38: public String toString() {
39: switch (_val) {
40: case INT_ACTION:
41: return "action";
42: case INT_RESOURCE:
43: return "resource";
44: }
45:
46: assert false : _val;
47: return "<unknown URLType>";
48: }
49:
50: public boolean equals(Object o) {
51: if (o == null)
52: return false;
53: if (o == this )
54: return true;
55: if (!(o instanceof URLType))
56: return false;
57: return ((URLType) o)._val == _val;
58: }
59:
60: public int hashCode() {
61: return _val;
62: }
63: }
|