01: /*
02: * Copyright 2004 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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.outerj.daisy.httpconnector.spi;
17:
18: import org.outerj.daisy.repository.Repository;
19:
20: import javax.servlet.http.HttpServletRequest;
21: import javax.servlet.http.HttpServletResponse;
22: import java.util.Map;
23:
24: /**
25: * Handler for HTTP requests.
26: *
27: * <p>Handlers always deal with URL's of the following structure:
28: *
29: * <pre>
30: * {namespace}/{remainder of URL}
31: * </pre>
32: *
33: * The {namespace} part is a fixed string (should not contain slashes)
34: * used to have a bulk division of the URL space among different subsystems.
35: *
36: * <p>The {remainder of URL} can have any structure whatsoever. The structure
37: * handled by this RequestHandler is the pattern returned by {@link #getPathPattern()}.
38: *
39: * <p>The RequestHandler should be registered as a plugin with the
40: * {@link org.outerj.daisy.plugin.PluginRegistry PluginRegistry}
41: */
42: public interface RequestHandler {
43: /**
44: *
45: * @param matchMap contains the content of the matched wildcards from the pattern, if any.
46: * The keys for retrieving these patterns are "1", "2", etc (as string objects).
47: * @param repository Repository object of the authenticated user.
48: * @param support
49: */
50: void handleRequest(Map matchMap, HttpServletRequest request,
51: HttpServletResponse response, Repository repository,
52: RequestHandlerSupport support) throws Exception;
53:
54: /**
55: * Pattern for the URLs that should be handled by this request handler.
56: *
57: * <p>The pattern should usually start with a slash. It should
58: * not include the namespace to which this RequestHandler belongs.
59: *
60: * <p>The pattern can contain the wildcards * and **.
61: * One star matches any character without slash, two stars
62: * matches any character including slash.
63: *
64: * <p>Patterns will be checked in the order by which the request
65: * handlers are registered (within a namespace).
66: */
67: String getPathPattern();
68:
69: /**
70: * See class description.
71: */
72: String getNamespace();
73: }
|