Package org.g4studio.core.mvc.xstruts.chain.contexts

Examples of org.g4studio.core.mvc.xstruts.chain.contexts.ServletActionContext


  // ------------------------------------------------------- Protected Methods
  protected ForwardConfig handle(ActionContext context, Exception exception, ExceptionConfig exceptionConfig,
      ActionConfig actionConfig, ModuleConfig moduleConfig) throws Exception {
    // Look up the remaining properties needed for this handler
    ServletActionContext sacontext = (ServletActionContext) context;
    ActionForm actionForm = (ActionForm) sacontext.getActionForm();
    HttpServletRequest request = sacontext.getRequest();
    HttpServletResponse response = sacontext.getResponse();

    // Handle this exception
    org.g4studio.core.mvc.xstruts.action.ExceptionHandler handler = (org.g4studio.core.mvc.xstruts.action.ExceptionHandler) ClassUtils
        .getApplicationInstance(exceptionConfig.getHandler());
View Full Code Here


   * @throws Exception
   *             if thrown by the <code>Action</code>
   */
  protected ForwardConfig execute(ActionContext context, Action action, ActionConfig actionConfig,
      ActionForm actionForm) throws Exception {
    ServletActionContext saContext = (ServletActionContext) context;

    return (action.execute((ActionMapping) actionConfig, actionForm, saContext.getRequest(),
        saContext.getResponse()));
  }
View Full Code Here

   *            The context for this request
   * @param actionForm
   *            The form bean for this request
   */
  protected ActionErrors validate(ActionContext context, ActionConfig actionConfig, ActionForm actionForm) {
    ServletActionContext saContext = (ServletActionContext) context;
    ActionErrors errors = (actionForm.validate((ActionMapping) actionConfig, saContext.getRequest()));

    // Special handling for multipart request
    if ((errors != null) && !errors.isEmpty()) {
      if (actionForm.getMultipartRequestHandler() != null) {
        if (log.isTraceEnabled()) {
View Full Code Here

   *            The context for this request
   * @param uri
   *            The uri to be included
   */
  protected void perform(ActionContext context, String uri) throws Exception {
    ServletActionContext swcontext = (ServletActionContext) context;

    HttpServletRequest request = swcontext.getRequest();

    RequestDispatcher rd = swcontext.getContext().getRequestDispatcher(uri);

    rd.forward(request, swcontext.getResponse());
  }
View Full Code Here

    // directly depends on ActionServlet
    if (actionCtx instanceof ServletActionContext) {
      // The servlet property of ActionForm is transient, so
      // ActionForms which are restored from a serialized state
      // need to have their servlet restored.
      ServletActionContext sac = (ServletActionContext) actionCtx;

      instance.setServlet(sac.getActionServlet());
    }

    actionCtx.setActionForm(instance);

    scope.put(actionConfig.getAttribute(), instance);
View Full Code Here

*/
public class AuthorizeAction extends AbstractAuthorizeAction {
  // ------------------------------------------------------- Protected Methods
  protected boolean isAuthorized(ActionContext context, String[] roles, ActionConfig mapping) throws Exception {
    // Identify the HTTP request object
    ServletActionContext servletActionContext = (ServletActionContext) context;
    HttpServletRequest request = servletActionContext.getRequest();

    // Check the current user against the list of required roles
    for (int i = 0; i < roles.length; i++) {
      if (request.isUserInRole(roles[i])) {
        return (true);
View Full Code Here

    // Default to unauthorized
    return (false);
  }

  protected String getErrorMessage(ActionContext context, ActionConfig actionConfig) {
    ServletActionContext servletActionContext = (ServletActionContext) context;

    // Retrieve internal message resources
    ActionServlet servlet = servletActionContext.getActionServlet();
    MessageResources resources = servlet.getInternal();

    return resources.getMessage("notAuthorized", actionConfig.getPath());
  }
View Full Code Here

   *            The context for this request
   * @param forwardConfig
   *            The forward to be performed
   */
  protected void perform(ActionContext context, ForwardConfig forwardConfig) throws Exception {
    ServletActionContext sacontext = (ServletActionContext) context;
    String uri = forwardConfig.getPath();

    if (uri == null) {
      ActionServlet servlet = sacontext.getActionServlet();
      MessageResources resources = servlet.getInternal();

      throw new IllegalArgumentException(resources.getMessage("forwardPathNull"));
    }

    HttpServletRequest request = sacontext.getRequest();
    ServletContext servletContext = sacontext.getContext();
    HttpServletResponse response = sacontext.getResponse();

    if (uri.startsWith("/")) {
      uri = resolveModuleRelativePath(forwardConfig, servletContext, request);
    }

View Full Code Here

   *             if a processing exception occurs
   */
  protected ActionContext createActionContextInstance(ServletContext servletContext, HttpServletRequest request,
      HttpServletResponse response) throws ServletException {
    if (this.actionContextClass == null) {
      return new ServletActionContext(servletContext, request, response);
    }

    try {
      if (this.servletActionContextConstructor == null) {
        return (ActionContext) this.actionContextClass.newInstance();
View Full Code Here

TOP

Related Classes of org.g4studio.core.mvc.xstruts.chain.contexts.ServletActionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.