svn commit: r1535364 - in /struts/struts2/trunk/plugins/convention/src: main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java test/java/org/apache/struts2/convention/DefaultResultMapBui

2013-10-24 Thread lukaszlenart
Author: lukaszlenart
Date: Thu Oct 24 12:50:37 2013
New Revision: 1535364

URL: http://svn.apache.org/r1535364
Log:
WW-3832 Solves problem when not using flat layout with Convention plugin

Modified:

struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java

struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java

Modified: 
struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java?rev=1535364&r1=1535363&r2=1535364&view=diff
==
--- 
struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
 (original)
+++ 
struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
 Thu Oct 24 12:50:37 2013
@@ -359,7 +359,7 @@ public class DefaultResultMapBuilder imp
 int indexOfDot = path.indexOf('.', resultPrefix.length());
 
 // This case is when the path doesn't contain a result code
-if (indexOfDot == resultPrefix.length() || !flatResultLayout) {
+if (indexOfDot == resultPrefix.length()) {
 if (LOG.isTraceEnabled()) {
 LOG.trace("The result file [#0] has no result code and 
therefore" +
 " will be associated with success, input and error by 
default. This might" +

Modified: 
struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java?rev=1535364&r1=1535363&r2=1535364&view=diff
==
--- 
struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java
 (original)
+++ 
struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java
 Thu Oct 24 12:50:37 2013
@@ -229,6 +229,42 @@ public class DefaultResultMapBuilderTest
 
 }
 
+public void testFromServletContextNotFlat() throws Exception {
+ServletContext context = 
EasyMock.createStrictMock(ServletContext.class);
+
+// Setup some mock jsps
+Set resources = new HashSet();
+resources.add("/WEB-INF/location/namespace/no-annotation/index.ftl");
+resources.add("/WEB-INF/location/namespace/no-annotation/success.jsp");
+resources.add("/WEB-INF/location/namespace/no-annotation/failure.jsp");
+
EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/no-annotation")).andReturn(resources);
+EasyMock.replay(context);
+
+PackageConfig packageConfig = createPackageConfigBuilder("/namespace");
+
+this.conventionsService = new 
ConventionsServiceImpl("/WEB-INF/location");
+DefaultResultMapBuilder builder = new DefaultResultMapBuilder(context, 
container, "dispatcher,velocity,freemarker");
+builder.setFlatResultLayout("false");
+
+Map results = 
builder.build(NoAnnotationAction.class, null, "no-annotation", packageConfig);
+
+assertEquals(3, results.size());
+
+assertEquals("success", results.get("success").getName());
+assertEquals(3, results.get("success").getParams().size());
+assertEquals("org.apache.struts2.dispatcher.ServletDispatcherResult", 
results.get("success").getClassName());
+assertEquals("/WEB-INF/location/namespace/no-annotation/success.jsp", 
results.get("success").getParams().get("location"));
+
+assertEquals(1, results.get("index").getParams().size());
+assertEquals("org.apache.struts2.views.freemarker.FreemarkerResult", 
results.get("index").getClassName());
+assertEquals("/WEB-INF/location/namespace/no-annotation/index.ftl", 
results.get("index").getParams().get("location"));
+
+assertEquals(3, results.get("failure").getParams().size());
+assertEquals("org.apache.struts2.dispatcher.ServletDispatcherResult", 
results.get("success").getClassName());
+assertEquals("/WEB-INF/location/namespace/no-annotation/failure.jsp", 
results.get("failure").getParams().get("location"));
+EasyMock.verify(context);
+}
+
 public void testIgnoreFilesWithoutName() throws Exception {
 ServletContext context = 
EasyMock.createStrictMock(ServletContext.class);
 




svn commit: r1535511 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java

2013-10-24 Thread lukaszlenart
Author: lukaszlenart
Date: Thu Oct 24 19:44:34 2013
New Revision: 1535511

URL: http://svn.apache.org/r1535511
Log:
WW-4229 Implements new PostbackResult

Added:

struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java

Added: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java?rev=1535511&view=auto
==
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java
 (added)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/PostbackResult.java
 Thu Oct 24 19:44:34 2013
@@ -0,0 +1,232 @@
+/*
+ * $Id$
+ *
+ * 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.struts2.dispatcher;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.inject.Inject;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.dispatcher.mapper.ActionMapper;
+import org.apache.struts2.dispatcher.mapper.ActionMapping;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.Map;
+
+/**
+ * 
+ * A result that renders the current request parameters as a form which
+ * immediately submits a http://en.wikipedia.org/wiki/Postback";>postback
+ * to the specified destination.
+ * 
+ * 
+ * Parameters:
+ * 
+ * 
+ * location - http location to post the form
+ * prependServletContext (true|false) -  when location is relative, 
controls if to add Servlet Context, default "true"
+ * actionName - action name to post the form (resolved as an 
expression)
+ * namespace - action's namespace to use (resolved as an 
expression)
+ * method - actions' method to use (resolved as an expression)
+ * cache (true|false) - when set to true adds cache control headers, 
default "true"
+ * parse (true|false) - when set to true actionName, namespace and 
method are parsed, default "true"
+ * 
+ * 
+ * 
+ * Examples:
+ * 
+ * 
+ * 
+ *   https://www.example.com/register;
+ * 
+ *
+ * 
+ *   
+ * /secure
+ * register2
+ *   
+ * 
+ * 
+ * 
+ */
+public class PostbackResult extends StrutsResultSupport {
+
+private String actionName;
+private String namespace;
+private String method;
+private boolean prependServletContext = true;
+private boolean cache = true;
+
+protected ActionMapper actionMapper;
+
+@Override
+protected void doExecute(String finalLocation, ActionInvocation 
invocation) throws Exception {
+ActionContext ctx = invocation.getInvocationContext();
+HttpServletRequest request = (HttpServletRequest) 
ctx.get(ServletActionContext.HTTP_REQUEST);
+HttpServletResponse response = (HttpServletResponse) 
ctx.get(ServletActionContext.HTTP_RESPONSE);
+
+// Cache?
+if (!cache) {
+response.setHeader("Cache-Control", "no-cache, no-store, 
must-revalidate"); // HTTP 1.1
+response.setHeader("Pragma", "no-cache"); // HTTP 1.0
+response.setDateHeader("Expires", 0); // Proxies
+}
+
+// Render
+PrintWriter pw = new PrintWriter(response.getOutputStream());
+pw.write("");
+writeFormElements(request, pw);
+writePrologueScript(pw);
+pw.write("");
+pw.flush();
+}
+
+@Override
+public void execute(ActionInvocation invocation) throws Exception {
+String postbackUri = makePostbackUri(invocation);
+setLocation(postbackUri);
+super.execute(invocation);
+}
+
+/**
+ * Determines if the specified form input element should be included.
+ *
+ * @param name the 

svn commit: r1535518 - /struts/struts2/trunk/core/src/main/resources/struts-default.xml

2013-10-24 Thread lukaszlenart
Author: lukaszlenart
Date: Thu Oct 24 20:02:41 2013
New Revision: 1535518

URL: http://svn.apache.org/r1535518
Log:
WW-4229 Adds the new PostbackResult to struts-default.xml

Modified:
struts/struts2/trunk/core/src/main/resources/struts-default.xml

Modified: struts/struts2/trunk/core/src/main/resources/struts-default.xml
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/struts-default.xml?rev=1535518&r1=1535517&r2=1535518&view=diff
==
--- struts/struts2/trunk/core/src/main/resources/struts-default.xml (original)
+++ struts/struts2/trunk/core/src/main/resources/struts-default.xml Thu Oct 24 
20:02:41 2013
@@ -151,6 +151,7 @@
 
 
 
+
 
 
 




[CONF] Confluence Changes in the last 24 hours

2013-10-24 Thread Anonymous (Confluence)







   Apache Ambari (Incubating)


Pages

 Page:
 Cleaning up machines for Ambari and Stack
edited by Sumit Mohanty[12:44 AM]
(view changes)



   Apache Camel


Pages

 Page:
 Camel 2.13.0 Release
edited by Henryk Konsek[11:34 AM]
(view changes)

 Page:
 SERVLET
edited by Claus Ibsen[08:13 AM]
(view changes)



   Apache Cloudstack


Pages

 Page:
 Planet CloudStack
created by John Kinsella[06:54 PM]

 Page:
 Hyper-V 2012 (3.0) Support
edited by Rajesh Battala[01:22 PM]
(view changes)

 Page:
 GPU and vGPU support for CloudStack Guest VMs
edited by Sanjay Tripathi[12:54 PM]
(view changes)



   Apache Qpid


Pages

 Page:
 0.26 Release
edited by Justin Ross[05:59 PM]
(view changes)

 Page:
 Wiki Restructure
created by Robbie Gemmell[12:25 PM]

 Page:
 0.24 Release
edited by Justin Ross[11:50 AM]
(view changes)



   Apache Struts 2 Plugin Registry


Pages

 Blog post:
 Struts2-JSR303-Validation Plugin -Version 1.0 released
created by umesh awasthi[01:33 PM]



   Spark


Pages

 Page:
 PySpark Internals
created by Joshua Rosen[02:33 AM]

 Page:
 Additional Language Bindings
created by Joshua Rosen[06:23 PM]

 Page:
 Spark Internals
edited by Reynold Xin[05:00 AM]
(view changes)

 Page:
 Java API Internals
edited by Joshua Rosen[02:00 AM]
(view changes)



   Apache Syncope


Pages

 Page:
 Roadmap
edited by Francesco Chicchiricco[07:57 AM]
(view changes)



   Traffic Server


Pages

 Page:
 Consistent Hash Parent Selection
created by Phil Sorber[11:35 PM]

 Page:
 SSDSupport
edited by Zhao Yongming[04:56 AM]
(view changes)



   Apache Struts 2 Documentation


Pa