OurRequestProcessor是我们的程序,但是看不出来有什么资源是释放了的呀,里面的代码也没什么特别的,就是加了一个设置编码的。然后在strut-config.xml中配置: <!-- ======================================= Controller Configuration --> <controller processorClass="com.fortuneduck.ic.action.OurRequestProcessor" /> public class OurRequestProcessor extends TilesRequestProcessor { static Log log = LogFactory.getLog(OurRequestProcessor.class); /** * @param request,javax.servlet.http.HttpServletRequest * @param response,javax.servlet.http.HttpServletResponse * @see org.apache.struts.action.RequestProcessor#process(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) */ public void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Wrap multipart requests with a special wrapper request = processMultipart(request); // Identify the path component we will use to select a mapping String path = processPath(request, response); if (path == null) { return; }
// Select a Locale for the current user if requested processLocale(request, response); request.setCharacterEncoding("utf-8"); // Set the content type and no-caching headers if requested processContent(request, response); processNoCache(request, response); // General purpose preprocessing hook if (!processPreprocess(request, response)) { return; } this.processCachedMessages(request, response); // Identify the mapping for this request ActionMapping mapping = processMapping(request, response, path); if (mapping == null) { return; } // Check for any role required to perform this action if (!processRoles(request, response, mapping)) { return; } // Process any ActionForm bean related to this request ActionForm form = processActionForm(request, response, mapping); processPopulate(request, response, form, mapping); // Process a forward or include specified by this mapping if (!processForward(request, response, mapping)) { return; } if (!processInclude(request, response, mapping)) { return; } // Create or acquire the Action instance to process this request Action action = processActionCreate(request, response, mapping); if (action == null) { return; } // Call the Action instance itself ActionForward forward = processActionPerform(request, response, action, form, mapping); // Process the returned ActionForward instance processForwardConfig(request, response, forward); }}
<!-- ======================================= Controller Configuration --> <controller
processorClass="com.fortuneduck.ic.action.OurRequestProcessor" /> public class OurRequestProcessor extends TilesRequestProcessor
{
static Log log = LogFactory.getLog(OurRequestProcessor.class); /**
* @param request,javax.servlet.http.HttpServletRequest
* @param response,javax.servlet.http.HttpServletResponse
* @see org.apache.struts.action.RequestProcessor#process(javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
public void process(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{ // Wrap multipart requests with a special wrapper
request = processMultipart(request); // Identify the path component we will use to select a mapping
String path = processPath(request, response);
if (path == null)
{
return;
}
// Select a Locale for the current user if requested
processLocale(request, response); request.setCharacterEncoding("utf-8"); // Set the content type and no-caching headers if requested
processContent(request, response);
processNoCache(request, response); // General purpose preprocessing hook
if (!processPreprocess(request, response))
{
return;
} this.processCachedMessages(request, response); // Identify the mapping for this request
ActionMapping mapping = processMapping(request, response, path);
if (mapping == null)
{
return;
} // Check for any role required to perform this action
if (!processRoles(request, response, mapping))
{
return;
} // Process any ActionForm bean related to this request
ActionForm form = processActionForm(request, response, mapping);
processPopulate(request, response, form, mapping); // Process a forward or include specified by this mapping
if (!processForward(request, response, mapping))
{
return;
} if (!processInclude(request, response, mapping))
{
return;
} // Create or acquire the Action instance to process this request
Action action = processActionCreate(request, response, mapping);
if (action == null)
{
return;
} // Call the Action instance itself
ActionForward forward = processActionPerform(request, response, action,
form, mapping); // Process the returned ActionForward instance
processForwardConfig(request, response, forward); }}