예제 #1
0
  public void init(Object obj) {
    if (!Config.getBooleanProperty("ENABLE_SCRIPTING", false)) {
      return;
    }
    ViewContext context = (ViewContext) obj;

    this.request = context.getRequest();
    ctx = context.getVelocityContext();
    try {
      host = WebAPILocator.getHostWebAPI().getCurrentHost(request);
    } catch (PortalException e1) {
      Logger.error(this, e1.getMessage(), e1);
    } catch (SystemException e1) {
      Logger.error(this, e1.getMessage(), e1);
    } catch (DotDataException e1) {
      Logger.error(this, e1.getMessage(), e1);
    } catch (DotSecurityException e1) {
      Logger.error(this, e1.getMessage(), e1);
    }
    userAPI = WebAPILocator.getUserWebAPI();
    try {
      user = userAPI.getLoggedInFrontendUser(request);
      backuser = userAPI.getLoggedInUser(request);
      respectFrontendRoles = true;
    } catch (Exception e) {
      Logger.error(this, "Error finding the logged in user", e);
    }
  }
예제 #2
0
  /**
   * Initializes this tool.
   *
   * @param obj the current ViewContext
   * @throws IllegalArgumentException if the param is not a ViewContext
   */
  public void init(Object obj) {
    if (!(obj instanceof ViewContext)) {
      throw new IllegalArgumentException("Tool can only be initialized with a ViewContext");
    }

    this.context = (ViewContext) obj;
    this.request = context.getRequest();
    this.session = request.getSession(false);
    this.app = context.getServletContext();

    Boolean b = (Boolean) context.getAttribute(ViewContext.XHTML);
    if (b != null) {
      this.xhtml = b.booleanValue();
    }

    /* Is there a mapping associated with this request? */
    ActionConfig config = (ActionConfig) request.getAttribute(Globals.MAPPING_KEY);
    if (config != null) {
      /* Is there a form bean associated with this mapping? */
      this.formName = config.getAttribute();
    }

    ModuleConfig mconfig = ModuleUtils.getInstance().getModuleConfig(request, app);
    this.resources =
        (ValidatorResources) app.getAttribute(ValidatorPlugIn.VALIDATOR_KEY + mconfig.getPrefix());
  }
예제 #3
0
  public void init(Object obj) {
    if (!Config.getBooleanProperty("ENABLE_SCRIPTING", false)) {
      return;
    }

    ViewContext context = (ViewContext) obj;

    this.request = context.getRequest();
    ctx = context.getVelocityContext();
    this.request = context.getRequest();
    this.response = context.getResponse();
  }
예제 #4
0
 public void init(Object obj) {
   ViewContext context = (ViewContext) obj;
   this.request = context.getRequest();
   ctx = context.getVelocityContext();
 }