svn commit: r1434896 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
Author: lukaszlenart Date: Thu Jan 17 20:22:32 2013 New Revision: 1434896 URL: http://svn.apache.org/viewvc?rev=1434896&view=rev Log: WW-3965 solves problem with double bang in generated URI 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=1434896&r1=1434895&r2=1434896&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 Thu Jan 17 20:22:32 2013 @@ -163,19 +163,13 @@ import java.util.Set; public class DefaultActionMapper implements ActionMapper { protected static final String METHOD_PREFIX = "method:"; - protected static final String ACTION_PREFIX = "action:"; - protected static final String REDIRECT_PREFIX = "redirect:"; - protected static final String REDIRECT_ACTION_PREFIX = "redirectAction:"; protected boolean allowDynamicMethodCalls = true; - protected boolean allowSlashesInActionNames = false; - protected boolean alwaysSelectFullNamespace = false; - protected PrefixTrie prefixTrie = null; protected List extensions = new ArrayList() {{ @@ -292,12 +286,15 @@ public class DefaultActionMapper impleme return parseActionName(mapping); } +public boolean isSlashesInActionNames() { +return allowSlashesInActionNames; +} + /* * (non-Javadoc) * * @see org.apache.struts2.dispatcher.mapper.ActionMapper#getMapping(javax.servlet.http.HttpServletRequest) */ - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { ActionMapping mapping = new ActionMapping(); @@ -440,7 +437,7 @@ public class DefaultActionMapper impleme * * @param name The action name * @return The action name without its extension - * @deprecated Since 2.1, use {@link #dropExtension(java.lang.String,org.apache.struts2.dispatcher.mapper.ActionMapping)} instead + * @deprecated Since 2.1, use {@link #dropExtension(java.lang.String, org.apache.struts2.dispatcher.mapper.ActionMapping)} instead */ protected String dropExtension(String name) { return dropExtension(name, new ActionMapping()); @@ -517,29 +514,64 @@ public class DefaultActionMapper impleme * * @see org.apache.struts2.dispatcher.mapper.ActionMapper#getUriFromActionMapping(org.apache.struts2.dispatcher.mapper.ActionMapping) */ - public String getUriFromActionMapping(ActionMapping mapping) { StringBuilder uri = new StringBuilder(); +handleNamespace(mapping, uri); +handleName(mapping, uri); +handleDynamicMethod(mapping, uri); +handleExtension(mapping, uri); +handleParams(mapping, uri); + +return uri.toString(); +} + +protected void handleNamespace(ActionMapping mapping, StringBuilder uri) { if (mapping.getNamespace() != null) { uri.append(mapping.getNamespace()); if (!"/".equals(mapping.getNamespace())) { uri.append("/"); } } +} + +protected void handleName(ActionMapping mapping, StringBuilder uri) { String name = mapping.getName(); -String params = ""; if (name.indexOf('?') != -1) { -params = name.substring(name.indexOf('?')); name = name.substring(0, name.indexOf('?')); } uri.append(name); +} -if (null != mapping.getMethod() && !"".equals(mapping.getMethod())) { -uri.append("!").append(mapping.getMethod()); +protected void handleDynamicMethod(ActionMapping mapping, StringBuilder uri) { +// See WW-3965 +if (StringUtils.isNotEmpty(mapping.getMethod())) { +if (allowDynamicMethodCalls) { +// handle "name!method" convention. +String name = mapping.getName(); +if (!name.contains("!")) { +// Append the method as no bang found +uri.append("!").append(mapping.getMethod()); +} +} else { +uri.append("!").append(mapping.getMethod()); +} } +} + +protected void handleExtension(ActionMapping mapping, StringBuilder uri) { +String extension = lookupExtension(mapping.getExtension()); -String extension = mapping.getExtension(); +if (extension != null) { +if (extension.length() == 0 || (extension.l
[CONF] Confluence Changes in the last 24 hours
This is a daily summary of all recent changes in Confluence. - Updated Spaces: - Apache Airavata (https://cwiki.apache.org/confluence/display/AIRAVATA) Pages - ODI edited by raminder (04:52 PM) https://cwiki.apache.org/confluence/display/AIRAVATA/ODI Apache Ambari (Incubating) (https://cwiki.apache.org/confluence/display/AMBARI) Pages - Technology Stack created by yusaku (02:10 AM) https://cwiki.apache.org/confluence/display/AMBARI/Technology+Stack Ambari Design edited by yusaku (02:14 AM) https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Design Apache Camel (https://cwiki.apache.org/confluence/display/CAMEL) Pages - Camel 3.0 - Roadmap created by hadr...@apache.org (08:58 PM) https://cwiki.apache.org/confluence/display/CAMEL/Camel+3.0+-+Roadmap Camel 3.0 - Ideas edited by hadr...@apache.org (08:44 PM) https://cwiki.apache.org/confluence/display/CAMEL/Camel+3.0+-+Ideas Camel 2.7.0 drops support for java 1.5 edited by hadr...@apache.org (08:44 PM) https://cwiki.apache.org/confluence/display/CAMEL/2011/02/09/Camel+2.7.0+drops+support+for+java+1.5 Camel riders to discontinue support for 1.x branch edited by hadr...@apache.org (08:44 PM) https://cwiki.apache.org/confluence/display/CAMEL/2010/09/28/Camel+riders+to+discontinue+support+for+1.x+branch Help us by taking the Camel Survey! edited by hadr...@apache.org (08:44 PM) https://cwiki.apache.org/confluence/display/CAMEL/2010/10/06/Help+us+by+taking+the+Camel+Survey%21 Camel 2.7 - Roadmap edited by hadr...@apache.org (08:43 PM) https://cwiki.apache.org/confluence/display/CAMEL/Camel+2.7+-+Roadmap SQL Component edited by davsclaus (03:00 PM) https://cwiki.apache.org/confluence/display/CAMEL/SQL+Component Camel 2.11.0 Release edited by davsclaus (09:54 AM) https://cwiki.apache.org/confluence/display/CAMEL/Camel+2.11.0+Release Batch Consumer edited by davsclaus (08:16 AM) https://cwiki.apache.org/confluence/display/CAMEL/Batch+Consumer Apache Cloudstack (https://cwiki.apache.org/confluence/display/CLOUDSTACK) Pages - How to build on master branch edited by edison (10:07 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/How+to+build+on+master+branch IPv6 support edited by yasker (09:27 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/IPv6+support API Request Throttling edited by minc (06:54 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/API+Request+Throttling Mailing List Guidelines edited by topcloud (06:12 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Mailing+List+Guidelines UI Automation using Selenium and Python created by parth (05:06 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/UI+Automation+using+Selenium+and+Python FS Investigate and add back KVM snapshot support edited by fangw (02:31 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+Investigate+and+add+back+KVM+snapshot+support Dedicated Resources - Private pod, cluster, host Functional Spec edited by deeptidohare (02:25 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dedicated+Resources+-+Private+pod%2C+cluster%2C+host+Functional+Spec Draft - CloudStack Community Events Plan edited by mrhinkle (01:39 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Draft+-+CloudStack+Community+Events+Plan Site-to-site VPN edited by yasker (01:24 PM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Site-to-site+VPN Migrate Volume (Storage Motion) - Sequence diagram (Draft) created by devdeep (11:58 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Migrate+Volume+%28Storage+Motion%29+-+Sequence+diagram+%28Draft%29 Storage subsystem 2.0 edited by devdeep (11:56 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Storage+subsystem+2.0 FS - IP Range Reservation within a Network edited by saksham (10:03 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+-+IP+Range+Reservation+within+a+Network Hyper-V 2012 (3.0) Support edited by dlafferty (07:08 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Hyper-V+2012+%283.0%29+Support Multiple Ip ranges FS edited by bharat.kumar (04:15 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Multiple+Ip+ranges+FS AWS Style Health Checks edited by rajesh.batt...@citrix.com (02:35 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/AWS+Style+Health+Checks Limit Resources to domains and accounts edited by sanjay.tripa...@citrix.com (02:25 AM) https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts GSLB (Global S