svn commit: r591601 - in /struts/sandbox/trunk/struts2-rest-plugin: ./ src/main/java/org/apache/struts2/rest/ src/main/java/org/apache/struts2/rest/handler/ src/main/resources/ src/test/java/org/apach
Author: mrdon Date: Sat Nov 3 04:32:28 2007 New Revision: 591601 URL: http://svn.apache.org/viewvc?rev=591601&view=rev Log: Changing json handler to use json-lib over xstream for cleaner output Added: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/JsonLibHandler.java - copied, changed from r589075, struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamJsonHandler.java struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/handler/ struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/handler/Contact.java struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/handler/JsonLibHandlerTest.java Removed: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamJsonHandler.java Modified: struts/sandbox/trunk/struts2-rest-plugin/pom.xml struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/RestWorkflowInterceptor.java struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/ContentTypeHandler.java struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/HtmlHandler.java struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/handler/XStreamHandler.java struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml struts/sandbox/trunk/struts2-rest-plugin/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java Modified: struts/sandbox/trunk/struts2-rest-plugin/pom.xml URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/pom.xml?rev=591601&r1=591600&r2=591601&view=diff == --- struts/sandbox/trunk/struts2-rest-plugin/pom.xml (original) +++ struts/sandbox/trunk/struts2-rest-plugin/pom.xml Sat Nov 3 04:32:28 2007 @@ -24,14 +24,10 @@ 1.2.2 -org.codehaus.jettison -jettison -1.0-RC1 - - -stax -stax-api -1.0.1 +net.sf.json-lib +json-lib +jdk15 +2.1 javax.servlet @@ -56,6 +52,13 @@ org.springframework spring-mock +1.2.8 +true + + + +org.springframework +spring-core 1.2.8 true Modified: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java?rev=591601&r1=591600&r2=591601&view=diff == --- struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java (original) +++ struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java Sat Nov 3 04:32:28 2007 @@ -33,6 +33,7 @@ import static javax.servlet.http.HttpServletResponse.SC_OK; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.StringWriter; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -132,13 +133,14 @@ if (actionConfig.getResults().get(extCode) != null) { resultCode = extCode; } else { -ByteArrayOutputStream bout = new ByteArrayOutputStream(); - -resultCode = handler.fromObject(target, resultCode, bout); -if (bout.size() > 0) { -res.setContentLength(bout.size()); +StringWriter writer = new StringWriter(); +resultCode = handler.fromObject(target, resultCode, writer); +String text = writer.toString(); +if (text.length() > 0) { +byte[] data = text.getBytes("UTF-8"); +res.setContentLength(data.length); res.setContentType(handler.getContentType()); -res.getOutputStream().write(bout.toByteArray()); +res.getOutputStream().write(data); res.getOutputStream().close(); } } Modified: struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/java/org/apa
svn commit: r591627 - in /struts/struts2/trunk/core/src: main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
Author: mrdon Date: Sat Nov 3 07:22:36 2007 New Revision: 591627 URL: http://svn.apache.org/viewvc?rev=591627&view=rev Log: Adding support for different redirect result codes WW-2289 Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java?rev=591627&r1=591626&r2=591627&view=diff == --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java Sat Nov 3 07:22:36 2007 @@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import static javax.servlet.http.HttpServletResponse.*; import org.apache.struts2.ServletActionContext; import org.apache.struts2.dispatcher.mapper.ActionMapper; @@ -33,6 +34,8 @@ import com.opensymphony.xwork2.util.logging.Logger; import com.opensymphony.xwork2.util.logging.LoggerFactory; +import java.io.IOException; + /** * @@ -87,6 +90,8 @@ protected ActionMapper actionMapper; +protected int statusCode = SC_FOUND; + public ServletRedirectResult() { super(); } @@ -100,6 +105,10 @@ this.actionMapper = mapper; } +public void setStatusCode(int code) { +this.statusCode = code; +} + /** * Sets whether or not to prepend the servlet context path to the redirected URL. * @@ -150,7 +159,27 @@ LOG.debug("Redirecting to finalLocation " + finalLocation); } -response.sendRedirect(finalLocation); +sendRedirect(response, finalLocation); +} + +/** + * Sends the redirection. Can be overridden to customize how the redirect is handled (i.e. to use a different + * status code) + * + * @param response The response + * @param finalLocation The location URI + * @throws IOException + */ +protected void sendRedirect(HttpServletResponse response, String finalLocation) throws IOException { +if (SC_FOUND == statusCode) { +response.sendRedirect(finalLocation); +} else { +response.setStatus(statusCode); +response.setHeader("Location", finalLocation); +response.getWriter().write(finalLocation); +response.getWriter().close(); +} + } private static boolean isPathUrl(String url) { Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java?rev=591627&r1=591626&r2=591627&view=diff == --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java Sat Nov 3 07:22:36 2007 @@ -21,9 +21,12 @@ package org.apache.struts2.dispatcher; import java.util.HashMap; +import java.io.StringWriter; +import java.io.PrintWriter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import static javax.servlet.http.HttpServletResponse.*; import ognl.Ognl; @@ -66,6 +69,26 @@ e.printStackTrace(); fail(); } +} + +public void testAbsoluteRedirect303() { +view.setLocation("/bar/foo.jsp"); +view.setStatusCode(303); +responseMock.expectAndReturn("encodeRedirectURL", "/context/bar/foo.jsp", "/context/bar/foo.jsp"); +responseMock.expect("setStatus", C.args(C.eq(SC_SEE_OTHER))); +responseMock.expect("setHeader", C.args(C.eq("Location"), C.eq("/context/bar/foo.jsp"))); +StringWriter writer = new StringWriter(); +responseMock.matchAndReturn("getWriter", new PrintWriter(writer)); + +try { +view.execute(ai); +requestMock.verify(); +responseMock.verify(); +} catch (Exception e) { +e.printStackTrace(); +fail(); +} +assertEquals("/context/bar/foo.jsp", writer.toString()); } public void testPrependServletContextFalse() {
svn commit: r591628 - /struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml
Author: mrdon Date: Sat Nov 3 07:25:38 2007 New Revision: 591628 URL: http://svn.apache.org/viewvc?rev=591628&view=rev Log: Fixing redirect code to be 303 for redirect after post pattern Modified: struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml Modified: struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml?rev=591628&r1=591627&r2=591628&view=diff == --- struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml (original) +++ struts/sandbox/trunk/struts2-rest-plugin/src/main/resources/struts-plugin.xml Sat Nov 3 07:25:38 2007 @@ -72,9 +72,18 @@ + + + +303 + + +303 + + - +
svn commit: r591630 - in /struts/struts2/trunk: apps/showcase/pom.xml assembly/pom.xml plugins/tiles/pom.xml
Author: apetrelli Date: Sat Nov 3 08:11:59 2007 New Revision: 591630 URL: http://svn.apache.org/viewvc?rev=591630&view=rev Log: WW-2288 Now the Struts 2 plugin depends on Tiles 2.0.5. Assembly and Showcase have been changed accordingly. Modified: struts/struts2/trunk/apps/showcase/pom.xml struts/struts2/trunk/assembly/pom.xml struts/struts2/trunk/plugins/tiles/pom.xml Modified: struts/struts2/trunk/apps/showcase/pom.xml URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/pom.xml?rev=591630&r1=591629&r2=591630&view=diff == --- struts/struts2/trunk/apps/showcase/pom.xml (original) +++ struts/struts2/trunk/apps/showcase/pom.xml Sat Nov 3 08:11:59 2007 @@ -93,7 +93,7 @@ org.apache.tiles tiles-jsp -2.0.4 +2.0.5 runtime Modified: struts/struts2/trunk/assembly/pom.xml URL: http://svn.apache.org/viewvc/struts/struts2/trunk/assembly/pom.xml?rev=591630&r1=591629&r2=591630&view=diff == --- struts/struts2/trunk/assembly/pom.xml (original) +++ struts/struts2/trunk/assembly/pom.xml Sat Nov 3 08:11:59 2007 @@ -227,7 +227,7 @@ org.apache.tiles tiles-jsp -2.0.4 +2.0.5 runtime Modified: struts/struts2/trunk/plugins/tiles/pom.xml URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/tiles/pom.xml?rev=591630&r1=591629&r2=591630&view=diff == --- struts/struts2/trunk/plugins/tiles/pom.xml (original) +++ struts/struts2/trunk/plugins/tiles/pom.xml Sat Nov 3 08:11:59 2007 @@ -44,7 +44,7 @@ org.apache.tiles tiles-core -2.0.4 +2.0.5 javax.servlet
svn commit: r591643 - in /struts/struts1/trunk/tiles2: pom.xml src/test/java/org/apache/struts/tiles2/config/tiles-defs.xml
Author: apetrelli Date: Sat Nov 3 09:15:39 2007 New Revision: 591643 URL: http://svn.apache.org/viewvc?rev=591643&view=rev Log: STR-3074 Now the Struts 1 - Tiles 2 integration depends on Tiles 2.0.5. Corrected the Tiles definition files: it worked before since validation was turned off. Modified: struts/struts1/trunk/tiles2/pom.xml struts/struts1/trunk/tiles2/src/test/java/org/apache/struts/tiles2/config/tiles-defs.xml Modified: struts/struts1/trunk/tiles2/pom.xml URL: http://svn.apache.org/viewvc/struts/struts1/trunk/tiles2/pom.xml?rev=591643&r1=591642&r2=591643&view=diff == --- struts/struts1/trunk/tiles2/pom.xml (original) +++ struts/struts1/trunk/tiles2/pom.xml Sat Nov 3 09:15:39 2007 @@ -109,7 +109,7 @@ org.apache.tiles tiles-core - 2.0.4 + 2.0.5 Modified: struts/struts1/trunk/tiles2/src/test/java/org/apache/struts/tiles2/config/tiles-defs.xml URL: http://svn.apache.org/viewvc/struts/struts1/trunk/tiles2/src/test/java/org/apache/struts/tiles2/config/tiles-defs.xml?rev=591643&r1=591642&r2=591643&view=diff == --- struts/struts1/trunk/tiles2/src/test/java/org/apache/struts/tiles2/config/tiles-defs.xml (original) +++ struts/struts1/trunk/tiles2/src/test/java/org/apache/struts/tiles2/config/tiles-defs.xml Sat Nov 3 09:15:39 2007 @@ -20,7 +20,7 @@ http://struts.apache.org/dtds/tiles-config_2_0.dtd";> + "http://tiles.apache.org/dtds/tiles-config_2_0.dtd";> @@ -32,11 +32,11 @@ - - - - - + + + + + @@ -44,21 +44,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -67,24 +67,24 @@ - - - - - - + + + + + + - - + + @@ -97,36 +97,36 @@ http://www.apache.org"; icon="/images/struts-power.gif" - classtype="org.apache.struts.tiles.beans.SimpleMenuItem" /> - + classtype="org.apache.tiles.beans.SimpleMenuItem" /> + - - + + - + - - + + - + - - + + - +
svn commit: r591730 - in /struts/struts1/trunk/core/src/main: java/org/apache/struts/config/ConfigRuleSet.java resources/org/apache/struts/resources/struts-config_1_4.dtd
Author: pbenedict Date: Sat Nov 3 19:58:55 2007 New Revision: 591730 URL: http://svn.apache.org/viewvc?rev=591730&view=rev Log: STR-3111: Allow as a top-level element Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ConfigRuleSet.java struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ConfigRuleSet.java URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ConfigRuleSet.java?rev=591730&r1=591729&r2=591730&view=diff == --- struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ConfigRuleSet.java (original) +++ struts/struts1/trunk/core/src/main/java/org/apache/struts/config/ConfigRuleSet.java Sat Nov 3 19:58:55 2007 @@ -53,6 +53,9 @@ public void addRuleInstances(Digester digester) { ClassLoader cl = digester.getClassLoader(); +digester.addRule("struts-config/set-property", +new BaseConfigSetPropertyRule()); + digester.addRule("struts-config/action-mappings", new SetActionMappingClassRule()); Modified: struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd?rev=591730&r1=591729&r2=591730&view=diff == --- struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd (original) +++ struts/struts1/trunk/core/src/main/resources/org/apache/struts/resources/struts-config_1_4.dtd Sat Nov 3 19:58:55 2007 @@ -101,7 +101,7 @@ hierarchy, and contains nested elements for all of the other configuration settings. --> - +
[CONF] Confluence Changes in the last 24 hours
- This is a daily summary of all recent changes in Confluence. - Updated Spaces: - Apache Geronimo Documentation (geronimo) http://cwiki.apache.org/confluence/display/geronimo | |-Pages Added or Edited in This Space |-- Index was last edited by [EMAIL PROTECTED] (01:07 AM). | http://cwiki.apache.org/confluence/display/geronimo/Index Apache Directory Server v1.5 (DIRxSRVx11) http://cwiki.apache.org/confluence/display/DIRxSRVx11 | |-Pages Added or Edited in This Space |-- Reverse LDIF was last edited by akarasulu (04:26 PM). | http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF Apache Struts 2 Plugin Registry (S2PLUGINS) http://cwiki.apache.org/confluence/display/S2PLUGINS | |-Pages Added or Edited in This Space |-- Scope plugin was last edited by [EMAIL PROTECTED] (04:51 PM). | http://cwiki.apache.org/confluence/display/S2PLUGINS/Scope+plugin |-- Scope Plugin Released was created by [EMAIL PROTECTED] (02:36 PM). | http://cwiki.apache.org/confluence/display/S2PLUGINS/2007/11/03/Scope+Plugin+Released |-- Guice Plugin was created by [EMAIL PROTECTED] (02:08 PM). | http://cwiki.apache.org/confluence/display/S2PLUGINS/Guice+Plugin Apache MINA (MINA) http://cwiki.apache.org/confluence/display/MINA | |-Pages Added or Edited in This Space |-- MINA v2.0 Quick Start Guide was last edited by adc (02:24 PM). | http://cwiki.apache.org/confluence/display/MINA/MINA+v2.0+Quick+Start+Guide Apache Wicket (WICKET) http://cwiki.apache.org/confluence/display/WICKET | |-Pages Added or Edited in This Space |-- FAQs was last edited by knopp (05:35 PM). | http://cwiki.apache.org/confluence/display/WICKET/FAQs Apache Geronimo Samples (GMOxSAMPLES) http://cwiki.apache.org/confluence/display/GMOxSAMPLES | |-Pages Added or Edited in This Space |-- Simple example - Struts, Spring & Ajax was last edited by [EMAIL PROTECTED] (09:03 PM). | http://cwiki.apache.org/confluence/pages/viewpage.action?pageId=70021 - Updated User Profiles: - ronggosolehvedc |- http://cwiki.apache.org/confluence/display/~ronggosolehvedc - CONFLUENCE INFORMATION This message is automatically generated by Confluence Unsubscribe or edit your notifications preferences http://cwiki.apache.org/confluence/users/viewnotifications.action If you think it was sent incorrectly contact one of the administrators http://cwiki.apache.org/confluence/administrators.action If you want more information on Confluence, or have a bug to report see http://www.atlassian.com/software/confluence