Coverage Report - org.apache.myfaces.spi.impl.DefaultWebConfigProvider
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultWebConfigProvider
0%
0/9
0%
0/2
1.5
 
 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 org.apache.myfaces.spi.impl;
 20  
 
 21  
 import java.util.ArrayList;
 22  
 import java.util.List;
 23  
 
 24  
 import javax.faces.context.ExternalContext;
 25  
 
 26  
 import org.apache.myfaces.shared_impl.webapp.webxml.WebXml;
 27  
 import org.apache.myfaces.spi.ServletMapping;
 28  
 import org.apache.myfaces.spi.WebConfigProvider;
 29  
 
 30  
 /**
 31  
  * The default WebXmlProvider implementation.
 32  
  *
 33  
  * This impl uses the WebXmlParser to create a new instance of WebXmlImpl.
 34  
  *
 35  
  * @author Jakob Korherr
 36  
  */
 37  0
 public class DefaultWebConfigProvider extends WebConfigProvider
 38  
 {
 39  
 
 40  
     @Override
 41  
     public List<ServletMapping> getFacesServletMappings(
 42  
             ExternalContext externalContext)
 43  
     {
 44  0
         WebXml webXml = WebXml.getWebXml(externalContext);
 45  
        
 46  0
         List mapping = webXml.getFacesServletMappings();
 47  
      
 48  
         // In MyFaces 2.0, getFacesServletMappins is used only at startup
 49  
         // time, so we don't need to cache this result.
 50  0
         List<ServletMapping> mappingList = new ArrayList<ServletMapping>(mapping.size());
 51  
         
 52  0
         for (int i = 0; i < mapping.size(); i++)
 53  
         {
 54  0
             org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping delegateMapping = 
 55  
                 (org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping) mapping.get(i);
 56  
             
 57  0
             mappingList.add(new ServletMappingImpl(delegateMapping));
 58  
         }
 59  0
         return mappingList;
 60  
     }
 61  
 
 62  
     @Override
 63  
     public boolean isErrorPagePresent(ExternalContext externalContext)
 64  
     {
 65  0
         return WebXml.getWebXml(externalContext).isErrorPagePresent();
 66  
     }
 67  
 
 68  
 }