svn commit: r1459650 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
Author: lukaszlenart Date: Fri Mar 22 07:22:45 2013 New Revision: 1459650 URL: http://svn.apache.org/r1459650 Log: WW-3997 Does small cleanup Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java?rev=1459650&r1=1459649&r2=1459650&view=diff == --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java Fri Mar 22 07:22:45 2013 @@ -336,8 +336,7 @@ public class DefaultActionMapper impleme * @param request The request * @param mapping The action mapping */ -public void handleSpecialParameters(HttpServletRequest request, -ActionMapping mapping) { +public void handleSpecialParameters(HttpServletRequest request, ActionMapping mapping) { // handle special parameter prefixes. Set uniqueParameters = new HashSet(); Map parameterMap = request.getParameterMap(); @@ -367,8 +366,7 @@ public class DefaultActionMapper impleme * @param uri The uri * @param mapping The action mapping to populate */ -protected void parseNameAndNamespace(String uri, ActionMapping mapping, - ConfigurationManager configManager) { +protected void parseNameAndNamespace(String uri, ActionMapping mapping, ConfigurationManager configManager) { String namespace, name; int lastSlash = uri.lastIndexOf("/"); if (lastSlash == -1) { @@ -411,7 +409,7 @@ public class DefaultActionMapper impleme } } -if (!allowSlashesInActionNames && name != null) { +if (!allowSlashesInActionNames) { int pos = name.lastIndexOf('/'); if (pos > -1 && pos < name.length() - 1) { name = name.substring(pos + 1);
svn commit: r1459657 - /struts/struts2/trunk/plugins/junit/pom.xml
Author: lukaszlenart Date: Fri Mar 22 07:53:07 2013 New Revision: 1459657 URL: http://svn.apache.org/r1459657 Log: WW-3778 Adds missing version tag Modified: struts/struts2/trunk/plugins/junit/pom.xml Modified: struts/struts2/trunk/plugins/junit/pom.xml URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/junit/pom.xml?rev=1459657&r1=1459656&r2=1459657&view=diff == --- struts/struts2/trunk/plugins/junit/pom.xml (original) +++ struts/struts2/trunk/plugins/junit/pom.xml Fri Mar 22 07:53:07 2013 @@ -71,6 +71,7 @@ org.apache.struts struts2-convention-plugin +${project.version} test
svn commit: r1459920 - in /struts/struts2/trunk/plugins/rest/src: main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java test/java/org/apache/struts2/rest/DefaultContentTypeHandlerMan
Author: lukaszlenart Date: Fri Mar 22 18:33:58 2013 New Revision: 1459920 URL: http://svn.apache.org/r1459920 Log: WW-3975 Adds logic to look for handler without specified charset Added: struts/struts2/trunk/plugins/rest/src/test/java/org/apache/struts2/rest/DefaultContentTypeHandlerManagerTest.java Modified: struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java Modified: struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java?rev=1459920&r1=1459919&r2=1459920&view=diff == --- struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java (original) +++ struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java Fri Mar 22 18:33:58 2013 @@ -78,24 +78,28 @@ public class DefaultContentTypeHandlerMa } } } - + /** * Gets the handler for the request by looking at the request content type and extension - * @param req The request + * @param request The request * @return The appropriate handler */ -public ContentTypeHandler getHandlerForRequest(HttpServletRequest req) { +public ContentTypeHandler getHandlerForRequest(HttpServletRequest request) { ContentTypeHandler handler = null; -String contentType = req.getContentType(); +String contentType = request.getContentType(); if (contentType != null) { - int index = contentType.indexOf(';'); - if( index != -1) - contentType = contentType.substring(0,index).trim(); handler = handlersByContentType.get(contentType); +if (handler == null) { +// strip off encoding and search again (e.g., application/json;charset=ISO-8859-1) +int index = contentType.indexOf(';'); +if (index != -1) { +contentType = contentType.substring(0, index).trim(); +} +handler = handlersByContentType.get(contentType); +} } - if (handler == null) { -String extension = findExtension(req.getRequestURI()); +String extension = findExtension(request.getRequestURI()); handler = handlersByExtension.get(extension); } return handler; Added: struts/struts2/trunk/plugins/rest/src/test/java/org/apache/struts2/rest/DefaultContentTypeHandlerManagerTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/rest/src/test/java/org/apache/struts2/rest/DefaultContentTypeHandlerManagerTest.java?rev=1459920&view=auto == --- struts/struts2/trunk/plugins/rest/src/test/java/org/apache/struts2/rest/DefaultContentTypeHandlerManagerTest.java (added) +++ struts/struts2/trunk/plugins/rest/src/test/java/org/apache/struts2/rest/DefaultContentTypeHandlerManagerTest.java Fri Mar 22 18:33:58 2013 @@ -0,0 +1,126 @@ +package org.apache.struts2.rest; + +import com.opensymphony.xwork2.XWorkTestCase; +import com.opensymphony.xwork2.inject.Container; +import com.opensymphony.xwork2.inject.Scope; +import org.apache.struts2.rest.handler.ContentTypeHandler; +import org.springframework.mock.web.MockHttpServletRequest; + +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +import java.util.HashSet; +import java.util.Set; + +public class DefaultContentTypeHandlerManagerTest extends XWorkTestCase { + +public void testObtainingHandlerForRequestWithEncoding() throws Exception { +// given +DefaultContentTypeHandlerManager handlerManager = new DefaultContentTypeHandlerManager(); +handlerManager.setContainer(new DummyContainer("application/json;charset=UTF-8", null)); + +MockHttpServletRequest request = new MockHttpServletRequest(); +request.setContentType("application/json;charset=UTF-8"); + +// when +ContentTypeHandler handler = handlerManager.getHandlerForRequest(request); + +// then +assertNotNull(handler); +assertEquals("application/json;charset=UTF-8", handler.getContentType()); +} + +public void testObtainingHandlerForRequestWithoutEncoding() throws Exception { +// given +DefaultContentTypeHandlerManager handlerManager = new DefaultContentTypeHandlerManager(); +handlerManager.setContainer(new DummyContainer("application/json", null)); + +MockHttpServletRequest request = new MockHttpServletRequest(); +request.setContentType("application/json;charset=UTF-8"); + +// when +Co
[CONF] Confluence Changes in the last 24 hours
This is a daily summary of all recent changes in Confluence. - Updated Spaces: - Apache ActiveMQ (https://cwiki.apache.org/confluence/display/ACTIVEMQ) Pages - How do I embed a Broker inside a Connection edited by jkorab (08:29 AM) https://cwiki.apache.org/confluence/display/ACTIVEMQ/How+do+I+embed+a+Broker+inside+a+Connection Apache Ambari (Incubating) (https://cwiki.apache.org/confluence/display/AMBARI) Pages - Releasing Ambari. edited by yusaku (06:20 PM) https://cwiki.apache.org/confluence/display/AMBARI/Releasing+Ambari. Adding a New Service as part of the Stack Definition created by yusaku (06:13 PM) https://cwiki.apache.org/confluence/display/AMBARI/Adding+a+New+Service+as+part+of+the+Stack+Definition Adding a New Service to an Existing Cluster edited by yusaku (06:13 PM) https://cwiki.apache.org/confluence/display/AMBARI/Adding+a+New+Service+to+an+Existing+Cluster Apache Camel (https://cwiki.apache.org/confluence/display/CAMEL) Pages - SQL Component edited by muellerc (05:52 PM) https://cwiki.apache.org/confluence/display/CAMEL/SQL+Component Apache Cloudstack (https://cwiki.apache.org/confluence/display/CLOUDSTACK) Pages - devcloud-kvm edited by rajesh.batt...@citrix.com (10:58 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/devcloud-kvm Release Notes created by jzb (06:49 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Release+Notes Internal Load Balancing between VPC tiers edited by alena1108 (06:28 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Internal+Load+Balancing+between+VPC+tiers nTier Apps 2.0 Functional Spec edited by alena1108 (06:28 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/nTier+Apps+2.0+Functional+Spec Events edited by jzb (06:06 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Events Black list of routes edited by alena1108 (01:15 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Black+list+of+routes FS for Granular Global Configuration Parameters edited by alena1108 (12:43 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+for+Granular+Global+Configuration+Parameters Change Account Membership - VM edited by likitha.she...@citrix.com (12:36 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Change+Account+Membership+-+VM How to build on master branch edited by tsp (10:43 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/How+to+build+on+master+branch configurable setting to use linked clones or full clones on VMware edited by prashantkm (06:11 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/configurable+setting+to+use+linked+clones+or+full+clones+on+VMware NAT on private gateway edited by jayapal (05:23 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/NAT+on+private+gateway Support ACL deny rules edited by kis...@cloud.com (01:22 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Support+ACL+deny+rules Apache CXF (https://cwiki.apache.org/confluence/display/CXF) Pages - DOSGi Apache Karaf Feature edited by christian schneider (10:24 AM) https://cwiki.apache.org/confluence/display/CXF/DOSGi+Apache+Karaf+Feature Apache Flex (https://cwiki.apache.org/confluence/display/FLEX) Pages - Git for Apache Flex Guide edited by e...@ixsoftware.nl (07:28 AM) https://cwiki.apache.org/confluence/display/FLEX/Git+for+Apache+Flex+Guide Tutorials and other resources edited by e...@ixsoftware.nl (07:10 AM) https://cwiki.apache.org/confluence/display/FLEX/Tutorials+and+other+resources Apache Mahout (https://cwiki.apache.org/confluence/display/MAHOUT) Pages - Data Mining as a Service (DMaaS) on Cloud for Mobile Business Intelligence created by sat_h...@hotmail.com (04:56 PM) https://cwiki.apache.org/confluence/display/MAHOUT/2013/03/22/Data+Mining+as+a+Service+%28DMaaS%29+on+Cloud+for+Mobile+Business+Intelligence OODT (https://cwiki.apache.org/confluence/display/OODT) Pages - OODT Filemgr User Guide edited by rlaidlaw (11:21 AM) https://cwiki.apache.org/confluence/display/OODT/OODT+Filemgr+User+Guide Apache OpenOffice Community (https://cwiki.apache.org/confluence/display/OOOUSERS) Pages - Documentation Volunteers edited by steve.v (03:12 PM) https://cwik