Coverage Report - org.mule.transport.http.multipart.MultipartConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
MultipartConfiguration
0%
0/20
0%
0/4
1.333
 
 1  
 /*
 2  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 3  
  *
 4  
  * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
 5  
  *
 6  
  * The contents of this file are subject to the terms of either the GNU
 7  
  * General Public License Version 2 only ("GPL") or the Common Development
 8  
  * and Distribution License("CDDL") (collectively, the "License").  You
 9  
  * may not use this file except in compliance with the License. You can obtain
 10  
  * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
 11  
  * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
 12  
  * language governing permissions and limitations under the License.
 13  
  *
 14  
  * When distributing the software, include this License Header Notice in each
 15  
  * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
 16  
  * Sun designates this particular file as subject to the "Classpath" exception
 17  
  * as provided by Sun in the GPL Version 2 section of the License file that
 18  
  * accompanied this code.  If applicable, add the following below the License
 19  
  * Header, with the fields enclosed by brackets [] replaced by your own
 20  
  * identifying information: "Portions Copyrighted [year]
 21  
  * [name of copyright owner]"
 22  
  *
 23  
  * Contributor(s):
 24  
  *
 25  
  * If you wish your version of this file to be governed by only the CDDL or
 26  
  * only the GPL Version 2, indicate your decision by adding "[Contributor]
 27  
  * elects to include this software in this distribution under the [CDDL or GPL
 28  
  * Version 2] license."  If you don't indicate a single choice of license, a
 29  
  * recipient has the option to distribute your version of this file under
 30  
  * either the CDDL, the GPL Version 2 or to extend the choice of license to
 31  
  * its licensees as provided above.  However, if you add GPL Version 2 code
 32  
  * and therefore, elected the GPL Version 2 license, then the option applies
 33  
  * only if the new code is made subject to such option by the copyright
 34  
  * holder.
 35  
  */
 36  
 package org.mule.transport.http.multipart;
 37  
 
 38  
 
 39  
 /**
 40  
  * Defines configuration object used to control how attachments are processed.
 41  
  *
 42  
  * This is an adaptation of the javax.servlet.MultipartConfigElement class introduced into the Servlet 3.0 specification.
 43  
  * The API has been kept that same but the package and class name has changed not to conflict with the Servlet spec.
 44  
  *
 45  
  * @since 3.0
 46  
  */
 47  
 public class MultipartConfiguration
 48  
 {
 49  
 
 50  
     private String location;
 51  
     private long maxFileSize;
 52  
     private long maxRequestSize;
 53  
     private int fileSizeThreshold;
 54  
 
 55  
     /**
 56  
      * Constructs an instance with defaults for all but location.
 57  
      *
 58  
      * @param location defualts to "" if values is null.
 59  
      */
 60  0
     public MultipartConfiguration(String location) {
 61  0
         if (location == null) {
 62  0
             this.location = "";
 63  
         } else
 64  0
             this.location = location;
 65  0
         this.maxFileSize = -1L;
 66  0
         this.maxRequestSize = -1L;
 67  0
         this.fileSizeThreshold = 0;
 68  0
     }
 69  
 
 70  
     /**
 71  
      * Constructs an instance with all values specified.
 72  
      *
 73  
      * @param location the directory location where files will be stored
 74  
      * @param maxFileSize the maximum size allowed for uploaded files
 75  
      * @param maxRequestSize the maximum size allowed for
 76  
      * multipart/form-data requests
 77  
      * @param fileSizeThreshold the size threshold after which files will
 78  
      * be written to disk
 79  
      */
 80  
     public MultipartConfiguration(String location, long maxFileSize,
 81  0
             long maxRequestSize, int fileSizeThreshold) {
 82  0
         if (location == null) {
 83  0
             this.location = "";
 84  
         } else
 85  0
             this.location = location;
 86  0
         this.maxFileSize = maxFileSize;
 87  0
         this.maxRequestSize = maxRequestSize;
 88  0
         this.fileSizeThreshold = fileSizeThreshold;
 89  0
     }
 90  
 
 91  
     /**
 92  
      * Gets the directory location where files will be stored.
 93  
      *
 94  
      * @return the directory location where files will be stored
 95  
      */
 96  
     public String getLocation() {
 97  0
         return this.location;
 98  
     }
 99  
 
 100  
     /**
 101  
      * Gets the maximum size allowed for uploaded files.
 102  
      *
 103  
      * @return the maximum size allowed for uploaded files
 104  
      */
 105  
     public long getMaxFileSize() {
 106  0
         return this.maxFileSize;
 107  
     }
 108  
 
 109  
     /**
 110  
      * Gets the maximum size allowed for multipart/form-data requests.
 111  
      *
 112  
      * @return the maximum size allowed for multipart/form-data requests
 113  
      */
 114  
     public long getMaxRequestSize() {
 115  0
         return this.maxRequestSize;
 116  
     }
 117  
 
 118  
     /**
 119  
      * Gets the size threshold after which files will be written to disk.
 120  
      *
 121  
      * @return the size threshold after which files will be written to disk
 122  
      */
 123  
     public int getFileSizeThreshold() {
 124  0
         return this.fileSizeThreshold;
 125  
     }
 126  
 }