You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2012/10/01 08:42:02 UTC
git commit: Revert "WICKET-4715 WebApplication doesn't recognize if
an incoming request is multipart."
Updated Branches:
refs/heads/wicket-1.5.x 16d6713c5 -> 3152da4f3
Revert "WICKET-4715 WebApplication doesn't recognize if an incoming request is multipart."
This reverts commit 3d80d9a8824e858df9b6427d55261286402139f4.
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/3152da4f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/3152da4f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/3152da4f
Branch: refs/heads/wicket-1.5.x
Commit: 3152da4f3de8106da6d8fd89a422c5c513117f03
Parents: 16d6713
Author: svenmeier <sv...@apache.org>
Authored: Mon Oct 1 08:28:56 2012 +0200
Committer: svenmeier <sv...@apache.org>
Committed: Mon Oct 1 08:28:56 2012 +0200
----------------------------------------------------------------------
.../org/apache/wicket/markup/html/form/Form.java | 9 +--
.../wicket/protocol/http/WebApplication.java | 19 ------
.../protocol/http/MultiPartTestApplication.java | 49 ---------------
.../http/servlet/ServletWebRequestTest.java | 22 -------
4 files changed, 2 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/3152da4f/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
index 6ed988a..d41d4ae 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
@@ -147,11 +147,6 @@ public class Form<T> extends WebMarkupContainer implements IFormSubmitListener
private static final String HIDDEN_DIV_START = "<div style=\"width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden\">";
/**
- * The value of HTMLFormElement's <code>enctype</code> attribute needed for file uploading.
- */
- public static final String ENCTYPE_MULTIPART_FORM_DATA = "multipart/form-data";
-
- /**
* Visitor used for validation
*
* @author Igor Vaynberg (ivaynberg)
@@ -1532,7 +1527,7 @@ public class Form<T> extends WebMarkupContainer implements IFormSubmitListener
tag.put("method", METHOD_POST.toLowerCase(Locale.ENGLISH));
}
- tag.put("enctype", ENCTYPE_MULTIPART_FORM_DATA);
+ tag.put("enctype", "multipart/form-data");
//
// require the application-encoding for multipart/form-data to be sure to
// get multipart-uploaded characters with the proper encoding on the following
@@ -1547,7 +1542,7 @@ public class Form<T> extends WebMarkupContainer implements IFormSubmitListener
{
// sanity check
String enctype = (String)tag.getAttributes().get("enctype");
- if (ENCTYPE_MULTIPART_FORM_DATA.equalsIgnoreCase(enctype))
+ if ("multipart/form-data".equalsIgnoreCase(enctype))
{
// though not set explicitly in Java, this is a multipart
// form
http://git-wip-us.apache.org/repos/asf/wicket/blob/3152da4f/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
index 397370c..6e0ba20 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
@@ -35,7 +35,6 @@ import org.apache.wicket.markup.MarkupType;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.AutoLabelResolver;
import org.apache.wicket.markup.html.form.AutoLabelTextResolver;
-import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.pages.AccessDeniedPage;
import org.apache.wicket.markup.html.pages.InternalErrorPage;
import org.apache.wicket.markup.html.pages.PageExpiredErrorPage;
@@ -73,7 +72,6 @@ import org.apache.wicket.util.lang.Args;
import org.apache.wicket.util.lang.PackageName;
import org.apache.wicket.util.string.Strings;
import org.apache.wicket.util.time.Duration;
-import org.apache.wicket.util.upload.FileUploadException;
import org.apache.wicket.util.watch.IModificationWatcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -453,23 +451,6 @@ public abstract class WebApplication extends Application
WebRequest webRequest = newWebRequest(servletRequest, filterPath);
- String contentType = servletRequest.getContentType();
- String method = servletRequest.getMethod();
-
- if (webRequest instanceof ServletWebRequest && Form.METHOD_POST.equalsIgnoreCase(method) &&
- Strings.isEmpty(contentType) == false && contentType.toLowerCase().startsWith(Form.ENCTYPE_MULTIPART_FORM_DATA))
- {
- try
- {
- return ((ServletWebRequest)webRequest).newMultipartWebRequest(
- getApplicationSettings().getDefaultMaximumUploadSize(), "externalForm");
- }
- catch (FileUploadException e)
- {
- throw new RuntimeException(e);
- }
- }
-
return webRequest;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/3152da4f/wicket-core/src/test/java/org/apache/wicket/protocol/http/MultiPartTestApplication.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/protocol/http/MultiPartTestApplication.java b/wicket-core/src/test/java/org/apache/wicket/protocol/http/MultiPartTestApplication.java
deleted file mode 100644
index 6805d76..0000000
--- a/wicket-core/src/test/java/org/apache/wicket/protocol/http/MultiPartTestApplication.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.protocol.http;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.request.http.WebRequest;
-import org.apache.wicket.util.tester.DummyHomePage;
-
-/**
- * An extension of WebApplication just to make its #createWebRequest() public
- */
-public class MultiPartTestApplication extends WebApplication
-{
- /**
- * Extend #createWebRequest() just to make it public
- * @param servletRequest
- * the current HTTP Sservlet request
- * @param filterPath
- * the filter mapping read from web.xml
- * @return
- */
- @Override
- public WebRequest createWebRequest(HttpServletRequest servletRequest, String filterPath)
- {
- return super.createWebRequest(servletRequest, filterPath);
- }
-
- @Override
- public Class<? extends Page> getHomePage()
- {
- return DummyHomePage.class;
- }
-};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/3152da4f/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java b/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
index e12dbca..fdfd171 100644
--- a/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
@@ -22,8 +22,6 @@ import org.apache.wicket.MarkupContainer;
import org.apache.wicket.Page;
import org.apache.wicket.markup.IMarkupResourceStreamProvider;
import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.protocol.http.MultiPartTestApplication;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.mock.MockHttpServletRequest;
import org.apache.wicket.request.Url;
@@ -135,26 +133,6 @@ public class ServletWebRequestTest extends Assert
tester.startPage(new CustomRequestPage());
}
- /**
- * https://issues.apache.org/jira/browse/WICKET-4715
- */
- @Test
- public void multiPartWebRequest()
- {
- MultiPartTestApplication application = new MultiPartTestApplication();
- new WicketTester(application); // inits the app
-
- MockHttpServletRequest httpRequest = new MockHttpServletRequest(null, null, null);
- httpRequest.setURL("/");
- httpRequest.setParameter("some", "parameter");
- httpRequest.setMethod(Form.METHOD_POST);
- httpRequest.setUseMultiPartContentType(true);
-
- WebRequest webRequest = application.createWebRequest(httpRequest, "/");
- assertTrue(webRequest instanceof MultipartServletWebRequest);
- }
-
-
private static class CustomRequestPage extends WebPage implements IMarkupResourceStreamProvider
{
private static final long serialVersionUID = 1L;