Coverage Report - org.apache.myfaces.shared.renderkit.html.util.HttpPartWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
HttpPartWrapper
0%
0/35
N/A
1.647
 
 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.shared.renderkit.html.util;
 20  
 
 21  
 import java.io.IOException;
 22  
 import java.io.InputStream;
 23  
 import java.lang.reflect.InvocationTargetException;
 24  
 import java.lang.reflect.Method;
 25  
 import java.util.Collection;
 26  
 import javax.faces.FacesException;
 27  
 import javax.faces.FacesWrapper;
 28  
 import javax.faces.component.StateHolder;
 29  
 import javax.faces.context.FacesContext;
 30  
 import javax.servlet.http.Part;
 31  
 
 32  0
 public class HttpPartWrapper implements Part, FacesWrapper<Part>, StateHolder
 33  
 {
 34  
     private Part delegate;
 35  
 
 36  
     public HttpPartWrapper()
 37  0
     {
 38  0
     }
 39  
     
 40  
     public HttpPartWrapper(Part delegate)
 41  0
     {
 42  0
         this.delegate = delegate;
 43  0
     }
 44  
 
 45  
     public void delete() throws IOException
 46  
     {
 47  0
         getWrapped().delete();
 48  0
     }
 49  
 
 50  
     public String getContentType()
 51  
     {
 52  0
         return getWrapped().getContentType();
 53  
     }
 54  
 
 55  
     public String getHeader(String headerName)
 56  
     {
 57  0
         return getWrapped().getHeader(headerName);
 58  
     }
 59  
 
 60  
     public Collection<String> getHeaderNames()
 61  
     {
 62  0
         return getWrapped().getHeaderNames();
 63  
     }
 64  
 
 65  
     public Collection<String> getHeaders(String headerName)
 66  
     {
 67  0
         return getWrapped().getHeaders(headerName);
 68  
     }
 69  
 
 70  
     public InputStream getInputStream() throws IOException
 71  
     {
 72  0
         return getWrapped().getInputStream();
 73  
     }
 74  
 
 75  
     public String getName()
 76  
     {
 77  0
         return getWrapped().getName();
 78  
     }
 79  
 
 80  
     public long getSize()
 81  
     {
 82  0
         return getWrapped().getSize();
 83  
     }
 84  
 
 85  
     public void write(String fileName) throws IOException
 86  
     {
 87  0
         getWrapped().write(fileName);
 88  0
     }
 89  
     
 90  
     public String getSubmittedFileName()
 91  
     {
 92  0
         Part wrapped = getWrapped();
 93  
         try
 94  
         {
 95  0
             Method m = wrapped.getClass().getMethod("getSubmittedFileName");
 96  0
             return (String) m.invoke(wrapped);
 97  
         }
 98  0
         catch (NoSuchMethodException ex)
 99  
         {
 100  0
             throw new FacesException(ex);
 101  
         }
 102  0
         catch (SecurityException ex)
 103  
         {
 104  0
             throw new FacesException(ex);
 105  
         } 
 106  0
         catch (IllegalAccessException ex)
 107  
         {
 108  0
             throw new FacesException(ex);
 109  
         } 
 110  0
         catch (IllegalArgumentException ex)
 111  
         {
 112  0
             throw new FacesException(ex);
 113  
         }
 114  0
         catch (InvocationTargetException ex)
 115  
         {
 116  0
             throw new FacesException(ex);
 117  
         }
 118  
     }
 119  
 
 120  
     public Object saveState(FacesContext context)
 121  
     {
 122  0
         return null;
 123  
     }
 124  
 
 125  
     public void restoreState(FacesContext context, Object state)
 126  
     {
 127  0
     }
 128  
 
 129  
     public boolean isTransient()
 130  
     {
 131  0
         return true;
 132  
     }
 133  
 
 134  
     public void setTransient(boolean newTransientValue)
 135  
     {
 136  0
     }
 137  
 
 138  
     public Part getWrapped()
 139  
     {
 140  0
         return delegate;
 141  
     }
 142  
     
 143  
 }