01: package com.icesoft.faces.webapp.http.common;
02:
03: import java.io.IOException;
04: import java.io.InputStream;
05: import java.io.OutputStream;
06: import java.net.URI;
07: import java.util.Date;
08:
09: public interface Request {
10:
11: String getMethod();
12:
13: URI getURI();
14:
15: String getHeader(String name);
16:
17: String[] getHeaderAsStrings(String name);
18:
19: Date getHeaderAsDate(String name);
20:
21: int getHeaderAsInteger(String name);
22:
23: boolean containsParameter(String name);
24:
25: String getParameter(String name);
26:
27: String[] getParameterAsStrings(String name);
28:
29: int getParameterAsInteger(String name);
30:
31: boolean getParameterAsBoolean(String name);
32:
33: String getParameter(String name, String defaultValue);
34:
35: int getParameterAsInteger(String name, int defaultValue);
36:
37: boolean getParameterAsBoolean(String name, boolean defaultValue);
38:
39: InputStream readBody() throws IOException;
40:
41: void readBodyInto(OutputStream out) throws IOException;
42:
43: void respondWith(ResponseHandler handler) throws Exception;
44:
45: void detectEnvironment(Environment environment) throws Exception;
46:
47: //avoid runtime dependency on Portlet interfaces,
48: //and for the symmetry's sake, same for the Servlet interfaces
49: interface Environment {
50:
51: void servlet(Object request, Object response) throws Exception;
52:
53: void portlet(Object request, Object response, Object config)
54: throws Exception;
55: }
56: }
|