[maven-release-plugin] copy for tag tobago-1.5.5
diff --git a/pom.xml b/pom.xml
index 4785624..878c49b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -484,7 +484,7 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>1.2</version>
+ <version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoMultipartFormdataRequest.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoMultipartFormdataRequest.java
index 4928473..ee64169 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoMultipartFormdataRequest.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoMultipartFormdataRequest.java
@@ -30,6 +30,7 @@
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.File;
import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
@@ -39,17 +40,15 @@
public class TobagoMultipartFormdataRequest extends HttpServletRequestWrapper {
- private static final Logger LOG
- = LoggerFactory.getLogger(TobagoMultipartFormdataRequest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TobagoMultipartFormdataRequest.class);
public static final long ONE_KB = 1024;
public static final long ONE_MB = ONE_KB * ONE_KB;
public static final long ONE_GB = ONE_KB * ONE_MB;
- private Map parameters;
+ private Map<String, String[]> parameters;
- private Map fileItems;
-
+ private Map<String, FileItem> fileItems;
public TobagoMultipartFormdataRequest(HttpServletRequest request) {
this(request, System.getProperty("java.io.tmpdir"), ONE_MB);
@@ -62,13 +61,12 @@
private void init(HttpServletRequest request, String repositoryPath, long maxSize) {
if (!ServletFileUpload.isMultipartContent(request)) {
- String errorText = "contentType is not multipart/form-data but '"
- + request.getContentType() + "'";
+ String errorText = "contentType is not multipart/form-data but '" + request.getContentType() + "'";
LOG.error(errorText);
throw new FacesException(errorText);
} else {
- parameters = new HashMap();
- fileItems = new HashMap();
+ parameters = new HashMap<String, String[]>();
+ fileItems = new HashMap<String, FileItem>();
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setRepository(new File(repositoryPath));
@@ -89,7 +87,7 @@
throw new FacesException(e);
}
if (LOG.isDebugEnabled()) {
- LOG.debug("parametercount = " + itemList.size());
+ LOG.debug("parametercount = " + itemList.size() + " + " + request.getParameterMap().size());
}
for (FileItem item : itemList) {
String key = item.getFieldName();
@@ -98,50 +96,56 @@
if (value.length() > 100) {
value = value.substring(0, 100) + " [...]";
}
- LOG.debug(
- "Parameter : '" + key + "'='" + value + "' isFormField="
- + item.isFormField() + " contentType='" + item.getContentType() + "'");
-
+ LOG.debug("Parameter: '" + key + "'='" + value + "' isFormField=" + item.isFormField()
+ + " contentType='" + item.getContentType() + "'");
}
if (item.isFormField()) {
- Object inStock = parameters.get(key);
- if (inStock == null) {
- String[] values;
- try {
- // TODO: enable configuration of 'accept-charset'
- values = new String[]{item.getString(AbstractUIPage.FORM_ACCEPT_CHARSET)};
- } catch (UnsupportedEncodingException e) {
- LOG.error("Caught: " + e.getMessage(), e);
- values = new String[]{item.getString()};
- }
- parameters.put(key, values);
- } else if (inStock instanceof String[]) { // double (or more) parameter
- String[] oldValues = (String[]) inStock;
- String[] values = new String[oldValues.length + 1];
- System.arraycopy(oldValues, 0, values, 0, oldValues.length);
- try {
- // TODO: enable configuration of 'accept-charset'
- values[oldValues.length] = item.getString(AbstractUIPage.FORM_ACCEPT_CHARSET);
- } catch (UnsupportedEncodingException e) {
- LOG.error("Caught: " + e.getMessage(), e);
- values[oldValues.length] = item.getString();
- }
- parameters.put(key, values);
- } else {
- LOG.error(
- "Program error. Unsupported class: "
- + inStock.getClass().getName());
+ String newValue;
+ try {
+ // TODO: enable configuration of 'accept-charset'
+ newValue = item.getString(AbstractUIPage.FORM_ACCEPT_CHARSET);
+ } catch (UnsupportedEncodingException e) {
+ LOG.error("Caught: " + e.getMessage(), e);
+ newValue = item.getString();
}
+
+ addParameter(key, newValue);
} else {
fileItems.put(key, item);
}
}
+
+ // merging the GET parameters:
+ Enumeration e = request.getParameterNames();
+ while(e.hasMoreElements()) {
+ final String name = (String) e.nextElement();
+ final String[] newValues = request.getParameterValues(name);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Parameter: '" + name + "'='" + Arrays.toString(newValues) + "' (GET)");
+ }
+ for (String newValue : newValues) {
+ addParameter(name, newValue);
+ }
+ }
}
}
+ private void addParameter(String key, String newValue) {
+ final String[] inStock = parameters.get(key);
+ final String[] values;
+ if (inStock == null) {
+ values = new String[]{newValue};
+ } else {
+ values = new String[inStock.length + 1];
+ System.arraycopy(inStock, 0, values, 0, inStock.length);
+ values[inStock.length] = newValue;
+ }
+ parameters.put(key, values);
+ }
+
public FileItem getFileItem(String key) {
if (fileItems != null) {
- return (FileItem) fileItems.get(key);
+ return fileItems.get(key);
}
return null;
}
diff --git a/tobago-example/tobago-example-demo/pom.xml b/tobago-example/tobago-example-demo/pom.xml
index 5df7e62..0236596 100644
--- a/tobago-example/tobago-example-demo/pom.xml
+++ b/tobago-example/tobago-example-demo/pom.xml
@@ -28,8 +28,8 @@
<description>Demonstration and documentation application.</description>
<properties>
- <openwebbeans.version>1.1.2</openwebbeans.version>
- <myfaces-extcdi.version>1.0.1</myfaces-extcdi.version>
+ <openwebbeans.version>1.1.3</openwebbeans.version>
+ <myfaces-extcdi.version>1.0.2</myfaces-extcdi.version>
</properties>
<build>
<finalName>tobago-example-demo</finalName>
diff --git a/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java b/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
index 10feb08..fbca5d2 100644
--- a/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
+++ b/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
@@ -55,6 +55,7 @@
UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent);
UIForm form = (UIForm) application.createComponent(UIForm.COMPONENT_TYPE);
+ form.setRendererType(RendererTypes.FORM);
form.setId(root.createUniqueId());
panel.getChildren().add(form);