how to config connection time out in struts connectionpool
who can tell me how to config the connection time out in a struts connectionpool? i config my connectionpool as below.but connection will be exhausted very soon. data-sources data-source key=testSource type=org.apache.commons.dbcp.BasicDataSource set-property property=driverClassName value=com.microsoft.jdbc.sqlserver.SQLServerDriver/ set-property property=url value=jdbc:microsoft:sqlserver://myComputer:1433;DatabaseName=myDB/ set-property property=maxActive value=50/ set-property property=maxIdle value=5/ set-property property=username value=user/ set-property property=maxWait value=5/ set-property property=password value=/ /data-source /data-sources _ MSN Explorer: http://explorer.msn.com/lccn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to config connection time out in struts connectionpool
Struts does not so much provide a connection pool as it provides a way to load and expose one. The Struts data source controller will instantiate any DataSource subclass you like and then use reflection to set whatever properties you specify. Since you are using the Commons DBCP pool, the best place for more information would be the Commons DBCP site. The properties the DBCP BasicDataSource accepts are documented here: http://jakarta.apache.org/commons/dbcp/apidocs/org/apache/commons/dbcp/BasicDataSource.html However, the idea of a connection time-out does not usually apply to a connection pool. The idea is that all the connections are shared and kept in use. A client may use one connection instance for one access and another connection instance for the next. The closest corollary may be the number of idle connections allowed. Here, a pool will start to release idle connections when the number exceeds your specification. But, again, this a setting that Struts passes along to the DataSource instance. Struts itself has no control over the DataSource instance or its capabilities. It merely exposes a collection of arbitrary DataSources to your application as a convenience. -Ted. Yue Lieji wrote: who can tell me how to config the connection time out in a struts connectionpool? i config my connectionpool as below.but connection will be exhausted very soon. data-sources data-source key=testSource type=org.apache.commons.dbcp.BasicDataSource set-property property=driverClassName value=com.microsoft.jdbc.sqlserver.SQLServerDriver/ set-property property=url value=jdbc:microsoft:sqlserver://myComputer:1433;DatabaseName=myDB/ set-property property=maxActive value=50/ set-property property=maxIdle value=5/ set-property property=username value=user/ set-property property=maxWait value=5/ set-property property=password value=/ /data-source /data-sources _ MSN Explorer: http://explorer.msn.com/lccn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java
dgraham 2003/08/02 13:35:28 Modified:src/share/org/apache/struts/taglib/html ImgTag.java src/share/org/apache/struts/util RequestUtils.java src/share/org/apache/struts/taglib TagUtils.java Log: Moved encodeURL() to TagUtils. Revision ChangesPath 1.32 +7 -8 jakarta-struts/src/share/org/apache/struts/taglib/html/ImgTag.java Index: ImgTag.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImgTag.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- ImgTag.java 31 Jul 2003 00:19:04 - 1.31 +++ ImgTag.java 2 Aug 2003 20:35:28 - 1.32 @@ -72,7 +72,6 @@ import org.apache.struts.config.ModuleConfig; import org.apache.struts.taglib.TagUtils; import org.apache.struts.util.MessageResources; -import org.apache.struts.util.RequestUtils; /** * Generate an IMG tag to the specified image URI. @@ -615,7 +614,7 @@ src.append('='); Object value = TagUtils.getInstance().lookup(pageContext, paramName, paramProperty, paramScope); if (value != null) -src.append(RequestUtils.encodeURL(value.toString())); +src.append(TagUtils.getInstance().encodeURL(value.toString())); } // Just return the URL if there is no bean to look up @@ -666,7 +665,7 @@ } src.append(key); src.append('='); -src.append(RequestUtils.encodeURL(values[i])); +src.append(TagUtils.getInstance().encodeURL(values[i])); } } else { @@ -678,7 +677,7 @@ } src.append(key); src.append('='); -src.append(RequestUtils.encodeURL(value.toString())); +src.append(TagUtils.getInstance().encodeURL(value.toString())); } } 1.130 +7 -35 jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java Index: RequestUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v retrieving revision 1.129 retrieving revision 1.130 diff -u -r1.129 -r1.130 --- RequestUtils.java 30 Jul 2003 23:55:50 - 1.129 +++ RequestUtils.java 2 Aug 2003 20:35:28 - 1.130 @@ -128,23 +128,6 @@ private static MessageResources messages = MessageResources.getMessageResources(org.apache.struts.util.LocalStrings); -/** - * Java 1.4 encode method to use instead of deprecated 1.3 version. - */ -private static Method encode = null; - -/** - * Initialize the encode variable with the 1.4 method if available. - */ -static { -try { -// get version of encode method with two String args -Class[] args = new Class[] { String.class, String.class }; -encode = URLEncoder.class.getMethod(encode, args); -} catch (NoSuchMethodException e) { -log.debug(Could not find Java 1.4 encode method. Using deprecated version., e); -} -} // - Public Methods @@ -1505,22 +1488,11 @@ * method; if the reflection operations throw exceptions, this will return the url * encoded with the old URLEncoder.encode() method. * @return String - the encoded url. + * @deprecated Use TagUtils.encodeURL() instead. This will be removed + * after Struts 1.2. */ public static String encodeURL(String url) { -try { - -// encode url with new 1.4 method and UTF-8 encoding -if (encode != null) { -return (String) encode.invoke(null, new Object[] { url, UTF-8 }); -} - -} catch (IllegalAccessException e) { -log.debug(Could not find Java 1.4 encode method. Using deprecated version., e); -} catch (InvocationTargetException e) { -log.debug(Could not find Java 1.4 encode method. Using deprecated version., e); -} - -return URLEncoder.encode(url); +return TagUtils.getInstance().encodeURL(url); } /** 1.18 +55 -14jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java Index: TagUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- TagUtils.java 31 Jul 2003 00:30:21 -
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java
dgraham 2003/08/02 13:40:18 Modified:src/share/org/apache/struts/util RequestUtils.java src/share/org/apache/struts/taglib TagUtils.java Log: Moved pageURL() to TagUtils. Revision ChangesPath 1.131 +7 -43 jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java Index: RequestUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v retrieving revision 1.130 retrieving revision 1.131 diff -u -r1.130 -r1.131 --- RequestUtils.java 2 Aug 2003 20:35:28 - 1.130 +++ RequestUtils.java 2 Aug 2003 20:40:18 - 1.131 @@ -61,11 +61,8 @@ package org.apache.struts.util; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; -import java.net.URLEncoder; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; @@ -1180,44 +1177,11 @@ * (strongMUST/strong start with a slash) * @return context-relative URL * @since Struts 1.1 + * @deprecated Use TagUtils.pageURL() instead. This will be removed + * after Struts 1.2. */ public static String pageURL(HttpServletRequest request, String page) { - -StringBuffer sb = new StringBuffer(); -ModuleConfig moduleConfig = getRequestModuleConfig(request); -String pagePattern = moduleConfig.getControllerConfig().getPagePattern(); -if (pagePattern == null) { -sb.append(moduleConfig.getPrefix()); -sb.append(page); -} else { -boolean dollar = false; -for (int i = 0; i pagePattern.length(); i++) { -char ch = pagePattern.charAt(i); -if (dollar) { -switch (ch) { -case 'M' : -sb.append(moduleConfig.getPrefix()); -break; -case 'P' : -sb.append(page); -break; -case '$' : -sb.append('$'); -break; -default : -; // Silently swallow -} -dollar = false; -continue; -} else if (ch == '$') { -dollar = true; -} else { -sb.append(ch); -} -} -} -return (sb.toString()); - +return TagUtils.getInstance().pageURL(request, page); } /** 1.19 +60 -5 jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java Index: TagUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- TagUtils.java 2 Aug 2003 20:35:28 - 1.18 +++ TagUtils.java 2 Aug 2003 20:40:18 - 1.19 @@ -438,7 +438,7 @@ } else /* if (page != null) */ { url.append(request.getContextPath()); -url.append(RequestUtils.pageURL(request, page)); +url.append(this.pageURL(request, page)); } // Add anchor if requested (replacing any existing anchor) @@ -1008,6 +1008,61 @@ return resources.getMessage(userLocale, key, args); } +} + +/** + * pReturn the context-relative URL that corresponds to the specified + * codepage/code attribute value, calculated based on the + * codepagePattern/code property of the current module's + * [EMAIL PROTECTED] ModuleConfig}./p + * + * @param request The servlet request we are processing + * @param page The module-relative URL to be substituted in + * to the codepagePattern/code pattern for the current module + * (strongMUST/strong start with a slash) + * @return context-relative URL + */ +public String pageURL(HttpServletRequest request, String page) { + +StringBuffer sb = new StringBuffer(); +ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig(request); +String pagePattern = moduleConfig.getControllerConfig().getPagePattern(); + +if (pagePattern == null) { +sb.append(moduleConfig.getPrefix()); +sb.append(page); + +} else { +boolean dollar = false; +for (int i = 0; i pagePattern.length(); i++) { +char ch =
cvs commit: jakarta-struts/src/share/org/apache/struts/util ModuleUtils.java RequestUtils.java
dgraham 2003/08/02 14:03:41 Modified:src/share/org/apache/struts/util RequestUtils.java Added: src/share/org/apache/struts/util ModuleUtils.java Log: Moved module related methods to new ModuleUtils class. Revision ChangesPath 1.132 +26 -69 jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java Index: RequestUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v retrieving revision 1.131 retrieving revision 1.132 diff -u -r1.131 -r1.132 --- RequestUtils.java 2 Aug 2003 20:40:18 - 1.131 +++ RequestUtils.java 2 Aug 2003 21:03:41 - 1.132 @@ -90,7 +90,6 @@ import org.apache.struts.action.ActionServletWrapper; import org.apache.struts.action.DynaActionForm; import org.apache.struts.action.DynaActionFormClass; -import org.apache.struts.action.RequestProcessor; import org.apache.struts.config.ActionConfig; import org.apache.struts.config.FormBeanConfig; import org.apache.struts.config.ForwardConfig; @@ -109,7 +108,6 @@ * @author David Graham * @version $Revision$ $Date$ */ - public class RequestUtils { // --- Static Variables @@ -1261,27 +1259,15 @@ * @param request The servlet request we are processing * @param context The ServletContext for this web application * @since Struts 1.1 + * @deprecated Use ModuleUtils.selectModule() instead. This will be + * removed after Struts 1.2. */ public static void selectModule( String prefix, HttpServletRequest request, ServletContext context) { -// Expose the resources for this module -ModuleConfig config = (ModuleConfig) context.getAttribute(Globals.MODULE_KEY + prefix); -if (config != null) { -request.setAttribute(Globals.MODULE_KEY, config); -} else { -request.removeAttribute(Globals.MODULE_KEY); -} -MessageResources resources = -(MessageResources) context.getAttribute(Globals.MESSAGES_KEY + prefix); -if (resources != null) { -request.setAttribute(Globals.MESSAGES_KEY, resources); -} else { -request.removeAttribute(Globals.MESSAGES_KEY); -} - +ModuleUtils.getInstance().selectModule(prefix, request, context); } /** @@ -1290,13 +1276,11 @@ * * @param request The servlet request we are processing * @param context The ServletContext for this web application + * @deprecated Use ModuleUtils.selectModule() instead. This will be + * removed after Struts 1.2. */ public static void selectModule(HttpServletRequest request, ServletContext context) { -// Compute module name -String prefix = getModuleName(request, context); -// Expose the resources for this module -selectModule(prefix, request, context); - +ModuleUtils.getInstance().selectModule(request, context); } /** @@ -1304,16 +1288,11 @@ * @param request The servlet request we are processing * @param context The ServletContext for this web application * @return The module prefix or + * @deprecated Use ModuleUtils.getModuleName() instead. This will be + * removed after Struts 1.2. */ public static String getModuleName(HttpServletRequest request, ServletContext context) { - -// Acquire the path used to compute the module -String matchPath = (String) request.getAttribute(RequestProcessor.INCLUDE_SERVLET_PATH); - -if (matchPath == null) { -matchPath = request.getServletPath(); -} -return getModuleName( matchPath, context); +return ModuleUtils.getInstance().getModuleName(request, context); } /** @@ -1321,34 +1300,11 @@ * @param matchPath The uri from which we want the module name. * @param context The ServletContext for this web application * @return The module prefix or + * @deprecated Use ModuleUtils.getModuleName() instead. This will be + * removed after Struts 1.2. */ public static String getModuleName(String matchPath, ServletContext context) { -if (log.isDebugEnabled()) { -log.debug(Get module name for path + matchPath); -} - -String prefix = ; // Initialize prefix before we try lookup -String prefixes[] = getModulePrefixes(context); // Get all other possible prefixes -int lastSlash = 0; // Initialize before loop - -while (prefix.equals() ((lastSlash = matchPath.lastIndexOf(/)) 0)) { - -// We may be in a non-default module.
cvs commit: jakarta-struts/src/share/org/apache/struts/util ModuleUtils.java
dgraham 2003/08/02 14:04:42 Modified:src/share/org/apache/struts/util ModuleUtils.java Log: Set to cvs keyword substitution mode. Revision ChangesPath 1.2 +0 -0 jakarta-struts/src/share/org/apache/struts/util/ModuleUtils.java Index: ModuleUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ModuleUtils.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java
dgraham 2003/08/02 14:07:33 Modified:src/share/org/apache/struts/taglib TagUtils.java Log: Replace RequestUtils calls with ModuleUtils. Revision ChangesPath 1.20 +9 -7 jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java Index: TagUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- TagUtils.java 2 Aug 2003 20:40:18 - 1.19 +++ TagUtils.java 2 Aug 2003 21:07:33 - 1.20 @@ -91,6 +91,7 @@ import org.apache.struts.config.ModuleConfig; import org.apache.struts.taglib.html.Constants; import org.apache.struts.util.MessageResources; +import org.apache.struts.util.ModuleUtils; import org.apache.struts.util.RequestUtils; /** @@ -167,6 +168,7 @@ public static TagUtils getInstance() { return instance; } + /** * Compute a set of query parameters that will be dynamically added to * a generated URL. The returned Map is keyed by parameter name, and the @@ -700,7 +702,7 @@ HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); StringBuffer value = new StringBuffer(request.getContextPath()); -ModuleConfig config = RequestUtils.getRequestModuleConfig(request); +ModuleConfig config = ModuleUtils.getInstance().getRequestModuleConfig(request); if (config != null) { value.append(config.getPrefix()); @@ -801,7 +803,7 @@ * @return the ModuleConfig object */ public ModuleConfig getModuleConfig(PageContext pageContext) { -return RequestUtils.getModuleConfig( +return ModuleUtils.getInstance().getModuleConfig( (HttpServletRequest) pageContext.getRequest(), pageContext.getServletContext()); } @@ -1025,7 +1027,7 @@ public String pageURL(HttpServletRequest request, String page) { StringBuffer sb = new StringBuffer(); -ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig(request); +ModuleConfig moduleConfig = ModuleUtils.getInstance().getRequestModuleConfig(request); String pagePattern = moduleConfig.getControllerConfig().getPagePattern(); if (pagePattern == null) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/action ActionServlet.java
dgraham 2003/08/02 14:08:55 Modified:src/share/org/apache/struts/action ActionServlet.java Log: Replace RequestUtils calls with ModuleUtils. Revision ChangesPath 1.165 +8 -10 jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java Index: ActionServlet.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v retrieving revision 1.164 retrieving revision 1.165 diff -u -r1.164 -r1.165 --- ActionServlet.java27 Jul 2003 04:57:35 - 1.164 +++ ActionServlet.java2 Aug 2003 21:08:55 - 1.165 @@ -111,6 +111,7 @@ import org.apache.struts.util.GenericDataSource; import org.apache.struts.util.MessageResources; import org.apache.struts.util.MessageResourcesFactory; +import org.apache.struts.util.ModuleUtils; import org.apache.struts.util.RequestUtils; import org.apache.struts.util.ServletContextWriter; import org.xml.sax.InputSource; @@ -1161,14 +1162,11 @@ * @exception IOException if an input/output error occurs * @exception ServletException if a servlet exception is thrown */ -protected void process(HttpServletRequest request, - HttpServletResponse response) +protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { -RequestUtils.selectModule(request, getServletContext()); -getRequestProcessor(getModuleConfig(request)).process -(request, response); - +ModuleUtils.getInstance().selectModule(request, getServletContext()); +getRequestProcessor(getModuleConfig(request)).process(request, response); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/action Action.java
dgraham 2003/08/02 14:12:16 Modified:src/share/org/apache/struts/validator Resources.java src/share/org/apache/struts/action Action.java Log: Replace RequestUtils calls with ModuleUtils. Revision ChangesPath 1.19 +9 -5 jakarta-struts/src/share/org/apache/struts/validator/Resources.java Index: Resources.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/validator/Resources.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Resources.java26 Jul 2003 00:40:29 - 1.18 +++ Resources.java2 Aug 2003 21:12:16 - 1.19 @@ -74,6 +74,7 @@ import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.util.MessageResources; +import org.apache.struts.util.ModuleUtils; import org.apache.struts.util.RequestUtils; /** @@ -132,7 +133,10 @@ HttpServletRequest request) { String prefix = -RequestUtils.getModuleConfig(request, application).getPrefix(); +ModuleUtils +.getInstance() +.getModuleConfig(request, application) +.getPrefix(); return (ValidatorResources) application.getAttribute( ValidatorPlugIn.VALIDATOR_KEY + prefix); 1.66 +15 -13jakarta-struts/src/share/org/apache/struts/action/Action.java Index: Action.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Action.java,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- Action.java 26 Jul 2003 00:30:43 - 1.65 +++ Action.java 2 Aug 2003 21:12:16 - 1.66 @@ -74,6 +74,7 @@ import org.apache.struts.Globals; import org.apache.struts.config.ModuleConfig; import org.apache.struts.util.MessageResources; +import org.apache.struts.util.ModuleUtils; import org.apache.struts.util.RequestUtils; import org.apache.struts.util.TokenProcessor; @@ -281,11 +282,10 @@ // Identify the current module ServletContext context = getServlet().getServletContext(); -ModuleConfig moduleConfig = RequestUtils.getModuleConfig(request,context); - -// Return the requested data source instance -return ((DataSource) context.getAttribute(key + moduleConfig.getPrefix())); +ModuleConfig moduleConfig = +ModuleUtils.getInstance().getModuleConfig(request, context); +return (DataSource) context.getAttribute(key + moduleConfig.getPrefix()); } @@ -320,16 +320,18 @@ * * @since Struts 1.1 */ -protected MessageResources getResources(HttpServletRequest request, -String key) { +protected MessageResources getResources( +HttpServletRequest request, +String key) { // Identify the current module ServletContext context = getServlet().getServletContext(); -ModuleConfig moduleConfig = RequestUtils.getModuleConfig(request,context); +ModuleConfig moduleConfig = +ModuleUtils.getInstance().getModuleConfig(request, context); // Return the requested message resources instance -return ((MessageResources) context.getAttribute -(key + moduleConfig.getPrefix())); +return (MessageResources) context.getAttribute( +key + moduleConfig.getPrefix()); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/util RequestUtils.java
dgraham 2003/08/02 14:16:54 Modified:src/share/org/apache/struts/tiles TilesUtilStrutsModulesImpl.java src/share/org/apache/struts/util RequestUtils.java Log: Replace RequestUtils calls with ModuleUtils. Revision ChangesPath 1.6 +8 -7 jakarta-struts/src/share/org/apache/struts/tiles/TilesUtilStrutsModulesImpl.java Index: TilesUtilStrutsModulesImpl.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesUtilStrutsModulesImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TilesUtilStrutsModulesImpl.java 9 Jul 2003 00:24:00 - 1.5 +++ TilesUtilStrutsModulesImpl.java 2 Aug 2003 21:16:54 - 1.6 @@ -71,7 +71,7 @@ import org.apache.struts.Globals; import org.apache.struts.config.ModuleConfig; -import org.apache.struts.util.RequestUtils; +import org.apache.struts.util.ModuleUtils; /** * Implementation of TilesUtil for Struts multi modules. @@ -198,12 +198,13 @@ HttpServletRequest request, ServletContext servletContext) { -ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig(request); +ModuleConfig moduleConfig = +ModuleUtils.getInstance().getRequestModuleConfig(request); if (moduleConfig == null) { // ModuleConfig not found in current request. Select it. -RequestUtils.selectModule(request, servletContext); -moduleConfig = RequestUtils.getRequestModuleConfig(request); +ModuleUtils.getInstance().selectModule(request, servletContext); +moduleConfig = ModuleUtils.getInstance().getRequestModuleConfig(request); } return moduleConfig; 1.133 +20 -8 jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java Index: RequestUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v retrieving revision 1.132 retrieving revision 1.133 diff -u -r1.132 -r1.133 --- RequestUtils.java 2 Aug 2003 21:03:41 - 1.132 +++ RequestUtils.java 2 Aug 2003 21:16:54 - 1.133 @@ -899,13 +899,16 @@ } } -ModuleConfig moduleConfig = getRequestModuleConfig(request); +ModuleConfig moduleConfig = +ModuleUtils.getInstance().getRequestModuleConfig(request); + multipartClass = moduleConfig.getControllerConfig().getMultipartClass(); // Try to initialize the global request handler if (multipartClass != null) { try { multipartHandler = (MultipartRequestHandler) applicationInstance(multipartClass); + } catch (ClassNotFoundException cnfe) { throw new ServletException( Cannot find multipart class \ @@ -913,6 +916,7 @@ + \ + , exception: + cnfe.getMessage()); + } catch (InstantiationException ie) { throw new ServletException( InstantiaionException when instantiating @@ -920,6 +924,7 @@ + multipartClass + \, exception: + ie.getMessage()); + } catch (IllegalAccessException iae) { throw new ServletException( IllegalAccessException when instantiating @@ -1049,15 +1054,19 @@ if (pattern.endsWith(/*)) { sb.append(pattern.substring(0, pattern.length() - 2)); sb.append(action.getPath()); + } else if (pattern.startsWith(*.)) { -ModuleConfig appConfig = getRequestModuleConfig(request); +ModuleConfig appConfig = +ModuleUtils.getInstance().getRequestModuleConfig(request); sb.append(appConfig.getPrefix()); sb.append(action.getPath()); sb.append(pattern.substring(1)); + } else { throw new IllegalArgumentException(pattern); } -return (sb.toString()); + +return sb.toString(); } @@ -1117,7 +1126,8 @@ } // Calculate a context relative path for this ForwardConfig -ModuleConfig moduleConfig = getRequestModuleConfig(request); +ModuleConfig moduleConfig = +ModuleUtils.getInstance().getRequestModuleConfig(request); String forwardPattern =
cvs commit: jakarta-struts/src/test/org/apache/struts/util TestRequestUtils.java
dgraham 2003/08/02 14:18:46 Modified:src/test/org/apache/struts/util TestRequestUtils.java Log: Replace RequestUtils calls with ModuleUtils. Revision ChangesPath 1.22 +10 -9 jakarta-struts/src/test/org/apache/struts/util/TestRequestUtils.java Index: TestRequestUtils.java === RCS file: /home/cvs/jakarta-struts/src/test/org/apache/struts/util/TestRequestUtils.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- TestRequestUtils.java 26 Jul 2003 04:25:16 - 1.21 +++ TestRequestUtils.java 2 Aug 2003 21:18:46 - 1.22 @@ -68,6 +68,7 @@ import java.util.Map; import javax.servlet.jsp.JspException; + import junit.framework.Test; import junit.framework.TestSuite; @@ -76,8 +77,8 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.DynaActionForm; import org.apache.struts.action.RequestProcessor; -import org.apache.struts.config.ModuleConfig; import org.apache.struts.config.ForwardConfig; +import org.apache.struts.config.ModuleConfig; import org.apache.struts.mock.MockFormBean; import org.apache.struts.mock.MockPrincipal; import org.apache.struts.mock.TestMockBase; @@ -1489,7 +1490,7 @@ public void testSelectApplication1a() { request.setPathElements(/myapp, /noform.do, null, null); -RequestUtils.selectModule(request, context); +ModuleUtils.getInstance().selectModule(request, context); ModuleConfig moduleConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); assertNotNull(Selected a module, moduleConfig); @@ -1506,7 +1507,7 @@ context.setAttribute(Globals.MODULE_PREFIXES_KEY, prefixes); request.setPathElements(/myapp, /2/noform.do, null, null); -RequestUtils.selectModule(request, context); +ModuleUtils.getInstance().selectModule(request, context); ModuleConfig moduleConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); assertNotNull(Selected a module, moduleConfig); @@ -1523,7 +1524,7 @@ request.setPathElements(/myapp, /2/noform.do, null, null); request.setAttribute(RequestProcessor.INCLUDE_SERVLET_PATH, /noform.do); -RequestUtils.selectModule(request, context); +ModuleUtils.getInstance().selectModule(request, context); ModuleConfig moduleConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); assertNotNull(Selected an application, moduleConfig); @@ -1541,7 +1542,7 @@ request.setPathElements(/myapp, /noform.do, null, null); request.setAttribute(RequestProcessor.INCLUDE_SERVLET_PATH, /2/noform.do); -RequestUtils.selectModule(request, context); +ModuleUtils.getInstance().selectModule(request, context); ModuleConfig moduleConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); assertNotNull(Selected a module, moduleConfig); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/actions SwitchAction.java
dgraham 2003/08/02 14:21:32 Modified:src/share/org/apache/struts/actions SwitchAction.java Log: Replace RequestUtils calls with ModuleUtils. Revision ChangesPath 1.11 +6 -6 jakarta-struts/src/share/org/apache/struts/actions/SwitchAction.java Index: SwitchAction.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/actions/SwitchAction.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- SwitchAction.java 11 Jul 2003 23:47:57 - 1.10 +++ SwitchAction.java 2 Aug 2003 21:21:31 - 1.11 @@ -73,7 +73,7 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.MessageResources; -import org.apache.struts.util.RequestUtils; +import org.apache.struts.util.ModuleUtils; /** * pA standard strongAction/strong that switches to a new module @@ -148,7 +148,7 @@ } // Switch to the requested module -RequestUtils.selectModule(prefix, request, getServlet().getServletContext()); +ModuleUtils.getInstance().selectModule(prefix, request, getServlet().getServletContext()); if (request.getAttribute(Globals.MODULE_KEY) == null) { String message = messages.getMessage(switch.prefix, prefix); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/util LocalStrings.properties
dgraham 2003/08/02 14:38:16 Modified:src/share/org/apache/struts/taglib TagUtils.java src/share/org/apache/struts/util LocalStrings.properties Added: src/share/org/apache/struts/taglib LocalStrings.properties Log: Move message resources to taglib package. Revision ChangesPath 1.21 +13 -6 jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java Index: TagUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/TagUtils.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- TagUtils.java 2 Aug 2003 21:07:33 - 1.20 +++ TagUtils.java 2 Aug 2003 21:38:16 - 1.21 @@ -122,7 +122,7 @@ * TODO We need to move the relevant messages out of this properties file. */ private static final MessageResources messages = -MessageResources.getMessageResources(org.apache.struts.util.LocalStrings); + MessageResources.getMessageResources(org.apache.struts.taglib.LocalStrings); /** * Java 1.4 encode method to use instead of deprecated 1.3 version. @@ -231,6 +231,7 @@ saveException(pageContext, e); throw new JspException( messages.getMessage(parameters.multi, name, property, scope)); + } catch (JspException e) { saveException(pageContext, e); throw e; @@ -255,6 +256,7 @@ paramName, paramProperty, paramScope); + } catch (JspException e) { saveException(pageContext, e); throw e; @@ -272,12 +274,14 @@ Object mapValue = results.get(paramId); if (mapValue == null) { results.put(paramId, paramString); + } else if (mapValue instanceof String) { String newValues[] = new String[2]; newValues[0] = (String) mapValue; newValues[1] = paramString; results.put(paramId, newValues); -} else /* if (mapValue instanceof String[]) */ { + +} else { String oldValues[] = (String[]) mapValue; String newValues[] = new String[oldValues.length + 1]; System.arraycopy(oldValues, 0, newValues, 0, oldValues.length); @@ -296,6 +300,7 @@ if (session != null) { token = (String) session.getAttribute(Globals.TRANSACTION_TOKEN_KEY); } + if (token != null) { results.put(Constants.TOKEN_KEY, token); } @@ -660,6 +665,7 @@ } catch (JspException e) { throw e; + } catch (Exception e) { log.debug(e, e); } @@ -790,6 +796,7 @@ } catch (JspException e) { throw e; + } catch (Exception e) { ; } 1.12 +11 -26 jakarta-struts/src/share/org/apache/struts/taglib/LocalStrings.properties 1.9 +0 -11 jakarta-struts/src/share/org/apache/struts/util/LocalStrings.properties Index: LocalStrings.properties === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/LocalStrings.properties,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- LocalStrings.properties 15 May 2003 23:28:06 - 1.8 +++ LocalStrings.properties 2 Aug 2003 21:38:16 - 1.9 @@ -1,13 +1,6 @@ -actionErrors.errors=Cannot process ActionErrors instance of class {0} - -actionMessages.errors=Cannot process ActionMessages instance of class {0} - -computeURL.forward=Cannot retrieve ActionForward named {0} computeURL.forwards=Cannot retrieve ActionForwards collection -computeURL.specifier=You must specify exactly one of forward, href, page or action - lookup.access=Invalid access looking up property {0} of bean {1} lookup.bean.any=Cannot find bean {0} in any scope @@ -16,13 +9,9 @@ lookup.method=No getter method for property {0} of bean {1} -lookup.scope=Invalid bean scope {0} - lookup.target=Exception thrown by getter for property {0} of bean {1} message.bundle=Cannot find message resources under key {0} - -parameters.multi=Cannot cast to Map for name={0} property={1} scope={2} parameters.single=Cannot cast to String for name={0} property={1} scope={2}
cvs commit: jakarta-struts/src/share/org/apache/struts/util LocalStrings.properties
dgraham 2003/08/02 14:44:40 Modified:src/share/org/apache/struts/taglib LocalStrings.properties src/share/org/apache/struts/util LocalStrings.properties Log: Complete movement of message resources to taglib package. Revision ChangesPath 1.13 +15 -1 jakarta-struts/src/share/org/apache/struts/taglib/LocalStrings.properties Index: LocalStrings.properties === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/LocalStrings.properties,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- LocalStrings.properties 2 Aug 2003 21:38:16 - 1.12 +++ LocalStrings.properties 2 Aug 2003 21:44:40 - 1.13 @@ -6,6 +6,20 @@ computeURL.specifier=You must specify exactly one of forward, href, page or action +lookup.access=Invalid access looking up property {0} of bean {1} + +lookup.bean.any=Cannot find bean {0} in any scope + +lookup.bean=Cannot find bean {0} in scope {1} + +lookup.method=No getter method for property {0} of bean {1} + lookup.scope=Invalid bean scope {0} -parameters.multi=Cannot cast to Map for name={0} property={1} scope={2} \ No newline at end of file +lookup.target=Exception thrown by getter for property {0} of bean {1} + +message.bundle=Cannot find message resources under key {0} + +parameters.multi=Cannot cast to Map for name={0} property={1} scope={2} + +write.io=Input/output error: {0} \ No newline at end of file 1.10 +0 -14 jakarta-struts/src/share/org/apache/struts/util/LocalStrings.properties Index: LocalStrings.properties === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/LocalStrings.properties,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- LocalStrings.properties 2 Aug 2003 21:38:16 - 1.9 +++ LocalStrings.properties 2 Aug 2003 21:44:40 - 1.10 @@ -1,19 +1,5 @@ computeURL.forwards=Cannot retrieve ActionForwards collection -lookup.access=Invalid access looking up property {0} of bean {1} - -lookup.bean.any=Cannot find bean {0} in any scope - -lookup.bean=Cannot find bean {0} in scope {1} - -lookup.method=No getter method for property {0} of bean {1} - -lookup.target=Exception thrown by getter for property {0} of bean {1} - -message.bundle=Cannot find message resources under key {0} - parameters.single=Cannot cast to String for name={0} property={1} scope={2} - -write.io=Input/output error: {0} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 22062] - Enhancement request for Projects.html Page
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22062. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22062 Enhancement request for Projects.html Page [EMAIL PROTECTED] changed: What|Removed |Added Severity|Normal |Enhancement - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 21613] - nested:error tag stopped displaying error messages (of certain scenario) when upgraded from Struts1.1 R1 to Final version
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21613. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21613 nested:error tag stopped displaying error messages (of certain scenario) when upgraded from Struts1.1 R1 to Final version [EMAIL PROTECTED] changed: What|Removed |Added Component|Validator Framework |Custom Tags - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[BeanUtils] Interesting Microbenchmarks
TheServerSide (www.theserverside.com) recently published a case study that attempted to analyze the performance characteristics of a variety of middleware configurations, including two J2EE app servers and Microsoft's .NET platform. One of the hot spots that showed up in the Java based figures was identified as heavy use of reflection (the test app was Struts based and therefore uses commons-beanutils), but the report did not detail these findings. Despite the fact that the test condtions were very artificial (the database was tuned in a way that it was never the hotspot, which is unlike virtually any high-use web application in production), it prompted a bit of discussion over whether using reflection was a good idea. This in turn prompted me to write a couple of simple microbenchmarks to measure the behavior of the most commonly used BeanUtils and PropertyUtils methods for copying sets of properties -- copyProperties() and populate(). Legend: == bean - A plain old Java object (POJO) with eight properties, one of each of the standard primitive types and one String (org.apache.commons.beanutils.BenchBean) dyna - An instance of org.apache.commons.beanutils.BasicDynaBean with exactly the same properties and types. The property types for primitives in a DynaBean are the wrapper classes such as java.lang.Integer. map - An instance of HashMap with eight entries pointing at exactly the same values. The values for primitives of the corresponding wrapper class types. strs - An instance of HashMap with eight entries pointing at the same values, but all Strings (simulating request parameters that are used to populate a form bean in Struts). Dura #1 - Duration for 100,000 loops on my 1ghz desktop (milliseconds) Dura #2 - Duration for 50,000 loops on my 500mhz laptop (milliseconds) I tested all the legal combinations of an origin object (bean, dyna, map, or strs) to a destination object (bean or dyna). The tests were run on a 1 gigahertz PC running Linux (Red Hat 9) with Sun's JDK 1.4.2, and on a 500mhz laptop running Win2K with Sun's 1.4.2. The loop count was set to 100,000 in the PC case, and 50,000 in the laptop case, so the overall execution times should be roughly the same (since the desktop is roughly twice as fast). Execution time was measured in milliseconds. For each test, I ran an untimed execution of the specified number of iterations (to prime HotSpot), followed by a timed execution of the same number of iterations. To run these for yourselves, check out the HEAD branch of beanutils (or grab a source nightly distro dated 20030803 or later), and run ant bench. Results for BeanUtils (which performs type conversions): === Method Dest Orig Dura #1 Dura #2 -- --- --- copyProperties bean bean 17,703 17,075 copyProperties dyna bean 17,463 17,074 copyProperties bean dyna 15,413 15,042 copyProperties dyna dyna 13,020 12,077 copyProperties bean map 15,626 15,192 copyProperties dyna map 12,999 12,237 copyProperties bean strs 16,302 16,093 copyProperties dyna strs 13,940 13,129 populate bean map7,438 7,481 populate dyna map5,082 5,368 populate bean strs 5,768 5,739 populate dyna strs 3,865 3,746 Results for PropertyUtils (no type conversions): === Method Dest Orig Dura #1 Dura #2 -- --- --- copyProperties bean bean 5,595 5,107 copyProperties dyna bean 4,567 4,126 copyProperties bean dyna 3,791 3,675 copyProperties dyna dyna 844 681 copyProperties bean map3,938 3,755 copyProperties dyna map 931 772 Observations: * The absoute numbers are not particularly interesting, other than the fact that they confirm my belief that copying properties (whether using reflection or not) is very unlikely to be a bottleneck -- even on bargain basement hardware (in today's world), we're talking about copying all the properties in anything from 0.8 microseconds up to 177 microseconds. * This is a very limited test case, with only one pattern of properties. I suspect it will be on the worst case side in terms of the number of conversions required, compared to how most people use these methods in real applications. * Increasing the number of properties being copied will (of course) increase the execution times, but I suspect it will not change the ratios between alternatives much. I've done a few informal tests with more and fewer properties, but this will be worth investigating in more detail as well. * Only the cases where a bean was the destination or origin use reflection at all. The map case is just doing HashMap gets and puts, while the dyna case is really the map case plus type
DO NOT REPLY [Bug 21913] - Reloading a Struts app doesn't update form bean definitions
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21913. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21913 Reloading a Struts app doesn't update form bean definitions --- Additional Comments From [EMAIL PROTECTED] 2003-08-02 22:10 --- Struts has no control over how a container reloads an app. What container are you using? Does this happen in other containers? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 21614] - RequestUtils.getActionMappingName(String) should recognize anchor
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21614. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21614 RequestUtils.getActionMappingName(String) should recognize anchor [EMAIL PROTECTED] changed: What|Removed |Added Severity|Major |Enhancement Summary|Anchor not taken into |RequestUtils.getActionMappin |account in |gName(String) should |RequestUtils.getActionMappin|recognize anchor |gName(String) | - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib TagUtils.java
dgraham 2003/08/02 15:19:37 Modified:src/share/org/apache/struts/util ModuleUtils.java RequestUtils.java src/share/org/apache/struts/tiles TilesUtilStrutsModulesImpl.java src/share/org/apache/struts/taglib TagUtils.java Log: Renamed ModuleUtils.getRequestModuleConfig() to getModuleConfig() to match other method names. Revision ChangesPath 1.3 +17 -17jakarta-struts/src/share/org/apache/struts/util/ModuleUtils.java Index: ModuleUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ModuleUtils.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ModuleUtils.java 2 Aug 2003 21:04:42 - 1.2 +++ ModuleUtils.java 2 Aug 2003 22:19:37 - 1.3 @@ -110,6 +110,22 @@ protected ModuleUtils() { super(); } + +/** + * Return the current ModuleConfig object stored in request, if it exists, + * null otherwise. + * This method can be used by plugin to retrieve the current module config + * object. If no moduleConfig is found, this means that the request haven't + * hit the server throught the struts servlet. The appropriate module config + * can be set and found with + * code[EMAIL PROTECTED] RequestUtils#selectModule(HttpServletRequest, ServletContext)} /code. + * @param request The servlet request we are processing + * @return the ModuleConfig object from request, or null if none is set in + * the request. + */ +public ModuleConfig getModuleConfig(HttpServletRequest request) { +return (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); +} /** * Return the ModuleConfig object is it exists, null otherwise. @@ -121,7 +137,7 @@ HttpServletRequest request, ServletContext context) { -ModuleConfig moduleConfig = this.getRequestModuleConfig(request); +ModuleConfig moduleConfig = this.getModuleConfig(request); if (moduleConfig == null) { moduleConfig = (ModuleConfig) context.getAttribute(Globals.MODULE_KEY); @@ -201,22 +217,6 @@ */ public String[] getModulePrefixes(ServletContext context) { return (String[]) context.getAttribute(Globals.MODULE_PREFIXES_KEY); -} - -/** - * Return the current ModuleConfig object stored in request, if it exists, - * null otherwise. - * This method can be used by plugin to retrieve the current module config - * object. If no moduleConfig is found, this means that the request haven't - * hit the server throught the struts servlet. The appropriate module config - * can be set and found with - * code[EMAIL PROTECTED] RequestUtils#selectModule(HttpServletRequest, ServletContext)} /code. - * @param request The servlet request we are processing - * @return the ModuleConfig object from request, or null if none is set in - * the request. - */ -public ModuleConfig getRequestModuleConfig(HttpServletRequest request) { -return (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); } /** 1.134 +9 -9 jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java Index: RequestUtils.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v retrieving revision 1.133 retrieving revision 1.134 diff -u -r1.133 -r1.134 --- RequestUtils.java 2 Aug 2003 21:16:54 - 1.133 +++ RequestUtils.java 2 Aug 2003 22:19:37 - 1.134 @@ -900,7 +900,7 @@ } ModuleConfig moduleConfig = -ModuleUtils.getInstance().getRequestModuleConfig(request); +ModuleUtils.getInstance().getModuleConfig(request); multipartClass = moduleConfig.getControllerConfig().getMultipartClass(); @@ -1057,7 +1057,7 @@ } else if (pattern.startsWith(*.)) { ModuleConfig appConfig = -ModuleUtils.getInstance().getRequestModuleConfig(request); +ModuleUtils.getInstance().getModuleConfig(request); sb.append(appConfig.getPrefix()); sb.append(action.getPath()); sb.append(pattern.substring(1)); @@ -1127,7 +1127,7 @@ // Calculate a context relative path for this ForwardConfig ModuleConfig moduleConfig = -ModuleUtils.getInstance().getRequestModuleConfig(request); +ModuleUtils.getInstance().getModuleConfig(request); String forwardPattern = moduleConfig.getControllerConfig().getForwardPattern(); if
cvs commit: jakarta-struts/src/share/org/apache/struts/upload DiskMultipartRequestHandler.java
dgraham 2003/08/02 15:22:13 Modified:src/share/org/apache/struts/upload DiskMultipartRequestHandler.java Log: Use ModuleUtils.getModuleConfig() instead of looking in the request directly. Revision ChangesPath 1.24 +19 -11 jakarta-struts/src/share/org/apache/struts/upload/DiskMultipartRequestHandler.java Index: DiskMultipartRequestHandler.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/DiskMultipartRequestHandler.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- DiskMultipartRequestHandler.java 2 Jul 2003 03:03:55 - 1.23 +++ DiskMultipartRequestHandler.java 2 Aug 2003 22:22:13 - 1.24 @@ -63,18 +63,19 @@ import java.io.File; import java.io.IOException; -import java.util.Hashtable; import java.util.Enumeration; +import java.util.Hashtable; + import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.struts.action.ActionServlet; import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionServlet; import org.apache.struts.config.ModuleConfig; -import org.apache.struts.Globals; +import org.apache.struts.util.ModuleUtils; /** * This is a MultipartRequestHandler that writes file data directly to @@ -127,12 +128,17 @@ * the request wrapper will be populated as well. */ public void handleRequest(HttpServletRequest request) throws ServletException { -ModuleConfig moduleConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); -retrieveTempDir(moduleConfig); +ModuleConfig moduleConfig = ModuleUtils.getInstance().getModuleConfig(request); +this.retrieveTempDir(moduleConfig); + try { -MultipartIterator iterator = new MultipartIterator(request, moduleConfig.getControllerConfig().getBufferSize(), - getMaxSize(moduleConfig.getControllerConfig().getMaxFileSize()), - tempDir); +MultipartIterator iterator = +new MultipartIterator( +request, +moduleConfig.getControllerConfig().getBufferSize(), +getMaxSize(moduleConfig.getControllerConfig().getMaxFileSize()), +tempDir); + MultipartElement element; textElements = new Hashtable(); @@ -146,10 +152,12 @@ createDiskFile(element); } } + //take care of maximum length being exceeded if (iterator.isMaxLengthExceeded()) { request.setAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED, Boolean.TRUE); } + } catch(IOException ioe) { throw new ServletException(ioe); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 21913] - Reloading a Struts app doesn't update form bean definitions
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21913. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21913 Reloading a Struts app doesn't update form bean definitions --- Additional Comments From [EMAIL PROTECTED] 2003-08-02 23:14 --- I'm using Tomcat 4.1.24, and no, I have not tried it in other containers. However, I seriously doubt this is a container issue. I probably wasn't clear enough in my original report, but the changes I'm making to form beans are in the struts-config.xml file only. When making a change to a form-bean-definition in that file and then reloading the app, Struts doesn't seem to notice that I changed the struts-config.xml file. If I remove and then re-install the app, then it notices and the changes take effect. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 22086] New: - update note on VelocityStruts in resources doc
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22086. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22086 update note on VelocityStruts in resources doc Summary: update note on VelocityStruts in resources doc Product: Struts Version: Nightly Build Platform: Other URL: http://jakarta.apache.org/struts/resources/views.html OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: Documentation AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] the current note is way out of date. patch is attached. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 22086] - update note on VelocityStruts in resources doc
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22086. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22086 update note on VelocityStruts in resources doc --- Additional Comments From [EMAIL PROTECTED] 2003-08-02 23:20 --- Created an attachment (id=7628) patch for views.xml - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Workflow for Struts
Dear Struts Dev, I have launched a sub-project at the struts sourceforge site which provides workflow functionality for struts. Essentially it is a re-write of the struts controller and provides a significant set of additional features. I am currently working on finalizing the struts example and writing documentation, but the basic framework is there. PAGEFLOW EXAMPLE Heres what a page looks like... page name=logon location value=/logon.jsp/ form form-property... (same as Struts 1.1) /page page name=main ... page declaration /page Heres what a page flow looks like... flow page-instance ref=logon name=logon1 action name=submit defaultDestination=main steps step type=LogStep param name=message value=Message to log /step step type=CallSessionBean param name=beanName value=value ... additional params /step /steps /action /page-instance page-instance ref=main name=main action name=submit defaultDestination=logon1 steps step type=LogStep param name=message value=Message to log /step step type=CallSessionBean param name=beanName value=value ... additional params /step /steps /action /page-instance /flow PAGEFLOW FUNCTIONALITY 1. Contextual Pages: Re-use of pages across PageFlows. 2. Re-usable Actions: Actions can be declared at the application or pageflow level and reused inside of the workflow. 3. Variable Handling: You can do almost all of your web variable handling in the xml file instead of in code (saves loads of time!) Additionally pageflow provides a new web scope which is automatically cleaned up for the developer. 4. Event Handling: - Entering, exiting, or wrapping a pageflow. - Entering, exiting an action. - Entering, exiting a page instance. - Adding, removing from a scope. - Setting values on a form, validating a form. - Sending HTML to the client. - An error occurs. 5. Re-Usable Steps: I get really tired of writing the same code over and over again. That is why I love workflow tools (webmethods, BEA BPM, etc.). Workflow tools offer me a meta programming language with which I can create re-usable steps and just pass in different parameters. pageflow provides exactly the same functionality (uses the commons-workflow library). If your application uses session beans out of an EJB container, just use the InitialContext and CallSessionBean steps. Sometimes of course this wont work, either because of the complexity of the logic involved or your specific project context. In that case just put your custom code into a step and put that step into the action. 6. Nested PageFlows: This is really cool! pageflow allows you to nest other PageFlows inside of each other. You can pass variables from one to the other. If managed and thought through properly this could be a very powerful feature. 7. Fine-Grained Filters: I honestly dont know if anyone wants this, but it's always annoyed me that I could only use filters at the top web application level. What if you want to convert your application to use a new filter incrementally? What if your filter isnt needed everywhere? Currently you would have to code the contextual logic directly in your filter.pageflow allows you to put your filter at the application, pageflow, page-instance and action levels. 8. Fine-Grained Error Handling: Another gripe I have is trying to figure out flexible error handling in my applications.You may use or declare error handlers at - application layer - pageflow layer - action layer 9. Fine-Grained Form Control: I had two big beefs with Struts 1.1 forms. Figuring out when and where forms are initialized and mapping the data to/from my value objects. In pageflow, each page declaration is connected with a form. The form properties have two new elements, mapTo and mapFrom. These elemements simply connect the form property to two variables, one to get the value from (session.user.name) and one to put the changed value into (request.changeduser.name). The framework is in no way complete, but it is to the point where people can start commenting on it. Let me know what you think. Paul T Smith