001: /*
002: * Copyright 2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package javax.faces.context;
017:
018: import java.util.Iterator;
019: import java.util.Locale;
020: import java.util.Map;
021: import java.util.Set;
022:
023: /**
024: * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
025: *
026: * @author Manfred Geiler (latest modification by $Author: mbr $)
027: * @version $Revision: 513685 $ $Date: 2007-03-02 11:12:05 +0100 (Fr, 02 Mrz 2007) $
028: */
029: public abstract class ExternalContext {
030: public static final String BASIC_AUTH = "BASIC";
031: public static final String CLIENT_CERT_AUTH = "CLIENT_CERT";
032: public static final String DIGEST_AUTH = "DIGEST";
033: public static final String FORM_AUTH = "FORM";
034:
035: public abstract void dispatch(String path)
036: throws java.io.IOException;
037:
038: public abstract String encodeActionURL(String url);
039:
040: public abstract String encodeNamespace(String name);
041:
042: public abstract String encodeResourceURL(String url);
043:
044: public abstract Map<String, Object> getApplicationMap();
045:
046: public abstract String getAuthType();
047:
048: public abstract Object getContext();
049:
050: public abstract String getInitParameter(String name);
051:
052: public abstract Map getInitParameterMap();
053:
054: public abstract String getRemoteUser();
055:
056: public abstract Object getRequest();
057:
058: public String getRequestCharacterEncoding() {
059: throw new UnsupportedOperationException();
060: }
061:
062: public String getRequestContentType() {
063: throw new UnsupportedOperationException();
064: }
065:
066: public abstract String getRequestContextPath();
067:
068: public abstract Map<String, Object> getRequestCookieMap();
069:
070: public abstract Map<String, String> getRequestHeaderMap();
071:
072: public abstract Map<String, String[]> getRequestHeaderValuesMap();
073:
074: public abstract Locale getRequestLocale();
075:
076: public abstract Iterator<Locale> getRequestLocales();
077:
078: public abstract Map<String, Object> getRequestMap();
079:
080: public abstract Map<String, String> getRequestParameterMap();
081:
082: public abstract Iterator<String> getRequestParameterNames();
083:
084: public abstract Map<String, String[]> getRequestParameterValuesMap();
085:
086: public abstract String getRequestPathInfo();
087:
088: public abstract String getRequestServletPath();
089:
090: public abstract java.net.URL getResource(String path)
091: throws java.net.MalformedURLException;
092:
093: public abstract java.io.InputStream getResourceAsStream(String path);
094:
095: public abstract Set<String> getResourcePaths(String path);
096:
097: public abstract Object getResponse();
098:
099: /**
100: * throws <code>UnsupportedOperationException</code> by default.
101: * @since JSF 1.2
102: */
103: public String getResponseContentType() {
104: throw new UnsupportedOperationException();
105: }
106:
107: public abstract Object getSession(boolean create);
108:
109: public abstract Map<String, Object> getSessionMap();
110:
111: public abstract java.security.Principal getUserPrincipal();
112:
113: /**
114: * throws <code>UnsupportedOperationException</code> by default.
115: * @since JSF 1.2
116: * @param request
117: */
118: public void setRequest(java.lang.Object request) {
119: throw new UnsupportedOperationException();
120: }
121:
122: /**
123: * throws <code>UnsupportedOperationException</code> by default.
124: * @since JSF 1.2
125: * @param encoding
126: * @throws java.io.UnsupportedEncodingException
127: */
128: public void setRequestCharacterEncoding(java.lang.String encoding)
129: throws java.io.UnsupportedEncodingException {
130:
131: throw new UnsupportedOperationException();
132: }
133:
134: /**
135: * throws <code>UnsupportedOperationException</code> by default.
136: * @since JSF 1.2
137: * @param response
138: */
139: public void setResponse(java.lang.Object response) {
140: throw new UnsupportedOperationException();
141: }
142:
143: /**
144: * throws <code>UnsupportedOperationException</code> by default.
145: * @since JSF 1.2
146: * @param encoding
147: */
148: public void setResponseCharacterEncoding(java.lang.String encoding) {
149: throw new UnsupportedOperationException();
150: }
151:
152: public String getResponseCharacterEncoding() {
153: throw new UnsupportedOperationException(
154: "JSF 1.2 : figure out how to tell if this is a Portlet request");
155: }
156:
157: public abstract boolean isUserInRole(String role);
158:
159: public abstract void log(String message);
160:
161: public abstract void log(String message, Throwable exception);
162:
163: public abstract void redirect(String url)
164: throws java.io.IOException;
165: }
|