Clover coverage report - Code Coverage for tapestry-portlet release 4.0.1
Coverage timestamp: Fri Mar 31 2006 09:14:58 EST
file stats: LOC: 61   Methods: 2
NCLOC: 29   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PortletMultipartDecoderFilter.java 0% 0% 0% 0%
coverage
 1    // Copyright 2006 The Apache Software Foundation
 2    //
 3    // Licensed under the Apache License, Version 2.0 (the "License");
 4    // you may not use this file except in compliance with the License.
 5    // You may obtain a copy of the License at
 6    //
 7    // http://www.apache.org/licenses/LICENSE-2.0
 8    //
 9    // Unless required by applicable law or agreed to in writing, software
 10    // distributed under the License is distributed on an "AS IS" BASIS,
 11    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    // See the License for the specific language governing permissions and
 13    // limitations under the License.
 14    package org.apache.tapestry.portlet.multipart;
 15   
 16    import java.io.IOException;
 17   
 18    import javax.portlet.ActionRequest;
 19    import javax.portlet.ActionResponse;
 20    import javax.portlet.PortletException;
 21   
 22    import org.apache.tapestry.portlet.ActionRequestServicer;
 23    import org.apache.tapestry.portlet.ActionRequestServicerFilter;
 24   
 25    /**
 26    * @author Raphael Jean
 27    *
 28    */
 29    public class PortletMultipartDecoderFilter implements ActionRequestServicerFilter
 30    {
 31    private PortletMultipartDecoder _decoder;
 32   
 33  0 public void service(ActionRequest request, ActionResponse response,
 34    ActionRequestServicer servicer) throws IOException, PortletException
 35    {
 36  0 String contentType = request.getContentType();
 37   
 38    // contentType is occasionally null in testing. The browser tacks on additional
 39    // information onto the contentType to indicate where the boundaries are in
 40    // the stream.
 41   
 42  0 boolean encoded = contentType != null && contentType.startsWith("multipart/form-data");
 43   
 44  0 try
 45    {
 46  0 ActionRequest newRequest = encoded ? _decoder.decode(request) : request;
 47   
 48  0 servicer.service(newRequest, response);
 49    }
 50    finally
 51    {
 52  0 if (encoded)
 53  0 _decoder.cleanup();
 54    }
 55    }
 56   
 57  0 public void setDecoder(PortletMultipartDecoder decoder) {
 58  0 this._decoder = decoder;
 59    }
 60   
 61    }