Repository navigation
Expand file tree
/
Copy pathRequestHandler.java
More file actions
52 lines (46 loc) · 1.68 KB
/
Copy pathRequestHandler.java
File metadata and controls
52 lines (46 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package act.handler;
import act.Destroyable;
import act.app.ActionContext;
import act.handler.builtin.StaticFileGetter;
import org.osgl.$;
/**
* Defines a thread-save function object that can be applied
* to a {@link ActionContext} context to
* produce certain output which could be applied to the
* {@link org.osgl.http.H.Response} associated with the
* context
*/
public interface RequestHandler extends $.Function<ActionContext, Void>, Destroyable {
/**
* Invoke handler upon an action context
*
* @param context
*/
void handle(ActionContext context);
/**
* Indicate if this request handler support partial path lookup.
* Usually this method should return {@code false}. However for
* certain request handler like {@link StaticFileGetter}
* they need to support partial path lookup. Take the example of
* the following route mapping:
* <p/>
* <code>
* GET /public staticDir: /public
* </code>
* <p/>
* which map url path {@code /public} to a {@code StaticFileGetter} with
* base dir set to {@code /public}, it needs to support all path starts
* with "/public", like "/public/js/jquery.js" etc.
*
* @return {@code true} if the request handler support partial path lookup
* or {@code false} otherwise
*/
boolean supportPartialPath();
/**
* Returns if the handler require framework to resolve context. Usually it needs to
* resolve the context so that handler can access request params, session/flash etc.
* However some static handlers doesn't require framework to do those things, e.g.
* {@link StaticFileGetter}
*/
boolean requireResolveContext();
}