001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License version 2
011: * as published by the Free Software Foundation.
012: *
013: * Resin Open Source is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
016: * of NON-INFRINGEMENT. See the GNU General Public License for more
017: * details.
018: *
019: * You should have received a copy of the GNU General Public License
020: * along with Resin Open Source; if not, write to the
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package javax.faces.context;
030:
031: import java.io.*;
032: import java.net.URL;
033: import java.net.MalformedURLException;
034: import java.util.*;
035: import java.security.*;
036:
037: public abstract class ExternalContext {
038: public static final String BASIC_AUTH = "BASIC";
039: public static final String CLIENT_CERT_AUTH = "CLIENT_CERT";
040: public static final String DIGEST_AUTH = "DIGEST";
041: public static final String FORM_AUTH = "FORM";
042:
043: public abstract void dispatch(String path) throws IOException;
044:
045: public abstract String encodeActionURL(String url);
046:
047: public abstract String encodeNamespace(String name);
048:
049: public abstract String encodeResourceURL(String url);
050:
051: public abstract Map<String, Object> getApplicationMap();
052:
053: public abstract String getAuthType();
054:
055: public abstract Object getContext();
056:
057: public abstract String getInitParameter(String name);
058:
059: public abstract Map getInitParameterMap();
060:
061: public abstract String getRemoteUser();
062:
063: public abstract Object getRequest();
064:
065: /**
066: * @Since 1.2
067: */
068: public void setRequest(Object request) {
069: throw new UnsupportedOperationException(getClass().getName());
070: }
071:
072: /**
073: * @Since 1.2
074: */
075: public void setRequestCharacterEncoding(String encoding)
076: throws UnsupportedEncodingException {
077: throw new UnsupportedOperationException(getClass().getName());
078: }
079:
080: public abstract String getRequestContextPath();
081:
082: public abstract Map<String, Object> getRequestCookieMap();
083:
084: public abstract Map<String, String> getRequestHeaderMap();
085:
086: public abstract Map<String, String[]> getRequestHeaderValuesMap();
087:
088: public abstract Locale getRequestLocale();
089:
090: public abstract Iterator<Locale> getRequestLocales();
091:
092: public abstract Map<String, Object> getRequestMap();
093:
094: public abstract Map<String, String> getRequestParameterMap();
095:
096: public abstract Iterator<String> getRequestParameterNames();
097:
098: public abstract Map<String, String[]> getRequestParameterValuesMap();
099:
100: public abstract String getRequestPathInfo();
101:
102: public abstract String getRequestServletPath();
103:
104: /**
105: * @Since 1.2
106: */
107: public String getRequestCharacterEncoding() {
108: throw new UnsupportedOperationException(getClass().getName());
109: }
110:
111: /**
112: * @Since 1.2
113: */
114: public String getRequestContentType() {
115: throw new UnsupportedOperationException(getClass().getName());
116: }
117:
118: /**
119: * @Since 1.2
120: */
121: public String getResponseCharacterEncoding() {
122: throw new UnsupportedOperationException(getClass().getName());
123: }
124:
125: /**
126: * @Since 1.2
127: */
128: public String getResponseContentType() {
129: throw new UnsupportedOperationException(getClass().getName());
130: }
131:
132: public abstract URL getResource(String path)
133: throws MalformedURLException;
134:
135: public abstract InputStream getResourceAsStream(String path);
136:
137: public abstract Set<String> getResourcePaths(String path);
138:
139: public abstract Object getResponse();
140:
141: /**
142: * @Since 1.2
143: */
144: public void setResponse(Object response) {
145: throw new UnsupportedOperationException(getClass().getName());
146: }
147:
148: /**
149: * @Since 1.2
150: */
151: public void setResponseCharacterEncoding(String encoding) {
152: throw new UnsupportedOperationException(getClass().getName());
153: }
154:
155: public abstract Object getSession(boolean create);
156:
157: public abstract Map<String, Object> getSessionMap();
158:
159: public abstract Principal getUserPrincipal();
160:
161: public abstract boolean isUserInRole(String role);
162:
163: public abstract void log(String message);
164:
165: public abstract void log(String message, Throwable exn);
166:
167: public abstract void redirect(String url) throws IOException;
168: }
|