[CONF] Confluence Changes in the last 24 hours
- This is a daily summary of all recent changes in Confluence. - Updated Spaces: - Apache Camel (CAMEL) http://cwiki.apache.org/confluence/display/CAMEL | |-Pages Added or Edited in This Space |-- Camel 1.4.0 Release was last edited by [EMAIL PROTECTED] (07:56 PM). | http://cwiki.apache.org/confluence/display/CAMEL/Camel+1.4.0+Release Apache ServiceMix (SM) http://cwiki.apache.org/confluence/display/SM | |-Pages Added or Edited in This Space |-- servicemix-cxf-bc was last edited by gertvanthienen (04:35 AM). | http://cwiki.apache.org/confluence/display/SM/servicemix-cxf-bc - 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
svn commit: r672721 - in /struts/struts2/trunk/plugins/rest/src: main/java/org/apache/struts2/rest/ main/java/org/apache/struts2/rest/handler/ main/resources/ test/java/org/apache/struts2/rest/
Author: jeromy Date: Mon Jun 30 00:54:36 2008 New Revision: 672721 URL: http://svn.apache.org/viewvc?rev=672721&view=rev Log: WW-2641 Separated the request and response ContentTypeHandlers. Added x-www-form-urlencoded handler Added: struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/handler/FormUrlEncodedHandler.java Modified: struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java struts/struts2/trunk/plugins/rest/src/main/resources/struts-plugin.xml struts/struts2/trunk/plugins/rest/src/test/java/org/apache/struts2/rest/ContentTypeHandlerManagerTest.java Modified: struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java?rev=672721&r1=672720&r2=672721&view=diff == --- struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java (original) +++ struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeHandlerManager.java Mon Jun 30 00:54:36 2008 @@ -44,7 +44,11 @@ */ public class ContentTypeHandlerManager { -Map handlers = new HashMap(); +/** ContentTypeHandlers keyed by the extension */ +Map handlersByExtension = new HashMap(); +/** ContentTypeHandlers keyed by the content-type */ +Map handlersByContentType = new HashMap(); + String defaultExtension; public static final String STRUTS_REST_HANDLER_OVERRIDE_PREFIX = "struts.rest.handlerOverride."; @@ -59,33 +63,60 @@ for (String name : names) { ContentTypeHandler handler = container.getInstance(ContentTypeHandler.class, name); -// Check for overriding handlers for the current extension -String overrideName = container.getInstance(String.class, STRUTS_REST_HANDLER_OVERRIDE_PREFIX +handler.getExtension()); -if (overrideName != null) { -if (!handlers.containsKey(handler.getExtension())) { -handler = container.getInstance(ContentTypeHandler.class, overrideName); -} else { -// overriding handler has already been registered -continue; +if (handler.getExtension() != null) { +// Check for overriding handlers for the current extension +String overrideName = container.getInstance(String.class, STRUTS_REST_HANDLER_OVERRIDE_PREFIX +handler.getExtension()); +if (overrideName != null) { +if (!handlersByExtension.containsKey(handler.getExtension())) { +handler = container.getInstance(ContentTypeHandler.class, overrideName); +} else { +// overriding handler has already been registered +continue; +} } +this.handlersByExtension.put(handler.getExtension(), handler); +} + +if (handler.getContentType() != null) { +this.handlersByContentType.put(handler.getContentType(), handler); } -this.handlers.put(handler.getExtension(), handler); } } /** - * Gets the handler for the request by looking at the extension + * Gets the handler for the request by looking at the request content type and extension * @param req The request * @return The appropriate handler */ public ContentTypeHandler getHandlerForRequest(HttpServletRequest req) { +ContentTypeHandler handler = null; +String contentType = req.getContentType(); +if (contentType != null) { +handler = handlersByContentType.get(contentType); +} +if (handler == null) { +String extension = findExtension(req.getRequestURI()); +if (extension == null) { +extension = defaultExtension; +} +handler = handlersByExtension.get(extension); +} +return handler; +} + +/** + * Gets the handler for the response by looking at the extension of the request + * @param req The request + * @return The appropriate handler + */ +public ContentTypeHandler getHandlerForResponse(HttpServletRequest req, HttpServletResponse res) { String extension = findExtension(req.getRequestURI()); if (extension == null) { extension = defaultExtension; } -return handlers.get(extension); +return handlersByExtension.get(extension); } - + /** * Handles the result using handlers to generate content type-specific content * @@ -127,7 +158,7 @@ target = null; } -C
Issues Opened: week of 2008-06-30
Struts2 - Monday, June 30, 2008 1 opened in last 7 days [WW-2700] validateAnnotatedMethodOnly parameter in validation interceptor did not take effect in Client validation - Type: Bug - Reporter: eik lee - Components: [] - Affects Versions: [] - http://issues.apache.org/struts/browse/WW-2700
svn commit: r672885 - in /struts/site/src/site: site.xml xdoc/download.xml xdoc/downloads.xml xdoc/index.xml
Author: rgielen Date: Mon Jun 30 12:54:07 2008 New Revision: 672885 URL: http://svn.apache.org/viewvc?rev=672885&view=rev Log: Site updates for 2.0.11.2 GA Modified: struts/site/src/site/site.xml struts/site/src/site/xdoc/download.xml struts/site/src/site/xdoc/downloads.xml struts/site/src/site/xdoc/index.xml Modified: struts/site/src/site/site.xml URL: http://svn.apache.org/viewvc/struts/site/src/site/site.xml?rev=672885&r1=672884&r2=672885&view=diff == --- struts/site/src/site/site.xml (original) +++ struts/site/src/site/site.xml Mon Jun 30 12:54:07 2008 @@ -17,7 +17,7 @@ href="http://www.apache.org/"; /> http://struts.apache.org/2.0.11.1/index.html"; /> +href="http://struts.apache.org/2.0.11.2/index.html"; /> http://struts.apache.org/1.3.8/index.html"; /> @@ -66,8 +66,8 @@ name="Struts 2.1.2 (Beta)" href="http://struts.apache.org/2.1.2/index.html"; /> http://struts.apache.org/2.0.11.1/index.html"; /> +name="Struts 2.0.11.2 (GA)" +href="http://struts.apache.org/2.0.11.2/index.html"; /> http://struts.apache.org/1.3.9/index.html"; /> Modified: struts/site/src/site/xdoc/download.xml URL: http://svn.apache.org/viewvc/struts/site/src/site/xdoc/download.xml?rev=672885&r1=672884&r2=672885&view=diff == --- struts/site/src/site/xdoc/download.xml (original) +++ struts/site/src/site/xdoc/download.xml Mon Jun 30 12:54:07 2008 @@ -90,30 +90,30 @@ - - + + - http://struts.apache.org/2.0.11.1/";>Apache Struts 2 + http://struts.apache.org/2.0.11.2/";>Apache Struts 2 is an elegant, extensible framework for creating enterprise-ready Java web applications. It is available in a full distribution, or as separate library, source, example and documentation distributions. - Struts 2.0.11.1 is the "best available" version of Struts. + Struts 2.0.11.2 is the "best available" version of Struts. - http://struts.apache.org/2.0.11/docs/release-notes-2011.html";>Release Notes + http://struts.apache.org/2.0.11.2/docs/release-notes-20112.html";>Release Notes Full Distribution: -struts-2.0.11.1-all.zip (86mb) -[http://www.apache.org/dist/struts/binaries/struts-2.0.11.1-all.zip.asc";>PGP] -[http://www.apache.org/dist/struts/binaries/struts-2.0.11.1-all.zip.md5";>MD5] +struts-2.0.11.2-all.zip (91mb) +[http://www.apache.org/dist/struts/binaries/struts-2.0.11.2-all.zip.asc";>PGP] +[http://www.apache.org/dist/struts/binaries/struts-2.0.11.2-all.zip.md5";>MD5] @@ -121,9 +121,9 @@ Example Applications: -struts-2.0.11.1-apps.zip (22mb) -[http://www.apache.org/dist/struts/examples/struts-2.0.11.1-apps.zip.asc";>PGP] -[http://www.apache.org/dist/struts/examples/struts-2.0.11.1-apps.zip.md5";>MD5] +struts-2.0.11.2-apps.zip (23mb) +[http://www.apache.org/dist/struts/examples/struts-2.0.11.2-apps.zip.asc";>PGP] +[http://www.apache.org/dist/struts/examples/struts-2.0.11.2-apps.zip.md5";>MD5] @@ -139,9 +139,9 @@ Essential Dependencies Only: -struts-2.0.11.1-lib.zip (4mb) -[http://www.apache.org/dist/struts/library/struts-2.0.11.1-lib.zip.asc";>PGP] -[http://www.apache.org/dist/struts/library/struts-2.0.11.1-lib.zip.md5";>MD5] +struts-2.0.11.2-lib.zip (4mb) +[http://www.apache.org/dist/struts/library/struts-2.0.11.2-lib.zip.asc";>PGP] +[http://www.apache.org/dist/struts/library/struts-2.0.11.2-lib.zip.md5";>MD5] @@ -149,9 +149,9 @@ Documentati
svn commit: r672982 - in /struts/struts2/trunk/plugins/codebehind/src: main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java test/java/org/apache/struts2/codebehind/CodebehindUnknownHa
Author: jeromy Date: Mon Jun 30 20:48:03 2008 New Revision: 672982 URL: http://svn.apache.org/viewvc?rev=672982&view=rev Log: WW-2701 Improved CodebehindUnknownHandler use of classpath leading slash & path concatenation Modified: struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java Modified: struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java?rev=672982&r1=672981&r2=672982&view=diff == --- struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java (original) +++ struts/struts2/trunk/plugins/codebehind/src/main/java/org/apache/struts2/codebehind/CodebehindUnknownHandler.java Mon Jun 30 20:48:03 2008 @@ -179,22 +179,73 @@ } return sb.toString(); } - -protected String determinePath(String prefix, String ns) { -if (ns == null || "/".equals(ns)) { -ns = ""; + +protected String joinPaths(boolean leadingSlash, boolean trailingSlash, String... parts) { +StringBuilder sb = new StringBuilder(); +if (leadingSlash) { +sb.append("/"); } -if (ns.length() > 0) { -if (ns.charAt(0) == '/') { -ns = ns.substring(1); +for (String part : parts) { +if (sb.length() > 0 && sb.charAt(sb.length()-1) != '/') { +sb.append("/"); } -if (ns.charAt(ns.length() - 1) != '/') { -ns += "/"; +sb.append(stripSlashes(part)); +} +if (trailingSlash) { +if (sb.length() > 0 && sb.charAt(sb.length()-1) != '/') { +sb.append("/"); } } -return prefix + ns; +return sb.toString(); +} + +protected String determinePath(String prefix, String ns) { +return joinPaths(true, true, prefix, ns); +} + +protected String stripLeadingSlash(String path) { +String result; +if (path != null) { +if (path.length() > 0) { +if (path.charAt(0) == '/') { +result = path.substring(1); +} else { +result = path; +} +} else { +result = path; +} +} else { +result = ""; +} + +return result; } - + +protected String stripTrailingSlash(String path) { +String result; + +if (path != null) { +if (path.length() > 0) { +if (path.charAt(path.length() - 1) == '/') { +result = path.substring(0, path.length()-1); +} else { +result = path; +} +} else { +result = path; +} +} else { +result = ""; +} + +return result; +} + +protected String stripSlashes(String path) { +return stripLeadingSlash(stripTrailingSlash(path)); +} + URL locateTemplate(String path) throws MalformedURLException { URL template = servletContext.getResource(path); if (template != null) { @@ -202,9 +253,9 @@ LOG.debug("Loaded template '" + path + "' from servlet context."); } } else { -template = ClassLoaderUtils.getResource(path, getClass()); +template = ClassLoaderUtils.getResource(stripLeadingSlash(path), getClass()); if (template != null && LOG.isDebugEnabled()) { -LOG.debug("Loaded template '" + path + "' from class path."); +LOG.debug("Loaded template '" + stripLeadingSlash(path) + "' from class path."); } } return template; Modified: struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java?rev=672982&r1=672981&r2=672982&view=diff == --- struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java (original) +++ struts/struts2/trunk/plugins/codebehind/src/test/java/org/apache/struts2/codebehind/CodebehindUnknownHandlerTest.java Mon Jun 30 20:48:03 2008 @@ -76,6 +76,9 @@ assertEquals("/foo/", handler.determinePath("/", "/foo"