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: package org.apache.wicket.request.target.coding;
18:
19: import org.apache.wicket.IRequestTarget;
20: import org.apache.wicket.request.RequestParameters;
21:
22: /**
23: * Implementations of this interface know how to encode and decode request
24: * targets to/from a URL.
25: *
26: * @author Eelco Hillenius
27: */
28: public interface IRequestTargetUrlCodingStrategy {
29: /**
30: * Returns the path of the url where this request target is mounted on.
31: * This should not have a leading slash.
32: *
33: * @return String The path of the url
34: */
35: String getMountPath();
36:
37: /**
38: * Gets the encoded url for the provided request target. Typically, the
39: * result will be prepended with a protocol specific prefix. In a servlet
40: * environment, the prefix typically is the context-path + servlet path, eg
41: * mywebapp/myservletname.
42: *
43: * @param requestTarget
44: * the request target to encode
45: *
46: * @return the encoded url
47: */
48: CharSequence encode(IRequestTarget requestTarget);
49:
50: /**
51: * Gets the decoded request target.
52: *
53: * @param requestParameters
54: * the request parameters
55: * @return the decoded request target
56: */
57: IRequestTarget decode(RequestParameters requestParameters);
58:
59: /**
60: * Gets whether this mounter is applicable for the provided request target.
61: *
62: * @param requestTarget
63: * the request target
64: * @return whether this mounter is applicable for the provided request
65: * target
66: */
67: boolean matches(IRequestTarget requestTarget);
68:
69: /**
70: * Returns true if this mounter is applicable for the URL path
71: * @param path
72: * @return
73: */
74: boolean matches(String path);
75: }
|