📄 requestutils.html
字号:
</DD>
</DL>
<HR>
<A NAME="populate(java.lang.Object, javax.servlet.http.HttpServletRequest)"><!-- --></A><H3>
populate</H3>
<PRE>
public static void <B>populate</B>(java.lang.Object bean, javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException</PRE>
<DL>
<DD><p>Populate the properties of the specified JavaBean from the specified HTTP request, based on matching each parameter name against the corresponding JavaBeans "property setter" methods in the bean's class. Suitable conversion is done for argument types as described under <code>convert()</code>.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>bean</CODE> - The JavaBean whose properties are to be set<DD><CODE>request</CODE> - The HTTP request whose parameters are to be used to populate bean properties<DT><B>Throws:</B><DD><CODE>javax.servlet.ServletException</CODE> - if an exception is thrown while setting property values</DL>
</DD>
</DL>
<HR>
<A NAME="populate(java.lang.Object, java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest)"><!-- --></A><H3>
populate</H3>
<PRE>
public static void <B>populate</B>(java.lang.Object bean, java.lang.String prefix, java.lang.String suffix, javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException</PRE>
<DL>
<DD><p>Populate the properties of the specified JavaBean from the specified HTTP request, based on matching each parameter name (plus an optional prefix and/or suffix) against the corresponding JavaBeans "property setter" methods in the bean's class. Suitable conversion is done for argument types as described under <code>setProperties</code>.</p> <p>If you specify a non-null <code>prefix</code> and a non-null <code>suffix</code>, the parameter name must match <strong>both</strong> conditions for its value(s) to be used in populating bean properties. If the request's content type is "multipart/form-data" and the method is "POST", the <code>HttpServletRequest</code> object will be wrapped in a <code>MultipartRequestWrapper</code object.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>bean</CODE> - The JavaBean whose properties are to be set<DD><CODE>prefix</CODE> - The prefix (if any) to be prepend to bean property names when looking for matching parameters<DD><CODE>suffix</CODE> - The suffix (if any) to be appended to bean property names when looking for matching parameters<DD><CODE>request</CODE> - The HTTP request whose parameters are to be used to populate bean properties<DT><B>Throws:</B><DD><CODE>javax.servlet.ServletException</CODE> - if an exception is thrown while setting property values</DL>
</DD>
</DL>
<HR>
<A NAME="getMultipartHandler(javax.servlet.http.HttpServletRequest)"><!-- --></A><H3>
getMultipartHandler</H3>
<PRE>
private static <A HREF="../../../../org/apache/struts/upload/MultipartRequestHandler.html">MultipartRequestHandler</A> <B>getMultipartHandler</B>(javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException</PRE>
<DL>
<DD><p>Try to locate a multipart request handler for this request. First, look for a mapping-specific handler stored for us under an attribute. If one is not present, use the global multipart handler, if there is one.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - The HTTP request for which the multipart handler should be found.<DT><B>Returns:</B><DD>the multipart handler to use, or null if none is found.<DT><B>Throws:</B><DD><CODE>javax.servlet.ServletException</CODE> - if any exception is thrown while attempting to locate the multipart handler.</DL>
</DD>
</DL>
<HR>
<A NAME="getAllParametersForMultipartRequest(javax.servlet.http.HttpServletRequest, org.apache.struts.upload.MultipartRequestHandler)"><!-- --></A><H3>
getAllParametersForMultipartRequest</H3>
<PRE>
private static java.util.Map <B>getAllParametersForMultipartRequest</B>(javax.servlet.http.HttpServletRequest request, <A HREF="../../../../org/apache/struts/upload/MultipartRequestHandler.html">MultipartRequestHandler</A> multipartHandler)</PRE>
<DL>
<DD><p>Create a <code>Map</code> containing all of the parameters supplied for a multipart request, keyed by parameter name. In addition to text and file elements from the multipart body, query string parameters are included as well.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - The (wrapped) HTTP request whose parameters are to be added to the map.<DD><CODE>multipartHandler</CODE> - The multipart handler used to parse the request.<DT><B>Returns:</B><DD>the map containing all parameters for this multipart request.</DL>
</DD>
</DL>
<HR>
<A NAME="printableURL(java.net.URL)"><!-- --></A><H3>
printableURL</H3>
<PRE>
public static java.lang.String <B>printableURL</B>(java.net.URL url)</PRE>
<DL>
<DD><p>Compute the printable representation of a URL, leaving off the scheme/host/port part if no host is specified. This will typically be the case for URLs that were originally created from relative or context-relative URIs.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>url</CODE> - URL to render in a printable representation<DT><B>Returns:</B><DD>printable representation of a URL</DL>
</DD>
</DL>
<HR>
<A NAME="actionURL(javax.servlet.http.HttpServletRequest, org.apache.struts.config.ActionConfig, java.lang.String)"><!-- --></A><H3>
actionURL</H3>
<PRE>
public static java.lang.String <B>actionURL</B>(javax.servlet.http.HttpServletRequest request, <A HREF="../../../../org/apache/struts/config/ActionConfig.html">ActionConfig</A> action, java.lang.String pattern)</PRE>
<DL>
<DD><p>Return the context-relative URL that corresponds to the specified <A HREF="../../../../org/apache/struts/config/ActionConfig.html"><CODE>ActionConfig</CODE></A>, relative to the module associated with the current modules's <A HREF="../../../../org/apache/struts/config/ModuleConfig.html"><CODE>ModuleConfig</CODE></A>.</p><DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - The servlet request we are processing<DD><CODE>action</CODE> - ActionConfig to be evaluated<DD><CODE>pattern</CODE> - URL pattern used to map the controller servlet<DT><B>Returns:</B><DD>context-relative URL relative to the module<DT><B>Since: </B><DD>Struts 1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="forwardURL(javax.servlet.http.HttpServletRequest, org.apache.struts.config.ForwardConfig)"><!-- --></A><H3>
forwardURL</H3>
<PRE>
public static java.lang.String <B>forwardURL</B>(javax.servlet.http.HttpServletRequest request, <A HREF="../../../../org/apache/struts/config/ForwardConfig.html">ForwardConfig</A> forward)</PRE>
<DL>
<DD><p>Return the context-relative URL that corresponds to the specified <code>ForwardConfig</code>. The URL is calculated based on the properties of the <A HREF="../../../../org/apache/struts/config/ForwardConfig.html"><CODE>ForwardConfig</CODE></A> instance as follows:</p> <ul> <li>If the <code>contextRelative</code> property is set, it is assumed that the <code>path</code> property contains a path that is already context-relative: <ul> <li>If the <code>path</code> property value starts with a slash, it is returned unmodified.</li> <li>If the <code>path</code> property value does not start with a slash, a slash is prepended.</li> </ul></li> <li>Acquire the <code>forwardPattern</code> property from the <code>ControllerConfig</code> for the application module used to process this request. If no pattern was configured, default to a pattern of <code>$M$P</code>, which is compatible with the hard-coded mapping behavior in Struts 1.0.</li> <li>Process the acquired <code>forwardPattern</code>, performing the following substitutions: <ul> <li><strong>$M</strong> - Replaced by the module prefix for the application module processing this request.</li> <li><strong>$P</strong> - Replaced by the <code>path</code> property of the specified <A HREF="../../../../org/apache/struts/config/ForwardConfig.html"><CODE>ForwardConfig</CODE></A>, prepended with a slash if it does not start with one.</li> <li><strong>$$</strong> - Replaced by a single dollar sign character.</li> <li><strong>$x</strong> (where "x" is any charater not listed above) - Silently omit these two characters from the result value. (This has the side effect of causing all other $+letter combinations to be reserved.)</li> </ul></li> </ul><DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - The servlet request we are processing<DD><CODE>forward</CODE> - ForwardConfig to be evaluated<DT><B>Returns:</B><DD>context-relative URL<DT><B>Since: </B><DD>Struts 1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="forwardURL(javax.servlet.http.HttpServletRequest, org.apache.struts.config.ForwardConfig, org.apache.struts.config.ModuleConfig)"><!-- --></A><H3>
forwardURL</H3>
<PRE>
public static java.lang.String <B>forwardURL</B>(javax.servlet.http.HttpServletRequest request, <A HREF="../../../../org/apache/struts/config/ForwardConfig.html">ForwardConfig</A> forward, <A HREF="../../../../org/apache/struts/config/ModuleConfig.html">ModuleConfig</A> moduleConfig)</PRE>
<DL>
<DD><p>Return the context-relative URL that corresponds to the specified <code>ForwardConfig</code>. The URL is calculated based on the properties of the <A HREF="../../../../org/apache/struts/config/ForwardConfig.html"><CODE>ForwardConfig</CODE></A> instance as follows:</p> <ul> <li>If the <code>contextRelative</code> property is set, it is assumed that the <code>path</code> property contains a path that is already context-relative: <ul> <li>If the <code>path</code> property value starts with a slash, it is returned unmodified.</li> <li>If the <code>path</code> property value does not start with a slash, a slash is prepended.</li> </ul></li> <li>Acquire the <code>forwardPattern</code> property from the <code>ControllerConfig</code> for the application module used to process this request. If no pattern was configured, default to a pattern of <code>$M$P</code>, which is compatible with the hard-coded mapping behavior in Struts 1.0.</li> <li>Process the acquired <code>forwardPattern</code>, performing the following substitutions: <ul> <li><strong>$M</strong> - Replaced by the module prefix for the application module processing this request.</li> <li><strong>$P</strong> - Replaced by the <code>path</code> property of the specified <A HREF="../../../../org/apache/struts/config/ForwardConfig.html"><CODE>ForwardConfig</CODE></A>, prepended with a slash if it does not start with one.</li> <li><strong>$$</strong> - Replaced by a single dollar sign character.</li> <li><strong>$x</strong> (where "x" is any charater not listed above) - Silently omit these two characters from the result value. (This has the side effect of causing all other $+letter combinations to be reserved.)</li> </ul></li> </ul><DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - The servlet request we are processing<DD><CODE>forward</CODE> - ForwardConfig to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -