Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 45020200D06 for ; Mon, 25 Sep 2017 19:32:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 43AAE1609B5; Mon, 25 Sep 2017 17:32:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DE1AB1609EC for ; Mon, 25 Sep 2017 19:32:09 +0200 (CEST) Received: (qmail 46738 invoked by uid 500); 25 Sep 2017 17:32:09 -0000 Mailing-List: contact notifications-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list notifications@commons.apache.org Received: (qmail 46729 invoked by uid 99); 25 Sep 2017 17:32:09 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Sep 2017 17:32:09 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 411C03A0E13 for ; Mon, 25 Sep 2017 17:32:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1018697 [14/14] - in /websites/production/commons/content/proper/commons-fileupload: ./ apidocs/ apidocs/org/apache/commons/fileupload/ apidocs/org/apache/commons/fileupload/class-use/ apidocs/org/apache/commons/fileupload/disk/ apidocs/or... Date: Mon, 25 Sep 2017 17:31:59 -0000 To: notifications@commons.apache.org From: britter@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170925173205.411C03A0E13@svn01-us-west.apache.org> archived-at: Mon, 25 Sep 2017 17:32:12 -0000 Added: websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/MockPortletActionRequest.html ============================================================================== --- websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/MockPortletActionRequest.html (added) +++ websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/MockPortletActionRequest.html Mon Sep 25 17:31:51 2017 @@ -0,0 +1,284 @@ + + + +MockPortletActionRequest xref + + + +
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one or more
+3    * contributor license agreements.  See the NOTICE file distributed with
+4    * this work for additional information regarding copyright ownership.
+5    * The ASF licenses this file to You under the Apache License, Version 2.0
+6    * (the "License"); you may not use this file except in compliance with
+7    * the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   * Unless required by applicable law or agreed to in writing, software
+12   * distributed under the License is distributed on an "AS IS" BASIS,
+13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   * See the License for the specific language governing permissions and
+15   * limitations under the License.
+16   */
+17  package org.apache.commons.fileupload.portlet;
+18  
+19  import java.io.BufferedReader;
+20  import java.io.ByteArrayInputStream;
+21  import java.io.IOException;
+22  import java.io.InputStream;
+23  import java.io.UnsupportedEncodingException;
+24  import java.security.Principal;
+25  import java.util.Arrays;
+26  import java.util.Collections;
+27  import java.util.Enumeration;
+28  import java.util.HashMap;
+29  import java.util.Hashtable;
+30  import java.util.Locale;
+31  import java.util.Map;
+32  
+33  import javax.portlet.ActionRequest;
+34  import javax.portlet.PortalContext;
+35  import javax.portlet.PortletMode;
+36  import javax.portlet.PortletPreferences;
+37  import javax.portlet.PortletSession;
+38  import javax.portlet.WindowState;
+39  
+40  import org.apache.commons.fileupload.FileUploadBase;
+41  
+42  /**
+43   * Mock class for tests. Implements an {@link ActionRequest}.
+44   *
+45   * @see PortletFileUploadTest
+46   * @since 1.4
+47   */
+48  @SuppressWarnings("rawtypes") // because of the portlet ActionRequest API does not use generics
+49  public class MockPortletActionRequest implements ActionRequest {
+50  
+51      private final Hashtable<String, Object> attributes = new Hashtable<String, Object>();
+52  
+53      private final Map<String, String> parameters = new HashMap<String, String>();
+54  
+55      private String characterEncoding;
+56      private int length;
+57      private final String contentType;
+58      private final InputStream requestData;
+59  
+60      public MockPortletActionRequest(final byte[] requestData, final String contentType) {
+61          this(new ByteArrayInputStream(requestData), requestData.length, contentType);
+62      }
+63  
+64      public MockPortletActionRequest(ByteArrayInputStream byteArrayInputStream, int requestLength, String contentType) {
+65          this.requestData = byteArrayInputStream;
+66          length = requestLength;
+67          this.contentType = contentType;
+68          attributes.put(FileUploadBase.CONTENT_TYPE, contentType);
+69      }
+70  
+71      @Override
+72      public Object getAttribute(String key) {
+73          return attributes.get(key);
+74      }
+75  
+76      @Override
+77      public Enumeration getAttributeNames() {
+78          return attributes.keys();
+79      }
+80  
+81      @Override
+82      public String getAuthType() {
+83          return null;
+84      }
+85  
+86      @Override
+87      public String getContextPath() {
+88          return null;
+89      }
+90  
+91      @Override
+92      public Locale getLocale() {
+93          return Locale.getDefault();
+94      }
+95  
+96      @Override
+97      public Enumeration getLocales() {
+98          return Collections.enumeration(Arrays.asList(Locale.getAvailableLocales()));
+99      }
+100 
+101     @Override
+102     public String getParameter(String key) {
+103         return parameters.get(key);
+104     }
+105 
+106     @Override
+107     public Map getParameterMap() {
+108         return Collections.unmodifiableMap(parameters);
+109     }
+110 
+111     @Override
+112     public Enumeration getParameterNames() {
+113         return Collections.enumeration(parameters.keySet());
+114     }
+115 
+116     @Override
+117     public String[] getParameterValues(String arg0) {
+118         return null;
+119     }
+120 
+121     @Override
+122     public PortalContext getPortalContext() {
+123         return null;
+124     }
+125 
+126     @Override
+127     public PortletMode getPortletMode() {
+128         return null;
+129     }
+130 
+131     @Override
+132     public PortletSession getPortletSession() {
+133         return null;
+134     }
+135 
+136     @Override
+137     public PortletSession getPortletSession(boolean arg0) {
+138         return null;
+139     }
+140 
+141     @Override
+142     public PortletPreferences getPreferences() {
+143         return null;
+144     }
+145 
+146     @Override
+147     public Enumeration getProperties(String arg0) {
+148         return null;
+149     }
+150 
+151     @Override
+152     public String getProperty(String arg0) {
+153         return null;
+154     }
+155 
+156     @Override
+157     public Enumeration getPropertyNames() {
+158         return null;
+159     }
+160 
+161     @Override
+162     public String getRemoteUser() {
+163         return null;
+164     }
+165 
+166     @Override
+167     public String getRequestedSessionId() {
+168         return null;
+169     }
+170 
+171     @Override
+172     public String getResponseContentType() {
+173         return null;
+174     }
+175 
+176     @Override
+177     public Enumeration getResponseContentTypes() {
+178         return null;
+179     }
+180 
+181     @Override
+182     public String getScheme() {
+183         return null;
+184     }
+185 
+186     @Override
+187     public String getServerName() {
+188         return null;
+189     }
+190 
+191     @Override
+192     public int getServerPort() {
+193         return 0;
+194     }
+195 
+196     @Override
+197     public Principal getUserPrincipal() {
+198         return null;
+199     }
+200 
+201     @Override
+202     public WindowState getWindowState() {
+203         return null;
+204     }
+205 
+206     @Override
+207     public boolean isPortletModeAllowed(PortletMode arg0) {
+208         return false;
+209     }
+210 
+211     @Override
+212     public boolean isRequestedSessionIdValid() {
+213         return false;
+214     }
+215 
+216     @Override
+217     public boolean isSecure() {
+218         return false;
+219     }
+220 
+221     @Override
+222     public boolean isUserInRole(String arg0) {
+223         return false;
+224     }
+225 
+226     @Override
+227     public boolean isWindowStateAllowed(WindowState arg0) {
+228         return false;
+229     }
+230 
+231     @Override
+232     public void removeAttribute(String key) {
+233         attributes.remove(key);
+234     }
+235 
+236     @Override
+237     public void setAttribute(String key, Object value) {
+238         attributes.put(key, value);
+239     }
+240 
+241     @Override
+242     public String getCharacterEncoding() {
+243         return characterEncoding;
+244     }
+245 
+246     @Override
+247     public int getContentLength() {
+248         return length;
+249     }
+250 
+251     @Override
+252     public String getContentType() {
+253         return contentType;
+254     }
+255 
+256     @Override
+257     public InputStream getPortletInputStream() throws IOException {
+258         return requestData;
+259     }
+260 
+261     @Override
+262     public BufferedReader getReader() throws UnsupportedEncodingException, IOException {
+263         return null;
+264     }
+265 
+266     @Override
+267     public void setCharacterEncoding(String characterEncoding) throws UnsupportedEncodingException {
+268         this.characterEncoding = characterEncoding;
+269     }
+270 
+271 }
+
+
+ + + \ No newline at end of file Added: websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/PortletFileUploadTest.html ============================================================================== --- websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/PortletFileUploadTest.html (added) +++ websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/PortletFileUploadTest.html Mon Sep 25 17:31:51 2017 @@ -0,0 +1,98 @@ + + + +PortletFileUploadTest xref + + + +
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one or more
+3    * contributor license agreements.  See the NOTICE file distributed with
+4    * this work for additional information regarding copyright ownership.
+5    * The ASF licenses this file to You under the Apache License, Version 2.0
+6    * (the "License"); you may not use this file except in compliance with
+7    * the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   * Unless required by applicable law or agreed to in writing, software
+12   * distributed under the License is distributed on an "AS IS" BASIS,
+13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   * See the License for the specific language governing permissions and
+15   * limitations under the License.
+16   */
+17  package org.apache.commons.fileupload.portlet;
+18  
+19  import static org.junit.Assert.assertEquals;
+20  import static org.junit.Assert.assertTrue;
+21  
+22  import java.util.List;
+23  import java.util.Map;
+24  
+25  import javax.portlet.ActionRequest;
+26  
+27  import org.apache.commons.fileupload.Constants;
+28  import org.apache.commons.fileupload.FileItem;
+29  import org.apache.commons.fileupload.FileUploadTest;
+30  import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+31  import org.junit.Before;
+32  import org.junit.Test;
+33  
+34  /**
+35   * Test for {@link PortletFileUpload}.
+36   *
+37   * @see FileUploadTest
+38   * @since 1.4
+39   */
+40  public class PortletFileUploadTest {
+41  
+42      private PortletFileUpload upload;
+43  
+44      @Before
+45      public void setUp() {
+46          upload = new PortletFileUpload(new DiskFileItemFactory());
+47      }
+48  
+49      @Test
+50      public void parseParameterMap()
+51              throws Exception {
+52          String text = "-----1234\r\n" +
+53                        "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" +
+54                        "Content-Type: text/whatever\r\n" +
+55                        "\r\n" +
+56                        "This is the content of the file\n" +
+57                        "\r\n" +
+58                        "-----1234\r\n" +
+59                        "Content-Disposition: form-data; name=\"field\"\r\n" +
+60                        "\r\n" +
+61                        "fieldValue\r\n" +
+62                        "-----1234\r\n" +
+63                        "Content-Disposition: form-data; name=\"multi\"\r\n" +
+64                        "\r\n" +
+65                        "value1\r\n" +
+66                        "-----1234\r\n" +
+67                        "Content-Disposition: form-data; name=\"multi\"\r\n" +
+68                        "\r\n" +
+69                        "value2\r\n" +
+70                        "-----1234--\r\n";
+71          byte[] bytes = text.getBytes("US-ASCII");
+72          ActionRequest request = new MockPortletActionRequest(bytes, Constants.CONTENT_TYPE);
+73  
+74          Map<String, List<FileItem>> mappedParameters = upload.parseParameterMap(request);
+75          assertTrue(mappedParameters.containsKey("file"));
+76          assertEquals(1, mappedParameters.get("file").size());
+77  
+78          assertTrue(mappedParameters.containsKey("field"));
+79          assertEquals(1, mappedParameters.get("field").size());
+80  
+81          assertTrue(mappedParameters.containsKey("multi"));
+82          assertEquals(2, mappedParameters.get("multi").size());
+83      }
+84  
+85  }
+
+
+ + + \ No newline at end of file Added: websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/package-frame.html ============================================================================== --- websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/package-frame.html (added) +++ websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/package-frame.html Mon Sep 25 17:31:51 2017 @@ -0,0 +1,27 @@ + + + + + + Apache Commons FileUpload 1.4-SNAPSHOT Reference Package org.apache.commons.fileupload.portlet + + + + +

+ org.apache.commons.fileupload.portlet +

+ +

Classes

+ + + + + \ No newline at end of file Added: websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/package-summary.html ============================================================================== --- websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/package-summary.html (added) +++ websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/portlet/package-summary.html Mon Sep 25 17:31:51 2017 @@ -0,0 +1,74 @@ + + + + + + Apache Commons FileUpload 1.4-SNAPSHOT Reference Package org.apache.commons.fileupload.portlet + + + +
+ +
+
+ +
+ +

Package org.apache.commons.fileupload.portlet

+ + + + + + + + + + + + + + + +
Class Summary
+ MockPortletActionRequest +
+ PortletFileUploadTest +
+ +
+ +
+
+ +
+
+ + + \ No newline at end of file Added: websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/servlet/ServletFileUploadTest.html ============================================================================== --- websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/servlet/ServletFileUploadTest.html (added) +++ websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/servlet/ServletFileUploadTest.html Mon Sep 25 17:31:51 2017 @@ -0,0 +1,101 @@ + + + +ServletFileUploadTest xref + + + +
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one or more
+3    * contributor license agreements.  See the NOTICE file distributed with
+4    * this work for additional information regarding copyright ownership.
+5    * The ASF licenses this file to You under the Apache License, Version 2.0
+6    * (the "License"); you may not use this file except in compliance with
+7    * the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   * Unless required by applicable law or agreed to in writing, software
+12   * distributed under the License is distributed on an "AS IS" BASIS,
+13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   * See the License for the specific language governing permissions and
+15   * limitations under the License.
+16   */
+17  package org.apache.commons.fileupload.servlet;
+18  
+19  import static org.junit.Assert.assertEquals;
+20  import static org.junit.Assert.assertTrue;
+21  
+22  import java.util.List;
+23  import java.util.Map;
+24  
+25  import javax.servlet.http.HttpServletRequest;
+26  
+27  import org.apache.commons.fileupload.Constants;
+28  import org.apache.commons.fileupload.FileItem;
+29  import org.apache.commons.fileupload.MockHttpServletRequest;
+30  import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+31  import org.junit.Before;
+32  import org.junit.Test;
+33  
+34  /**
+35   * Test for {@link ServletFileUpload}.
+36   *
+37   * @see FileUploadTest
+38   * @since 1.4
+39   */
+40  public class ServletFileUploadTest {
+41  
+42      private ServletFileUpload upload;
+43  
+44      @Before
+45      public void setUp() {
+46          upload = new ServletFileUpload(new DiskFileItemFactory());
+47      }
+48  
+49      /**
+50       * Test case for <a href="http://issues.apache.org/jira/browse/FILEUPLOAD-210">
+51       */
+52      @Test
+53      public void parseParameterMap()
+54              throws Exception {
+55          String text = "-----1234\r\n" +
+56                        "Content-Disposition: form-data; name=\"file\"; filename=\"foo.tab\"\r\n" +
+57                        "Content-Type: text/whatever\r\n" +
+58                        "\r\n" +
+59                        "This is the content of the file\n" +
+60                        "\r\n" +
+61                        "-----1234\r\n" +
+62                        "Content-Disposition: form-data; name=\"field\"\r\n" +
+63                        "\r\n" +
+64                        "fieldValue\r\n" +
+65                        "-----1234\r\n" +
+66                        "Content-Disposition: form-data; name=\"multi\"\r\n" +
+67                        "\r\n" +
+68                        "value1\r\n" +
+69                        "-----1234\r\n" +
+70                        "Content-Disposition: form-data; name=\"multi\"\r\n" +
+71                        "\r\n" +
+72                        "value2\r\n" +
+73                        "-----1234--\r\n";
+74          byte[] bytes = text.getBytes("US-ASCII");
+75          HttpServletRequest request = new MockHttpServletRequest(bytes, Constants.CONTENT_TYPE);
+76  
+77          Map<String, List<FileItem>> mappedParameters = upload.parseParameterMap(request);
+78          assertTrue(mappedParameters.containsKey("file"));
+79          assertEquals(1, mappedParameters.get("file").size());
+80  
+81          assertTrue(mappedParameters.containsKey("field"));
+82          assertEquals(1, mappedParameters.get("field").size());
+83  
+84          assertTrue(mappedParameters.containsKey("multi"));
+85          assertEquals(2, mappedParameters.get("multi").size());
+86      }
+87  
+88  }
+
+
+ + + \ No newline at end of file Added: websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/servlet/package-frame.html ============================================================================== --- websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/servlet/package-frame.html (added) +++ websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/servlet/package-frame.html Mon Sep 25 17:31:51 2017 @@ -0,0 +1,24 @@ + + + + + + Apache Commons FileUpload 1.4-SNAPSHOT Reference Package org.apache.commons.fileupload.servlet + + + + +

+ org.apache.commons.fileupload.servlet +

+ +

Classes

+ + + + + \ No newline at end of file Added: websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/servlet/package-summary.html ============================================================================== --- websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/servlet/package-summary.html (added) +++ websites/production/commons/content/proper/commons-fileupload/xref-test/org/apache/commons/fileupload/servlet/package-summary.html Mon Sep 25 17:31:51 2017 @@ -0,0 +1,69 @@ + + + + + + Apache Commons FileUpload 1.4-SNAPSHOT Reference Package org.apache.commons.fileupload.servlet + + + +
+ +
+
+ +
+ +

Package org.apache.commons.fileupload.servlet

+ + + + + + + + + + + + +
Class Summary
+ ServletFileUploadTest +
+ +
+ +
+
+ +
+
+ + + \ No newline at end of file Modified: websites/production/commons/content/proper/commons-fileupload/xref-test/overview-frame.html ============================================================================== --- websites/production/commons/content/proper/commons-fileupload/xref-test/overview-frame.html (original) +++ websites/production/commons/content/proper/commons-fileupload/xref-test/overview-frame.html Mon Sep 25 17:31:51 2017 @@ -19,6 +19,12 @@ org.apache.commons.fileupload
  • + org.apache.commons.fileupload.portlet +
  • +
  • + org.apache.commons.fileupload.servlet +
  • +
  • org.apache.commons.fileupload.util.mime
  • Modified: websites/production/commons/content/proper/commons-fileupload/xref-test/overview-summary.html ============================================================================== --- websites/production/commons/content/proper/commons-fileupload/xref-test/overview-summary.html (original) +++ websites/production/commons/content/proper/commons-fileupload/xref-test/overview-summary.html Mon Sep 25 17:31:51 2017 @@ -40,6 +40,16 @@ + org.apache.commons.fileupload.portlet + + + + + org.apache.commons.fileupload.servlet + + + + org.apache.commons.fileupload.util.mime