Coverage Report - javax.faces.context.ExternalContext
 
Classes in this File Line Coverage Branch Coverage Complexity
ExternalContext
0%
0/38
0%
0/16
0
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package javax.faces.context;
 20  
 
 21  
 import java.util.Iterator;
 22  
 import java.util.Locale;
 23  
 import java.util.Map;
 24  
 import java.util.Set;
 25  
 
 26  
 /**
 27  
  * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
 28  
  *
 29  
  * @author Manfred Geiler (latest modification by $Author: lu4242 $)
 30  
  * @version $Revision: 827879 $ $Date: 2009-10-20 22:10:03 -0500 (Tue, 20 Oct 2009) $
 31  
  */
 32  0
 public abstract class ExternalContext
 33  
 {
 34  
     public static final String BASIC_AUTH = "BASIC";
 35  
     public static final String CLIENT_CERT_AUTH = "CLIENT_CERT";
 36  
     public static final String DIGEST_AUTH = "DIGEST";
 37  
     public static final String FORM_AUTH = "FORM";
 38  
     
 39  0
     private static ThreadLocal<ExternalContext> _firstInstance = new ThreadLocal<ExternalContext>();
 40  
 
 41  
     public abstract void dispatch(String path)
 42  
             throws java.io.IOException;
 43  
 
 44  
     public abstract String encodeActionURL(String url);
 45  
 
 46  
     public abstract String encodeNamespace(String name);
 47  
 
 48  
     public abstract String encodeResourceURL(String url);
 49  
 
 50  
     public abstract Map<String, Object> getApplicationMap();
 51  
 
 52  
     public abstract String getAuthType();
 53  
 
 54  
     public abstract Object getContext();
 55  
 
 56  
     public abstract String getInitParameter(String name);
 57  
 
 58  
     public abstract Map getInitParameterMap();
 59  
 
 60  
     public abstract String getRemoteUser();
 61  
 
 62  
     public abstract Object getRequest();
 63  
     
 64  
     public String getRequestCharacterEncoding()
 65  
     {
 66  0
         ExternalContext ctx = _firstInstance.get();
 67  
         
 68  0
         if (ctx == null)
 69  
         {
 70  0
             throw new UnsupportedOperationException();
 71  
         }
 72  
         
 73  0
         return ctx.getRequestCharacterEncoding();
 74  
     }
 75  
     
 76  
     public String getRequestContentType()
 77  
     {
 78  0
         ExternalContext ctx = _firstInstance.get();
 79  
         
 80  0
         if (ctx == null)
 81  
         {
 82  0
             throw new UnsupportedOperationException();
 83  
         }
 84  
         
 85  0
         return ctx.getRequestContentType();
 86  
     }
 87  
     
 88  
     public abstract String getRequestContextPath();
 89  
 
 90  
     public abstract Map<String, Object> getRequestCookieMap();
 91  
 
 92  
     public abstract Map<String, String> getRequestHeaderMap();
 93  
 
 94  
     public abstract Map<String, String[]> getRequestHeaderValuesMap();
 95  
 
 96  
     public abstract Locale getRequestLocale();
 97  
 
 98  
     public abstract Iterator<Locale> getRequestLocales();
 99  
 
 100  
     public abstract Map<String, Object> getRequestMap();
 101  
 
 102  
     public abstract Map<String, String> getRequestParameterMap();
 103  
 
 104  
     public abstract Iterator<String> getRequestParameterNames();
 105  
 
 106  
     public abstract Map<String, String[]> getRequestParameterValuesMap();
 107  
 
 108  
     public abstract String getRequestPathInfo();
 109  
 
 110  
     public abstract String getRequestServletPath();
 111  
 
 112  
     public abstract java.net.URL getResource(String path)
 113  
             throws java.net.MalformedURLException;
 114  
 
 115  
     public abstract java.io.InputStream getResourceAsStream(String path);
 116  
 
 117  
     public abstract Set<String> getResourcePaths(String path);
 118  
 
 119  
     public abstract Object getResponse();
 120  
     
 121  
     /**
 122  
      * throws <code>UnsupportedOperationException</code> by default.
 123  
      * @since JSF 1.2
 124  
      */
 125  
     public String getResponseContentType()
 126  
     {
 127  0
         ExternalContext ctx = _firstInstance.get();
 128  
         
 129  0
         if (ctx == null)
 130  
         {
 131  0
             throw new UnsupportedOperationException();
 132  
         }
 133  
         
 134  0
         return ctx.getResponseContentType();
 135  
     }
 136  
 
 137  
     public abstract Object getSession(boolean create);
 138  
 
 139  
     public abstract Map<String, Object> getSessionMap();
 140  
 
 141  
     public abstract java.security.Principal getUserPrincipal();
 142  
 
 143  
     /**
 144  
      * throws <code>UnsupportedOperationException</code> by default.
 145  
      * @since JSF 1.2
 146  
      * @param request
 147  
      */
 148  
     public void setRequest(java.lang.Object request)
 149  
     {
 150  0
         ExternalContext ctx = _firstInstance.get();
 151  
         
 152  0
         if (ctx == null)
 153  
         {
 154  0
             throw new UnsupportedOperationException();
 155  
         }
 156  
         
 157  0
         ctx.setRequest(request);
 158  0
     }
 159  
     
 160  
     /**
 161  
      * throws <code>UnsupportedOperationException</code> by default.
 162  
      * @since JSF 1.2
 163  
      * @param encoding
 164  
      * @throws java.io.UnsupportedEncodingException
 165  
      */
 166  
     public void setRequestCharacterEncoding(java.lang.String encoding)
 167  
             throws java.io.UnsupportedEncodingException
 168  
     {
 169  0
         ExternalContext ctx = _firstInstance.get();
 170  
         
 171  0
         if (ctx == null)
 172  
         {
 173  0
             throw new UnsupportedOperationException();
 174  
         }
 175  
         
 176  0
         ctx.setRequestCharacterEncoding(encoding);
 177  0
     }
 178  
     
 179  
     /**
 180  
      * throws <code>UnsupportedOperationException</code> by default.
 181  
      * @since JSF 1.2
 182  
      * @param response
 183  
      */
 184  
     public void setResponse(java.lang.Object response)
 185  
     {
 186  0
         ExternalContext ctx = _firstInstance.get();
 187  
         
 188  0
         if (ctx == null)
 189  
         {
 190  0
             throw new UnsupportedOperationException();
 191  
         }
 192  
         
 193  0
         ctx.setResponse(response);
 194  0
     }
 195  
     
 196  
     /**
 197  
      * throws <code>UnsupportedOperationException</code> by default.
 198  
      * @since JSF 1.2
 199  
      * @param encoding
 200  
      */
 201  
     public void setResponseCharacterEncoding(java.lang.String encoding)
 202  
     {
 203  0
         ExternalContext ctx = _firstInstance.get();
 204  
         
 205  0
         if (ctx == null)
 206  
         {
 207  0
             throw new UnsupportedOperationException();
 208  
         }
 209  
         
 210  0
         ctx.setResponseCharacterEncoding(encoding);
 211  0
     }
 212  
     
 213  
     public String getResponseCharacterEncoding()
 214  
     {
 215  0
         ExternalContext ctx = _firstInstance.get();
 216  
         
 217  0
         if (ctx == null)
 218  
         {
 219  0
             throw new UnsupportedOperationException("JSF 1.2 : figure out how to tell if this is a Portlet request");
 220  
         }
 221  
         
 222  0
         return ctx.getResponseCharacterEncoding();
 223  
     }
 224  
     
 225  
     public abstract boolean isUserInRole(String role);
 226  
 
 227  
     public abstract void log(String message);
 228  
 
 229  
     public abstract void log(String message,
 230  
                              Throwable exception);
 231  
 
 232  
     public abstract void redirect(String url)
 233  
             throws java.io.IOException;
 234  
 }