Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   *
   * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
   *
   * The contents of this file are subject to the terms of either the GNU
   * General Public License Version 2 only ("GPL") or the Common Development
   * and Distribution License("CDDL") (collectively, the "License").  You
   * may not use this file except in compliance with the License.  You can
  * obtain a copy of the License at
  * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
  * or packager/legal/LICENSE.txt.  See the License for the specific
  * language governing permissions and limitations under the License.
  *
  * When distributing the software, include this License Header Notice in each
  * file and include the License file at packager/legal/LICENSE.txt.
  *
  * GPL Classpath Exception:
  * Oracle designates this particular file as subject to the "Classpath"
  * exception as provided by Oracle in the GPL Version 2 section of the License
  * file that accompanied this code.
  *
  * Modifications:
  * If applicable, add the following below the License Header, with the fields
  * enclosed by brackets [] replaced by your own identifying information:
  * "Portions Copyright [year] [name of copyright owner]"
  *
  * Contributor(s):
  * If you wish your version of this file to be governed by only the CDDL or
  * only the GPL Version 2, indicate your decision by adding "[Contributor]
  * elects to include this software in this distribution under the [CDDL or GPL
  * Version 2] license."  If you don't indicate a single choice of license, a
  * recipient has the option to distribute your version of this file under
  * either the CDDL, the GPL Version 2 or to extend the choice of license to
  * its licensees as provided above.  However, if you add GPL Version 2 code
  * and therefore, elected the GPL Version 2 license, then the option applies
  * only if the new code is made subject to such option by the copyright
  * holder.
  */
 
 package javax.faces.context;
 
 import java.io.Writer;
 import java.util.*;
 import java.net.URL;
 

Provides a simple implementation of ExternalContext that can be subclassed by developers wishing to provide specialized behavior to an existing ExternalContext instance. The default implementation of all methods is to call through to the wrapped ExternalContext instance.

Usage: extend this class and override getWrapped() to return the instance being wrapping.

Since:
2.0
 
 public abstract class ExternalContextWrapper extends ExternalContext implements FacesWrapper<ExternalContext> {
 
 
     // ----------------------------------------------- Methods from FacesWrapper
 

    

Returns:
the wrapped ExternalContext instance
See also:
javax.faces.FacesWrapper.getWrapped()
 
     public abstract ExternalContext getWrapped();
 
 
     // -------------------------------------------- Methods from ExternalContext
 

    

The default behavior of this method is to call ExternalContext.dispatch(java.lang.String) on the wrapped ExternalContext object.

 
     public void dispatch(String paththrows IOException {
         getWrapped().dispatch(path);
     }

    

The default behavior of this method is to call ExternalContext.encodeActionURL(java.lang.String) on the wrapped ExternalContext object.

    public String encodeActionURL(String url) {
        return getWrapped().encodeActionURL(url);
    }

    

The default behavior of this method is to call ExternalContext.encodeNamespace(java.lang.String) on the wrapped ExternalContext object.

    public String encodeNamespace(String name) {
        return getWrapped().encodeNamespace(name);
    }
    @Override
    public String encodePartialActionURL(String url) {
        return getWrapped().encodePartialActionURL(url);
    }
    
    
    

The default behavior of this method is to call ExternalContext.encodeResourceURL(java.lang.String) on the wrapped ExternalContext object.

    public String encodeResourceURL(String url) {
        return getWrapped().encodeResourceURL(url);
    }

    

The default behavior of this method is to call ExternalContext.getApplicationMap() on the wrapped ExternalContext object.

    public Map<StringObjectgetApplicationMap() {
        return getWrapped().getApplicationMap();
    }

    

The default behavior of this method is to call ExternalContext.getAuthType() on the wrapped ExternalContext object.

    public String getAuthType() {
        return getWrapped().getAuthType();
    }

    

The default behavior of this method is to call ExternalContext.getContext() on the wrapped ExternalContext object.

    public Object getContext() {
        return getWrapped().getContext();
    }

    

The default behavior of this method is to call ExternalContext.getInitParameter(java.lang.String) on the wrapped ExternalContext object.

    public String getInitParameter(String name) {
        return getWrapped().getInitParameter(name);
    }

    

The default behavior of this method is to call ExternalContext.getInitParameterMap() on the wrapped ExternalContext object.

    public Map getInitParameterMap() {
        return getWrapped().getInitParameterMap();
    }

    

The default behavior of this method is to call ExternalContext.getRemoteUser() on the wrapped ExternalContext object.

    public String getRemoteUser() {
        return getWrapped().getRemoteUser();
    }

    

The default behavior of this method is to call ExternalContext.getRequest() on the wrapped ExternalContext object.

    public Object getRequest() {
        return getWrapped().getRequest();
    }

    

The default behavior of this method is to call ExternalContext.getRequestContextPath() on the wrapped ExternalContext object.

    public String getRequestContextPath() {
        return getWrapped().getRequestContextPath();
    }

    

The default behavior of this method is to call ExternalContext.getRequestCookieMap() on the wrapped ExternalContext object.

    public Map<StringObjectgetRequestCookieMap() {
        return getWrapped().getRequestCookieMap();
    }

    

The default behavior of this method is to call ExternalContext.getRequestHeaderMap() on the wrapped ExternalContext object.

    public Map<StringStringgetRequestHeaderMap() {
        return getWrapped().getRequestHeaderMap();
    }

    

The default behavior of this method is to call ExternalContext.getRequestHeaderValuesMap() on the wrapped ExternalContext object.

    public Map<StringString[]> getRequestHeaderValuesMap() {
        return getWrapped().getRequestHeaderValuesMap();
    }

    

The default behavior of this method is to call ExternalContext.getRequestLocale() on the wrapped ExternalContext object.

    public Locale getRequestLocale() {
        return getWrapped().getRequestLocale();
    }

    

The default behavior of this method is to call ExternalContext.getRequestLocales() on the wrapped ExternalContext object.

    public Iterator<LocalegetRequestLocales() {
        return getWrapped().getRequestLocales();
    }

    

The default behavior of this method is to call ExternalContext.getRequestMap() on the wrapped ExternalContext object.

    public Map<StringObjectgetRequestMap() {
        return getWrapped().getRequestMap();
    }

    

The default behavior of this method is to call ExternalContext.getRequestParameterMap() on the wrapped ExternalContext object.

    public Map<StringStringgetRequestParameterMap() {
        return getWrapped().getRequestParameterMap();
    }

    

The default behavior of this method is to call ExternalContext.getRequestParameterNames() on the wrapped ExternalContext object.

        return getWrapped().getRequestParameterNames();
    }

    

The default behavior of this method is to call ExternalContext.getRequestParameterValuesMap() on the wrapped ExternalContext object.

        return getWrapped().getRequestParameterValuesMap();
    }

    

The default behavior of this method is to call ExternalContext.getRequestPathInfo() on the wrapped ExternalContext object.

    public String getRequestPathInfo() {
        return getWrapped().getRequestPathInfo();
    }

    

The default behavior of this method is to call ExternalContext.getRequestServletPath() on the wrapped ExternalContext object.

    public String getRequestServletPath() {
        return getWrapped().getRequestServletPath();
    }

    

The default behavior of this method is to call ExternalContext.getResource(java.lang.String) on the wrapped ExternalContext object.

    public URL getResource(String paththrows MalformedURLException {
        return getWrapped().getResource(path);
    }

    

The default behavior of this method is to call ExternalContext.getResourceAsStream(java.lang.String) on the wrapped ExternalContext object.

    public InputStream getResourceAsStream(String path) {
        return getWrapped().getResourceAsStream(path);
    }

    

The default behavior of this method is to call ExternalContext.getResourcePaths(java.lang.String) on the wrapped ExternalContext object.

    public Set<StringgetResourcePaths(String path) {
        return getWrapped().getResourcePaths(path);
    }

    

The default behavior of this method is to call ExternalContext.getResponse() on the wrapped ExternalContext object.

    public Object getResponse() {
        return getWrapped().getResponse();
    }

    

The default behavior of this method is to call ExternalContext.getSession(boolean) on the wrapped ExternalContext object.

    public Object getSession(boolean create) {
        return getWrapped().getSession(create);
    }

    

The default behavior of this method is to call ExternalContext.getAuthType() on the wrapped ExternalContext object.

    public Map<StringObjectgetSessionMap() {
        return getWrapped().getSessionMap();
    }

    

The default behavior of this method is to call ExternalContext.getUserPrincipal() on the wrapped ExternalContext object.

    public Principal getUserPrincipal() {
        return getWrapped().getUserPrincipal();
    }

    

The default behavior of this method is to call ExternalContext.isUserInRole(java.lang.String) on the wrapped ExternalContext object.

    public boolean isUserInRole(String role) {
        return getWrapped().isUserInRole(role);
    }

    

The default behavior of this method is to call ExternalContext.log(java.lang.String) on the wrapped ExternalContext object.

    public void log(String message) {
        getWrapped().log(message);
    }

    
    public void log(String messageThrowable exception) {
        getWrapped().log(messageexception);
    }

    

The default behavior of this method is to call ExternalContext.redirect(java.lang.String) on the wrapped ExternalContext object.

    public void redirect(String urlthrows IOException {
        getWrapped().redirect(url);
    }

    
    @Override
    public void addResponseCookie(String name,
                                  String value,
                                  Map<StringObjectproperties) {
        getWrapped().addResponseCookie(namevalueproperties);
    }

    

The default behavior of this method is to call ExternalContext.getMimeType(java.lang.String) on the wrapped ExternalContext object.

    @Override
    public String getMimeType(String file) {
        return getWrapped().getMimeType(file);
    }

    

The default behavior of this method is to call ExternalContext.getContextName() on the wrapped ExternalContext object.

    @Override
    public String getContextName() {
        return getWrapped().getContextName();
    }

    

The default behavior of this method is to call ExternalContext.setRequest(java.lang.Object) on the wrapped ExternalContext object.

    @Override
    public void setRequest(Object request) {
        getWrapped().setRequest(request);
    }

    

The default behavior of this method is to call ExternalContext.getRequestScheme() on the wrapped ExternalContext object.

    @Override
    public String getRequestScheme() {
        return getWrapped().getRequestScheme();
    }

    

The default behavior of this method is to call ExternalContext.getRequestServerName() on the wrapped ExternalContext object.

    @Override
    public String getRequestServerName() {
        return getWrapped().getRequestServerName();
    }

    

The default behavior of this method is to call ExternalContext.getRequestServerPort() on the wrapped ExternalContext object.

    @Override
    public int getRequestServerPort() {
        return getWrapped().getRequestServerPort();
    }

    
    @Override
    public void setRequestCharacterEncoding(String encoding)
        getWrapped().setRequestCharacterEncoding(encoding);
    }

    

The default behavior of this method is to call ExternalContext.getRealPath(java.lang.String) on the wrapped ExternalContext object.

    @Override
    public String getRealPath(String path) {
        return getWrapped().getRealPath(path);
    }

    

The default behavior of this method is to call ExternalContext.getRequestCharacterEncoding() on the wrapped ExternalContext object.

    @Override
        return getWrapped().getRequestCharacterEncoding();
    }

    

The default behavior of this method is to call ExternalContext.getRequestContentType() on the wrapped ExternalContext object.

    @Override
    public String getRequestContentType() {
        return getWrapped().getRequestContentType();
    }

    

The default behavior of this method is to call ExternalContext.getRequestContentLength() on the wrapped ExternalContext object.

    @Override
    public int getRequestContentLength() {
        return getWrapped().getRequestContentLength();
    }

    

The default behavior of this method is to call ExternalContext.getResponseCharacterEncoding() on the wrapped ExternalContext object.

    @Override
        return getWrapped().getResponseCharacterEncoding();
    }

    

The default behavior of this method is to call ExternalContext.getResponseContentType() on the wrapped ExternalContext object.

    @Override
    public String getResponseContentType() {
        return getWrapped().getResponseContentType();
    }

    

The default behavior of this method is to call ExternalContext.setResponse(java.lang.Object) on the wrapped ExternalContext object.

    @Override
    public void setResponse(Object response) {
        getWrapped().setResponse(response);
    }

    

The default behavior of this method is to call ExternalContext.getResponseOutputStream() on the wrapped ExternalContext object.

    @Override
    public OutputStream getResponseOutputStream() throws IOException {
        return getWrapped().getResponseOutputStream();
    }

    

The default behavior of this method is to call ExternalContext.getResponseOutputWriter() on the wrapped ExternalContext object.

    @Override
    public Writer getResponseOutputWriter() throws IOException {
        return getWrapped().getResponseOutputWriter();
    }

    

The default behavior of this method is to call ExternalContext.getResponseCharacterEncoding() on the wrapped ExternalContext object.

    @Override
    public void setResponseCharacterEncoding(String encoding) {
        getWrapped().setResponseCharacterEncoding(encoding);
    }

    
    @Override
    public void setResponseContentType(String contentType) {
        getWrapped().setResponseContentType(contentType);
    }

    

The default behavior of this method is to call ExternalContext.invalidateSession() on the wrapped ExternalContext object.

    @Override
    public void invalidateSession() {
        getWrapped().invalidateSession();
    }

    
    @Override
    public void setResponseHeader(String nameString value) {
        getWrapped().setResponseHeader(namevalue);
    }

    
    @Override
    public void addResponseHeader(String nameString value) {
        getWrapped().addResponseHeader(namevalue);
    }

    

The default behavior of this method is to call ExternalContext.setResponseBufferSize(int) on the wrapped ExternalContext object.

    @Override
    public void setResponseBufferSize(int size) {
        getWrapped().setResponseBufferSize(size);   
    }

    

The default behavior of this method is to call ExternalContext.getResponseBufferSize() on the wrapped ExternalContext object.

    @Override
    public int getResponseBufferSize() {
        return getWrapped().getResponseBufferSize();
    }

    

The default behavior of this method is to call ExternalContext.isResponseCommitted() on the wrapped ExternalContext object.

    @Override
    public boolean isResponseCommitted() {
        return getWrapped().isResponseCommitted();
    }

    

The default behavior of this method is to call ExternalContext.responseReset() on the wrapped ExternalContext object.

    @Override
    public void responseReset() {
        getWrapped().responseReset();
    }

    
    @Override
    public void responseSendError(int statusCodeString messagethrows IOException {
        getWrapped().responseSendError(statusCodemessage);
    }

    

The default behavior of this method is to call ExternalContext.setResponseStatus(int) on the wrapped ExternalContext object.

    @Override
    public void setResponseStatus(int statusCode) {
        getWrapped().setResponseStatus(statusCode);    
    }

    

The default behavior of this method is to call ExternalContext.responseFlushBuffer() on the wrapped ExternalContext object.

    @Override
    public void responseFlushBuffer() throws IOException {
        getWrapped().responseFlushBuffer();
    }


    

The default behavior of this method is to call ExternalContext.setResponseContentLength(int) on the wrapped ExternalContext object.

    @Override
    public void setResponseContentLength(int length) {
        getWrapped().setResponseContentLength(length);
    }


    
    @Override
    public String encodeBookmarkableURL(String baseUrlMap<StringList<String>> parameters) {
        return getWrapped().encodeBookmarkableURL(baseUrlparameters);
    }

    
    @Override
    public String encodeRedirectURL(String baseUrlMap<StringList<String>> parameters) {
        return getWrapped().encodeRedirectURL(baseUrlparameters);
    }


    

The default behavior of this method is to call ExternalContext.getFlash() on the wrapped ExternalContext object.

    @Override
    public Flash getFlash() {
        return getWrapped().getFlash();
    }
    
New to GrepCode? Check out our FAQ X