Package com.opensymphony.xwork2.ognl

Examples of com.opensymphony.xwork2.ognl.OgnlUtilTest


public class SimpleServletConfigInterceptor extends AbstractInterceptor implements StrutsStatics {
  private static final long serialVersionUID = -595817586173434580L;

  public String intercept(ActionInvocation invocation) throws Exception {
    final Object action = invocation.getAction();
    final ActionContext context = invocation.getInvocationContext();

    if (action instanceof ServletRequestAware) {
      HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST);
      ((ServletRequestAware) action).setServletRequest(request);
    }

    if (action instanceof ServletResponseAware) {
      HttpServletResponse response = (HttpServletResponse) context.get(HTTP_RESPONSE);
      ((ServletResponseAware) action).setServletResponse(response);
    }

    return invocation.invoke();
  }
View Full Code Here


  public Map<String, List<String>> getFieldErrors() {
    return validationAware.getFieldErrors();
  }

  public Locale getLocale() {
    ActionContext ctx = ActionContext.getContext();
    if (ctx != null) {
      return ctx.getLocale();
    } else {
      logger.debug("Action context not initialized");
      return null;
    }
  }
View Full Code Here

  protected ClassLoaderInterface getClassLoaderInterface() {
    if (isReloadEnabled()) return new ClassLoaderInterfaceDelegate(reloadingClassLoader);
    else {
      ClassLoaderInterface classLoaderInterface = null;
      ActionContext ctx = ActionContext.getContext();
      if (ctx != null) classLoaderInterface = (ClassLoaderInterface) ctx
          .get(ClassLoaderInterface.CLASS_LOADER_INTERFACE);
      return (ClassLoaderInterface) ObjectUtils.defaultIfNull(classLoaderInterface,
          new ClassLoaderInterfaceDelegate(getClassLoader()));
    }
  }
View Full Code Here

    public void clearActionErrors()
    {
        actionError = null;
        fieldErrors = null;
        // Remove from Session
        ActionContext context = ActionContext.getContext();
        if (context!=null)
            context.getSession().remove(LAST_ACTION_ERROR_ATTRIBUTE);
    }
View Full Code Here

    /*
     * @see org.apache.empire.struts2.action.ActionErrorProvider#getLastActionError(boolean)
     */
    public ErrorInfo getLastActionError(boolean clear)
    {
        ActionContext context = ActionContext.getContext();
        ErrorInfo error = (ErrorInfo)context.getSession().get(LAST_ACTION_ERROR_ATTRIBUTE);
        if (clear)
            context.getSession().remove(LAST_ACTION_ERROR_ATTRIBUTE);
        return error;
    }
View Full Code Here

        if (error instanceof ActionError)
            actionError = ((ActionError)error);
        else
            actionError = new ActionError(error);
        // put Error on session
        ActionContext context = ActionContext.getContext();
        context.getSession().put(LAST_ACTION_ERROR_ATTRIBUTE, actionError);
    }
View Full Code Here

    /*
     * @see org.apache.empire.struts2.action.ActionErrorProvider#getLastActionMessage(boolean)
     */
    public String getLastActionMessage(boolean clear)
    {
        ActionContext context = ActionContext.getContext();
        Object msg = context.getSession().get(LAST_ACTION_MESSAGE_ATTRIBUTE);
        if (clear)
            context.getSession().remove(LAST_ACTION_MESSAGE_ATTRIBUTE);
        return StringUtils.toString(msg);
    }
View Full Code Here

   
    protected void setActionMessage(String message)
    {   // put Message on session
        if (message.startsWith("!"))
            message = getText(message.substring(1));
        ActionContext context = ActionContext.getContext();
        context.getSession().put(LAST_ACTION_MESSAGE_ATTRIBUTE, message);
    }
View Full Code Here

   
    // ------- Request Param accessors -------
   
    public final Map getRequestParameters()
    {
        ActionContext context = ActionContext.getContext();
        return (context!=null) ? context.getParameters() : null;
    }
View Full Code Here

    }
   
    protected Object getActionObject(String name)
    {
        // Get the object key
        ActionContext context = ActionContext.getContext();
        String key = getActionObjectName(context, name);
        if (key==null)
            return null;
        // Get the object from the session
        return context.getSession().get(key);
    }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.ognl.OgnlUtilTest

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.