]> source.dussan.org Git - archiva.git/commitdiff
issues with proxy connectors after Struts upgrade
authorBrett Porter <brett@apache.org>
Sat, 1 Feb 2014 22:41:58 +0000 (22:41 +0000)
committerBrett Porter <brett@apache.org>
Sat, 1 Feb 2014 22:41:58 +0000 (22:41 +0000)
Add functional tests for the proxy connectors to verify

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@1563503 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/CSRFSecurityTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/ProxyConnectorTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addProxyConnector.jsp
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/deleteProxyConnector.jsp
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/disableProxyConnector.jsp
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editProxyConnector.jsp
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/enableProxyConnector.jsp
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/proxyConnectorForm.jspf
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/proxyConnectors.jsp

index 07baf79bc8e45bd6d84d9d4137aaa0db5168975e..58d63757de1834e48bde4780f06791d20af54017 100644 (file)
@@ -70,22 +70,18 @@ public class CSRFSecurityTest
         assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." );
     }
 
-    // TODO: TEMPORARILY DISABLED TO ADDRESS METHOD PARAMETER
-    @Test(enabled = false)
     public void testCSRFDisableProxyConnector()
     {
         getSelenium().open( baseUrl );
-        getSelenium().open( baseUrl + "/admin/disableProxyConnector!disable.action?target=maven2-repository.dev.java.net&source=internal" );
+        getSelenium().open( baseUrl + "/admin/disableProxyConnector.action?target=maven2-repository.dev.java.net&source=internal" );
         assertTextPresent( "Security Alert - Invalid Token Found" );
         assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." );
     }
 
-    // TODO: TEMPORARILY DISABLED TO ADDRESS METHOD PARAMETER
-    @Test(enabled = false)
     public void testCSRFDeleteProxyConnector()
     {
         getSelenium().open( baseUrl );
-        getSelenium().open( baseUrl + "/admin/deleteProxyConnector!delete.action?target=maven2-repository.dev.java.net&source=snapshots" );
+        getSelenium().open( baseUrl + "/admin/deleteProxyConnector.action?target=maven2-repository.dev.java.net&source=snapshots" );
         assertTextPresent( "Security Alert - Invalid Token Found" );
         assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." );
     }
diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/ProxyConnectorTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/ProxyConnectorTest.java
new file mode 100644 (file)
index 0000000..59ab484
--- /dev/null
@@ -0,0 +1,71 @@
+package org.apache.archiva.web.test;
+
+/*
+ * 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.
+ */
+
+import org.apache.archiva.web.test.parent.AbstractRepositoryTest;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+@Test( groups = { "proxyConnector" } )
+public class ProxyConnectorTest
+       extends AbstractRepositoryTest
+{
+    @BeforeTest
+    public void setUp()
+    {
+        loginAsAdmin();
+    }
+
+    @AfterSuite
+    public void tearDown()
+    {
+        deleteProxyConnector( "snapshots", "central", false );
+        enableProxyConnector( "internal", "central", false );
+    }
+
+    public void add()
+    {
+        addProxyConnector( "snapshots", "central" );
+    }
+
+    @Test(dependsOnMethods = "add")
+    public void edit()
+    {
+        editProxyConnector( "snapshots", "central" );
+    }
+
+    @Test(dependsOnMethods = "edit")
+    public void delete()
+    {
+        deleteProxyConnector( "snapshots", "central", true );
+    }
+
+    public void disable()
+    {
+        disableProxyConnector( "internal", "central", true );
+    }
+
+    @Test(dependsOnMethods = "disable")
+    public void enable()
+    {
+        enableProxyConnector( "internal", "central", true );
+    }
+}
index 33a8a34f3b06db5afa7178a6605cdc03c755ade3..52726cde6dece51e5076c1afbcff3bb2baf81881 100644 (file)
@@ -20,12 +20,18 @@ package org.apache.archiva.web.test.parent;
  */
 
 import java.io.File;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 import org.testng.Assert;
 
 public abstract class AbstractRepositoryTest 
        extends AbstractArchivaTest
 {
-       // Repository Groups
+
+    public static final String DEFAULT_NETWORK_PROXY = "(direct connection)";
+
+    // Repository Groups
        public void goToRepositoryGroupsPage()
        {
            if( !getTitle().equals( "Apache Archiva \\ Administration - Repository Groups" ) )
@@ -121,7 +127,7 @@ public abstract class AbstractRepositoryTest
        ///////////////////////////////
        public void goToProxyConnectorsPage()
        {
-               clickLinkWithText( "Proxy Connectors" );
+        getSelenium().open( "/archiva/admin/proxyConnectors.action" );
                assertProxyConnectorsPage();
        }
        
@@ -139,8 +145,8 @@ public abstract class AbstractRepositoryTest
        
        public void assertAddProxyConnectorPage()
        {
-               assertPage( "Apache Archiva \\ Admin: Add Proxy Connector" );
-               assertTextPresent( "Admin: Add Proxy Connector" );
+        assertAddProxyConnectorPageTitle();
+        assertTextPresent( "Admin: Add Proxy Connector" );
                String proxy = "Network Proxy*:,Managed Repository*:,Remote Repository*:,Policies:,Return error when:,On remote error:,Releases:,Snapshots:,Checksum:,Cache failures:,Properties:,No properties have been set.,Black List:,No black list patterns have been set.,White List:,No white list patterns have been set.";
                String[] arrayProxy = proxy.split( "," );
                for ( String arrayproxy : arrayProxy )
@@ -153,28 +159,198 @@ public abstract class AbstractRepositoryTest
                assertButtonWithValuePresent( "Add Pattern" );
                assertButtonWithValuePresent( "Add Proxy Connector" );
        }
-       
-       // this only fills in the values of required fields in adding Proxy Connectors
-       public void addProxyConnector( String networkProxy, String managedRepo, String remoteRepo )
+
+    private void assertAddProxyConnectorPageTitle()
+    {
+        assertPage( "Apache Archiva \\ Admin: Add Proxy Connector" );
+    }
+
+    public void addProxyConnector( String networkProxy, String managedRepo, String remoteRepo )
        {
                goToProxyConnectorsPage();
+        String xpath = getProxyConnectorXPath( managedRepo, remoteRepo );
+        assertElementNotPresent( "xpath=" + xpath );
+
                clickLinkWithText( "Add" );
                assertAddProxyConnectorPage();
-               selectValue( "connector.proxyId" , networkProxy );
-               selectValue( "connector.sourceRepoId" , managedRepo );
-               selectValue( "connector.targetRepoId" , remoteRepo );
+               selectValue( "connector.proxyId", networkProxy );
+               selectValue( "connector.sourceRepoId", managedRepo );
+               selectValue( "connector.targetRepoId", remoteRepo );
+
+        selectValue( "policy_releases", "never" );
+
+        addProxyProperty( "a", "b" );
+        assertAddProxyConnectorPageTitle();
+        addProxyProperty( "x", "y" );
+
+        addPattern( "blackListPattern", "**/bad/**" );
+        assertAddProxyConnectorPageTitle();
+        addPattern( "whiteListPattern", "**/good/**" );
+        assertAddProxyConnectorPageTitle();
+
+        clickButtonWithValue( "Add Proxy Connector" );
+
+        assertProxyConnectorsPage();
+        assertElementPresent( xpath );
+
+        LinkedHashMap<String, String> properties = new LinkedHashMap<String, String>();
+        properties.put("a", "b");
+        properties.put("x", "y");
+        assertProxySettings( managedRepo, remoteRepo, "never", "**/bad/**", "**/good/**", properties );
+    }
+
+    public void editProxyConnector( String managedRepo, String remoteRepo )
+       {
+               goToProxyConnectorsPage();
+        String xpath = getProxyConnectorXPath( managedRepo, remoteRepo );
+
+        clickLinkWithXPath( xpath + "/..//a[@class='edit']" );
+
+        assertEditProxyConnectorPage();
+
+        selectValue( "policy_releases", "always" );
+
+        addProxyProperty( "c", "d" );
+        assertEditProxyConnectorPage();
+        editProxyProperty( "x", "z" );
+        assertEditProxyConnectorPage();
+        removeProxyProperty( "a" );
+        assertEditProxyConnectorPage();
+
+        removePattern( "blackListPattern", "**/bad/**" );
+        assertEditProxyConnectorPage();
+        removePattern( "whiteListPattern", "**/good/**" );
+        addPattern( "blackListPattern", "**/bad2/**" );
+        assertEditProxyConnectorPage();
+        addPattern( "whiteListPattern", "**/good2/**" );
+
+        clickButtonWithValue( "Save Proxy Connector" );
+
+        assertProxyConnectorsPage();
+        assertElementPresent( xpath );
+
+        LinkedHashMap<String, String> properties = new LinkedHashMap<String, String>();
+        properties.put("c", "d");
+        properties.put("x", "z");
+        assertProxySettings( managedRepo, remoteRepo, "always", "**/bad2/**", "**/good2/**", properties );
+    }
+
+    private void assertEditProxyConnectorPage()
+    {
+        assertPage( "Apache Archiva \\ Admin : Edit Proxy Connector" );
+    }
+
+    private void removeProxyProperty( String name )
+    {
+        clickLinkWithXPath( "//a[@title='Remove [" + name + "] Property']" );
+    }
+
+    private void editProxyProperty( String name, String value )
+    {
+        setFieldValue( "property_" + name, value );
+    }
+
+    private void addPattern( String pattern, String value )
+    {
+        setFieldValue( pattern, value );
+        clickLinkWithXPath( "//input[@name='" + pattern + "']/../input[@type='button']" );
+    }
+
+    private void removePattern( String pattern, String value )
+    {
+        setFieldValue( pattern, value );
+        clickLinkWithXPath( "//a[@title='Remove [" + value + "] Pattern']" );
+    }
+
+    private void addProxyProperty( String name, String value )
+    {
+        setFieldValue( "propertyKey", name );
+        setFieldValue( "propertyValue", value );
+        clickButtonWithValue( "Add Property" );
+    }
+
+    private void assertProxySettings( String managedRepoId, String remoteRepoId, String releasesPolicy,
+                                      String blackList, String whiteList, LinkedHashMap<String, String> properties )
+    {
+        String xpath = getProxyConnectorXPath( managedRepoId, remoteRepoId );
+        clickLinkWithXPath( xpath + "/ancestor::div[contains(@class,'connector')]//a[text()='Settings']", false );
+
+        String tableElement = "//table[@class='policies']";
+        int row = 2;
+        Assert.assertEquals( getCellValueFromTable( tableElement, row, 0 ), "releases" );
+        Assert.assertEquals( getCellValueFromTable( tableElement, row, 1 ), releasesPolicy );
+
+        Assert.assertEquals( getSelenium().getText( "//th[contains(text(), 'Black List')]/ancestor::tr/td/p" ),
+                             "\"" + blackList + "\"" );
+        Assert.assertEquals( getSelenium().getText( "//th[contains(text(), 'White List')]/ancestor::tr/td/p" ),
+                             "\"" + whiteList + "\"" );
+
+        tableElement = "//table[@class='props']";
+        row = 0;
+        for ( Map.Entry property : properties.entrySet() )
+        {
+            Assert.assertEquals( getCellValueFromTable( tableElement, row, 0 ), property.getKey() );
+            Assert.assertEquals( getCellValueFromTable( tableElement, row, 1 ), property.getValue() );
+            row = row + 1;
+        }
+    }
+
+    public void addProxyConnector( String managedRepo, String remoteRepo )
+       {
+        addProxyConnector( DEFAULT_NETWORK_PROXY, managedRepo, remoteRepo );
        }
        
-       public void deleteProxyConnector()
+       public void deleteProxyConnector( String managedRepoId, String remoteRepoId, boolean failIfMissing )
        {
                goToProxyConnectorsPage();
-               clickLinkWithXPath( "//div[@id='contentArea']/div[2]/div[1]/div[2]/div[1]/a[3]/img" );
-               assertPage( "Apache Archiva \\ Admin: Delete Proxy Connectors" );
-               clickButtonWithValue( "Delete" );
-               assertPage( "Apache Archiva \\ Administration - Proxy Connectors" );
+
+        String xpathBase = getProxyConnectorXPath( managedRepoId, remoteRepoId );
+        String xpath = xpathBase + "/..//a[@class='delete']";
+        if ( failIfMissing || isElementPresent( "xpath=" + xpath ))
+        {
+            clickLinkWithXPath( xpath );
+            assertPage( "Apache Archiva \\ Admin: Delete Proxy Connector" );
+                   clickButtonWithValue( "Delete" );
+                   assertPage( "Apache Archiva \\ Administration - Proxy Connectors" );
+
+            assertElementNotPresent( xpathBase );
+        }
        }
-       
-       ///////////////////////////////
+
+       public void disableProxyConnector( String managedRepoId, String remoteRepoId, boolean failIfMissing )
+       {
+        toggleProxyConnector( managedRepoId, remoteRepoId, failIfMissing, "Disable" );
+    }
+
+       public void enableProxyConnector( String managedRepoId, String remoteRepoId, boolean failIfMissing )
+       {
+        toggleProxyConnector( managedRepoId, remoteRepoId, failIfMissing, "Enable" );
+    }
+
+    private void toggleProxyConnector( String managedRepoId, String remoteRepoId, boolean failIfMissing,
+                                       String operation )
+    {
+        goToProxyConnectorsPage();
+
+        String xpathBase = getProxyConnectorXPath( managedRepoId, remoteRepoId );
+        String xpath = xpathBase + "/..//a[@title='" + operation + " Proxy Connector']";
+        if ( failIfMissing || isElementPresent( "xpath=" + xpath ) )
+        {
+            clickLinkWithXPath( xpath );
+            assertPage( "Apache Archiva \\ Admin: " + operation + " Proxy Connector" );
+            clickButtonWithValue( operation );
+            assertPage( "Apache Archiva \\ Administration - Proxy Connectors" );
+        }
+    }
+
+    private String getProxyConnectorXPath( String managedRepoId, String remoteRepoId )
+    {
+        String managedRepoXpath = "//div[@class='managedRepo' and ./p[text()='" + managedRepoId + "']]";
+        String remoteRepoXpath = "//div[@class='remoteRepo' and ./p[text()='" + remoteRepoId + "']]";
+        return "//div[@id='contentArea']" + managedRepoXpath + "/.." + remoteRepoXpath;
+    }
+
+    ///////////////////////////////
        // network proxies
        ///////////////////////////////
        
index 6ea3bd8d97a698e0c109386696390d854d6430db..130e4e2dcd974f6a5c925d38d0886f145bf55851 100644 (file)
@@ -42,29 +42,19 @@ public class EditProxyConnectorAction
      */
     private String target;
 
-    @Override
-    public void prepare()
-    {
-        super.prepare();
-
-        connector = findProxyConnector( source, target );        
-    }
-
     public String input()
     {
+        connector = findProxyConnector( source, target );
         if ( connector == null )
         {
             addActionError( "Unable to edit non existant proxy connector with source [" + source + "] and target ["
                 + target + "]" );
             return ERROR;
         }
-        
-        if( connector != null )
-        {
-         // MRM-1135
-            connector.setBlackListPatterns( escapePatterns( connector.getBlackListPatterns() ) );
-            connector.setWhiteListPatterns( escapePatterns( connector.getWhiteListPatterns() ) );
-        }
+
+        // MRM-1135
+        connector.setBlackListPatterns( escapePatterns( connector.getBlackListPatterns() ) );
+        connector.setWhiteListPatterns( escapePatterns( connector.getWhiteListPatterns() ) );
 
         return INPUT;
     }
index 8edfb3932be94b2f84557cc8d1221fe827a96f00..03f275cc242ab02ee67c22b81f2d46dcf2f929ea 100644 (file)
           <param name="excludeMethods">input,back,cancel,browse</param>
         </interceptor-ref>
       </interceptor-stack>
-
-      <interceptor-stack name="configuredPrepareParamsStack">
-        <!-- <interceptor-ref name="prepare" /> -->
-        <interceptor-ref name="params"/>
-        <interceptor-ref name="configuredArchivaStack"/>
-      </interceptor-stack>
     </interceptors>
 
     <!-- Default interceptor stack. -->
       <result name="input">/WEB-INF/jsp/upload.jsp</result>
       <result name="error">/WEB-INF/jsp/upload.jsp</result>
       <result name="success">/WEB-INF/jsp/upload.jsp</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
       <interceptor-ref name="fileUpload"/>
     </action>
 
       <result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="success" type="redirectAction">repositoryGroups</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
     
     <action name="confirmDeleteRepositoryGroup" class="deleteRepositoryGroupAction" method="confirmDelete">
       <result name="input">/WEB-INF/jsp/admin/deleteRepositoryGroup.jsp</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
       <result name="input">/WEB-INF/jsp/admin/deleteRepositoryGroup.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/deleteRepositoryGroup.jsp</result>
       <result name="success" type="redirectAction">repositoryGroups</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
       <result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="success" type="redirectAction">repositoryGroups</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
        
     <action name="removeRepositoryFromGroup" class="repositoryGroupsAction" method="removeRepositoryFromGroup">
       <result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="success" type="redirectAction">repositoryGroups</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
        
     <action name="sortDownRepositoryFromGroup" class="sortRepositoriesAction" method="sortDown">
       <result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="success" type="redirectAction">repositoryGroups</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
        
     <action name="sortUpRepositoryFromGroup" class="sortRepositoriesAction" method="sortUp">
       <result name="input">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/repositoryGroups.jsp</result>
       <result name="success" type="redirectAction">repositoryGroups</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <!-- .\ REPOSITORIES \.____________________________________________ -->
       <result name="error">/WEB-INF/jsp/admin/addRepository.jsp</result>
       <result name="confirm">/WEB-INF/jsp/admin/confirmAddRepository.jsp</result>
       <result name="success" type="redirectAction">repositories</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="editRepository" class="editManagedRepositoryAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/editRepository.jsp</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="editRepository_commit" class="editManagedRepositoryAction" method="commit">
       <result name="error">/WEB-INF/jsp/admin/editRepository.jsp</result>
       <result name="success" type="redirectAction">repositories</result>
       <result name="confirm">/WEB-INF/jsp/admin/confirmAddRepository.jsp</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="confirmDeleteRepository" class="deleteManagedRepositoryAction" method="confirmDelete">
       <result name="input">/WEB-INF/jsp/admin/deleteRepository.jsp</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
       <result name="input">/WEB-INF/jsp/admin/deleteRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/deleteRepository.jsp</result>
       <result name="success" type="redirectAction">repositories</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
 
     <action name="addRemoteRepository" class="addRemoteRepositoryAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/addRemoteRepository.jsp</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="addRemoteRepository_commit" class="addRemoteRepositoryAction" method="commit">
       <result name="input">/WEB-INF/jsp/admin/addRemoteRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/addRemoteRepository.jsp</result>
       <result name="success" type="redirectAction">repositories</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="editRemoteRepository" class="editRemoteRepositoryAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/editRemoteRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/editRemoteRepository.jsp</result>
       <result name="success" type="redirectAction">repositories</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="confirmDeleteRemoteRepository" class="deleteRemoteRepositoryAction" method="confirmDelete">
       <result name="input">/WEB-INF/jsp/admin/deleteRemoteRepository.jsp</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="deleteRemoteRepository" class="deleteRemoteRepositoryAction" method="delete">
       <result name="input">/WEB-INF/jsp/admin/deleteRemoteRepository.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/deleteRemoteRepository.jsp</result>
       <result name="success" type="redirectAction">repositories</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <!-- .\ PROXY CONNECTORS \.________________________________________ -->
 
     <action name="addProxyConnector" class="addProxyConnectorAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/addProxyConnector.jsp</result>
+    </action>
+
+    <action name="addProxyConnector_*" class="addProxyConnectorAction" method="{1}">
+      <result name="input">/WEB-INF/jsp/admin/addProxyConnector.jsp</result>
       <result name="success" type="redirectAction">proxyConnectors</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
+      <interceptor-ref name="configuredArchivaStack">
+        <param name="params.acceptParamNames">\w+((\.\w+)|(\[\d+\])|(\(\d+\))|(\['[-\w]+'\])|(\('\w+'\)))*</param>
+      </interceptor-ref>
     </action>
 
     <action name="editProxyConnector" class="editProxyConnectorAction" method="input">
       <result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result>
       <result name="success" type="redirectAction">proxyConnectors</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
+      <interceptor-ref name="configuredArchivaStack">
+        <param name="params.acceptParamNames">\w+((\.\w+)|(\[\d+\])|(\(\d+\))|(\['[-\w]+'\])|(\('\w+'\)))*</param>
+      </interceptor-ref>
+    </action>
+
+    <action name="editProxyConnector_*" class="editProxyConnectorAction" method="{1}">
+      <result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result>
+      <result name="success" type="redirectAction">proxyConnectors</result>
+      <interceptor-ref name="configuredArchivaStack">
+        <param name="params.acceptParamNames">\w+((\.\w+)|(\[\d+\])|(\(\d+\))|(\['[-\w]+'\])|(\('\w+'\)))*</param>
+      </interceptor-ref>
     </action>
 
     <action name="sortUpProxyConnector" class="sortProxyConnectorsAction" method="sortUp">
       <result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result>
       <result name="success" type="redirectAction">proxyConnectors</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="sortDownProxyConnector" class="sortProxyConnectorsAction" method="sortDown">
       <result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result>
       <result name="success" type="redirectAction">proxyConnectors</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
-    <action name="deleteProxyConnector" class="deleteProxyConnectorAction" method="confirm">
+    <action name="deleteProxyConnector_confirm" class="deleteProxyConnectorAction" method="confirmDelete">
       <result name="input">/WEB-INF/jsp/admin/deleteProxyConnector.jsp</result>
-      <result name="success" type="redirectAction">proxyConnectors</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
     
-    <action name="enableProxyConnector" class="enableProxyConnectorAction" method="confirm">
+    <action name="deleteProxyConnector" class="deleteProxyConnectorAction" method="delete">
+      <result name="input">/WEB-INF/jsp/admin/deleteProxyConnector.jsp</result>
+      <result name="success" type="redirectAction">proxyConnectors</result>
+      <interceptor-ref name="configuredArchivaStack">
+        <param name="tokenSession.includeMethods">*</param>
+      </interceptor-ref>
+    </action>
+
+    <action name="enableProxyConnector_confirm" class="enableProxyConnectorAction" method="confirmEnable">
+      <result name="input">/WEB-INF/jsp/admin/enableProxyConnector.jsp</result>
+    </action>
+
+    <action name="enableProxyConnector" class="enableProxyConnectorAction" method="enable">
       <result name="input">/WEB-INF/jsp/admin/enableProxyConnector.jsp</result>
       <result name="success" type="redirectAction">proxyConnectors</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
-    <action name="disableProxyConnector" class="disableProxyConnectorAction" method="confirm">
+    <action name="disableProxyConnector_confirm" class="disableProxyConnectorAction" method="confirmDisable">
       <result name="input">/WEB-INF/jsp/admin/disableProxyConnector.jsp</result>
-      <result name="success" type="redirectAction">proxyConnectors</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
-        <param name="tokenSession.includeMethods">*</param>  
+      <interceptor-ref name="configuredArchivaStack">
+        <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
 
+    <action name="disableProxyConnector" class="disableProxyConnectorAction" method="disable">
+      <result name="input">/WEB-INF/jsp/admin/disableProxyConnector.jsp</result>
+      <result name="success" type="redirectAction">proxyConnectors</result>
+      <interceptor-ref name="configuredArchivaStack">
+        <param name="tokenSession.includeMethods">*</param>
+      </interceptor-ref>
+    </action>
 
     <!-- .\ NETWORK PROXIES \._________________________________________ -->
 
     <action name="addNetworkProxy" class="configureNetworkProxyAction" method="add">
       <result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result>
       <result name="success" type="redirectAction">networkProxies</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="editNetworkProxy" class="configureNetworkProxyAction" method="edit">
       <result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result>
       <result name="success" type="redirectAction">networkProxies</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="saveNetworkProxy" class="configureNetworkProxyAction" method="save">
       <result name="input">/WEB-INF/jsp/admin/editNetworkProxy.jsp</result>
       <result name="success" type="redirectAction">networkProxies</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
 
     <action name="deleteNetworkProxy" class="configureNetworkProxyAction" method="confirm">
       <result name="input">/WEB-INF/jsp/admin/deleteNetworkProxy.jsp</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
     <action name="deleteNetworkProxy_submit" class="configureNetworkProxyAction" method="delete">
       <result name="input">/WEB-INF/jsp/admin/deleteNetworkProxy.jsp</result>
       <result name="success" type="redirectAction">networkProxies</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
       <result name="input">/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp</result>
       <result name="success" type="redirectAction">legacyArtifactPath</result>
-      <interceptor-ref name="configuredPrepareParamsStack"/>
     </action>
 
     <action name="deleteLegacyArtifactPath" class="deleteLegacyArtifactPathAction" method="delete">
       <result name="input">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result>
       <result name="error">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result>
       <result name="success" type="redirectAction">legacyArtifactPath</result>
-      <interceptor-ref name="configuredPrepareParamsStack">
+      <interceptor-ref name="configuredArchivaStack">
         <param name="tokenSession.includeMethods">*</param>
       </interceptor-ref>
     </action>
index ee84a88d01be79f830600fbdd4f17e0eda976f8d..38793878e96678780fc195286e9d91cbf4f06570 100644 (file)
@@ -35,7 +35,7 @@
   <s:actionerror/>
   <s:actionmessage/>
   
-  <s:form name="saveProxyConnector" method="post" action="addProxyConnector!commit" namespace="/admin" validate="true">
+  <s:form name="saveProxyConnector" method="post" action="addProxyConnector_commit" namespace="/admin" validate="true">
     <%@ include file="/WEB-INF/jsp/admin/include/proxyConnectorForm.jspf" %>
     <s:submit value="Add Proxy Connector"/>
   </s:form>
index fb56d264e329a8604c7458146ecc3c61f74d4a90..8e5e02c202c8f766d92798a6b9fec66f383dd6f6 100644 (file)
@@ -44,7 +44,7 @@
     Are you sure you want to delete proxy connector <code>[ ${source} , ${target} ]</code> ?
   </p>
 
-  <s:form method="post" action="deleteProxyConnector!delete" namespace="/admin" validate="true">
+  <s:form method="post" action="deleteProxyConnector" namespace="/admin" validate="true">
     <s:hidden name="target"/>
     <s:hidden name="source"/>
     <s:token/>
index 52c69ba8cdbe1756bddb79b2d89f8a594f3b97a5..d0c343b238fa3dd81a2958ceaf485500881df209 100644 (file)
@@ -40,7 +40,7 @@
     Are you sure you want to disable proxy connector <code>[ ${source} , ${target} ]</code> ?
   </p>
 
-  <s:form method="post" action="disableProxyConnector!disable" namespace="/admin" validate="true">
+  <s:form method="post" action="disableProxyConnector" namespace="/admin" validate="true">
     <s:hidden name="target"/>
     <s:hidden name="source"/>
     <s:token/>
index 91b42dd34db71926b81e17239f7d0cb0158f64e5..fc187b470086f045e02fc0bfa62c3970bb80574e 100644 (file)
@@ -36,7 +36,7 @@
   <s:actionerror/>
   <s:actionmessage/>
 
-  <s:form name="saveProxyConnector" method="post" action="editProxyConnector!commit" namespace="/admin" validate="true">
+  <s:form name="saveProxyConnector" method="post" action="editProxyConnector_commit" namespace="/admin" validate="true">
     <%@ include file="/WEB-INF/jsp/admin/include/proxyConnectorForm.jspf" %>
     <s:submit value="Save Proxy Connector"/>
   </s:form>
index 1516a3a8e33c94e6b1bf4309d15565140d6fe38c..9c299aa168952a08df6155348afc5af28f6d23cf 100644 (file)
@@ -40,7 +40,7 @@
     Are you sure you want to enable proxy connector <code>[ ${source} , ${target} ]</code> ?
   </p>
 
-  <s:form method="post" action="enableProxyConnector!enable" namespace="/admin" validate="true">
+  <s:form method="post" action="enableProxyConnector" namespace="/admin" validate="true">
     <s:hidden name="target"/>
     <s:hidden name="source"/>
     <s:submit value="Enable"/>
index 8ca96893cc8a8526455c6b34e82d3a9d954672f8..a93b137b703862b6e4945f98316ac2650ef3b9e6 100644 (file)
@@ -48,7 +48,7 @@
           </td>
           <td>
             <c:set var="value">
-              <s:property id="value" value="%{#attr.connector.policies[#attr.policy.key]}" default="%{#attr.policy.value.defaultOption}" />
+              <s:property value="%{#attr.connector.policies[#attr.policy.key]}" default="%{#attr.policy.value.defaultOption}" />
             </c:set>
             <s:select name="connector.policies['%{#attr.policy.key}']"
                        list="%{#attr.policyMap[#attr.policy.key].options}"
   <!--
   function adjustActionMethod( action, method )
   {
-    var idx = action.indexOf( "!" );
-    if( idx == (-1) )
-    {
-      // no "name!method.action" defined, split by ".action" instead.
-      idx = action.indexOf( ".action" );
-    }
-    
-    return action.substring( 0, idx ) + "!" + method + ".action";
+    return action.replace(/_commit\.action$/, "_" + method + ".action");
   }
   
   function setAndSubmit( id, value, method )
index 8e6cd277d39c28559f2bf207573d91512be343f6..a7c66f652426e2923fd73c031bfe96b5b4a112c7 100644 (file)
           <s:param name="target" value="%{#attr.connector.targetRepoId}"/>
           <s:param name="source" value="%{#attr.connector.sourceRepoId}"/>
         </s:url>
-        <s:url id="deleteProxyConnectorUrl" action="deleteProxyConnector" method="confirmDelete">
+        <s:url id="deleteProxyConnectorUrl" action="deleteProxyConnector_confirm">
           <s:param name="source" value="%{#attr.connector.sourceRepoId}"/>
           <s:param name="target" value="%{#attr.connector.targetRepoId}"/>
           <s:param name="struts.token.name">token</s:param>
           <s:param name="token"><s:property value="token"/></s:param>
         </s:url>
-        <s:url id="enableProxyConnectorUrl" action="enableProxyConnector" method="confirmEnable">
+        <s:url id="enableProxyConnectorUrl" action="enableProxyConnector_confirm">
           <s:param name="source" value="%{#attr.connector.sourceRepoId}"/>
           <s:param name="target" value="%{#attr.connector.targetRepoId}"/>
         </s:url>
-        <s:url id="disableProxyConnectorUrl" action="disableProxyConnector" method="confirmDisable">
+        <s:url id="disableProxyConnectorUrl" action="disableProxyConnector_confirm">
           <s:param name="source" value="%{#attr.connector.sourceRepoId}"/>
           <s:param name="target" value="%{#attr.connector.targetRepoId}"/>
           <s:param name="struts.token.name">token</s:param>