M
Michael
Here is the scenario:
I am utilizing Struts 1.1 to develop an app. I have subclassed the
RequestProcessor and have overridden the process method. Everything
works fine for the most part. However, when my action returns null as
the ActionForward from it's execute method, here's what happens:
1. ActionServlet.doGet()
2. MyRequestProcessor.process()
3. MyAction.execute() returns null
4. MyRequestProcessor.process() returns to ActionServlet.doGet()
5. ReqeustProcessor.process() (note that this is not my
requestprocessor, it is the Struts one).
6. My Action.execute returns null...again
7. RequestProcessor.process() returns to ActionServlet.doGet()
I have not changed the ActionServelt at all. Below is the code from
the RequestProcessor (minus imports). ANY help anyone could provide
would be appreciated.
Thanks,
Mike Minella
public class StatementsRequestProcessor extends RequestProcessor
{
public static final String JSP_INDICATOR = ".jsp"; // JSP extension
public static final String GET_INDICATOR = ".get"; // extension for
frameset
public static final String ACTION_INDICATOR = ".do"; // action
extension
public static final String PAGE = "page"; // request parameter
value
public static final String FRAMESET = "/frameset"; // action name for
frameset
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;
}
if (log.isDebugEnabled()) {
log.debug("Processing a '" + request.getMethod() +
"' for path '" + path + "'");
}
// Select a Locale for the current user if requested
processLocale(request, response);
// 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;
}
// determine if the requested page is required within the frameset
String sPageName = request.getRequestURI();
if(sPageName.endsWith(GET_INDICATOR))
{
// forward to frameset, rather than directly to page
request.setAttribute(PAGE, path + ACTION_INDICATOR);
path = FRAMESET;
}
// 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);
if (!processValidate(request, response, form, mapping)) {
return;
}
// 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);
}
}
I am utilizing Struts 1.1 to develop an app. I have subclassed the
RequestProcessor and have overridden the process method. Everything
works fine for the most part. However, when my action returns null as
the ActionForward from it's execute method, here's what happens:
1. ActionServlet.doGet()
2. MyRequestProcessor.process()
3. MyAction.execute() returns null
4. MyRequestProcessor.process() returns to ActionServlet.doGet()
5. ReqeustProcessor.process() (note that this is not my
requestprocessor, it is the Struts one).
6. My Action.execute returns null...again
7. RequestProcessor.process() returns to ActionServlet.doGet()
I have not changed the ActionServelt at all. Below is the code from
the RequestProcessor (minus imports). ANY help anyone could provide
would be appreciated.
Thanks,
Mike Minella
public class StatementsRequestProcessor extends RequestProcessor
{
public static final String JSP_INDICATOR = ".jsp"; // JSP extension
public static final String GET_INDICATOR = ".get"; // extension for
frameset
public static final String ACTION_INDICATOR = ".do"; // action
extension
public static final String PAGE = "page"; // request parameter
value
public static final String FRAMESET = "/frameset"; // action name for
frameset
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;
}
if (log.isDebugEnabled()) {
log.debug("Processing a '" + request.getMethod() +
"' for path '" + path + "'");
}
// Select a Locale for the current user if requested
processLocale(request, response);
// 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;
}
// determine if the requested page is required within the frameset
String sPageName = request.getRequestURI();
if(sPageName.endsWith(GET_INDICATOR))
{
// forward to frameset, rather than directly to page
request.setAttribute(PAGE, path + ACTION_INDICATOR);
path = FRAMESET;
}
// 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);
if (!processValidate(request, response, form, mapping)) {
return;
}
// 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);
}
}