扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在本页阅读全文(共3页)

public class DispatchPortletAction extends DispatchAction ...{
protected ActionForward dispatchMethod(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response, String name) throws Exception ...{
PortletConfig portletConfig = (PortletConfig) request
.getAttribute(WebKeys.JAVAX_PORTLET_CONFIG);
RenderRequest renderRequest = (RenderRequest) request
.getAttribute(WebKeys.JAVAX_PORTLET_REQUEST);
RenderResponse renderResponse = (RenderResponse) request
.getAttribute(WebKeys.JAVAX_PORTLET_RESPONSE);

if (name == null) ...{
return this.unspecified(mapping, form, portletConfig,
renderRequest, renderResponse);
}
Method method = null;
try ...{
method = getMethod(name);

} catch (NoSuchMethodException e) ...{
String message = messages.getMessage("dispatch.method",
mapping.getPath(), name);
log.error(message, e);
String userMsg = messages.getMessage("dispatch.method.user",
mapping.getPath());
throw new NoSuchMethodException(userMsg);
}
ActionForward forward = null;
try ...{
Object args[] = ...{ mapping, form, portletConfig, renderRequest,
renderResponse };
forward = (ActionForward) method.invoke(this, args);

} catch (ClassCastException e) ...{
String message = messages.getMessage("dispatch.return",
mapping.getPath(), name);
log.error(message, e);
throw e;

} catch (IllegalAccessException e) ...{
String message = messages.getMessage("dispatch.error",
mapping.getPath(), name);
log.error(message, e);
throw e;

} catch (InvocationTargetException e) ...{
Throwable t = e.getTargetException();
if (t instanceof Exception) ...{
throw ((Exception) t);
} else ...{
String message = messages.getMessage("dispatch.error",
mapping.getPath(), name);
log.error(message, e);
throw new ServletException(t);
}
}
return (forward);
}
protected String getMethodName(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response,
String parameter) throws Exception ...{
String methodName = request.getParameter(parameter);
if (methodName == null || methodName.length() == 0) ...{
methodName = (String) request.getAttribute(parameter);
}
return methodName;
}
public ActionForward unspecified(ActionMapping mapping, ActionForm form,
PortletConfig config, RenderRequest req, RenderResponse res)
throws Exception ...{
return null;
}
private static Log log = LogFactory.getLog(DispatchPortletAction.class);
protected Class[] types = ...{ ActionMapping.class, ActionForm.class,
PortletConfig.class, RenderRequest.class, RenderResponse.class };
}
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。