Example usage for javax.servlet.jsp PageContext REQUEST_SCOPE

List of usage examples for javax.servlet.jsp PageContext REQUEST_SCOPE

Introduction

In this page you can find the example usage for javax.servlet.jsp PageContext REQUEST_SCOPE.

Prototype

int REQUEST_SCOPE

To view the source code for javax.servlet.jsp PageContext REQUEST_SCOPE.

Click Source Link

Document

Request scope: the named reference remains available from the ServletRequest associated with the Servlet until the current request is completed.

Usage

From source file:com.steeleforge.aem.ironsites.wcm.taglib.ModeHelperTag.java

protected void setupModeMap() {
    if (null == pageContext.getAttribute(getMapName(), PageContext.REQUEST_SCOPE)) {
        Map<String, Boolean> modeMap = new HashMap<String, Boolean>();

        // DISABLED, EDIT, PREVIEW, ANALYTICS, READ_ONLY, DESIGN
        modeMap.put(PROPERTY_DISABLED, WCMMode.DISABLED.equals(mode));
        modeMap.put(PROPERTY_DISABLED.toLowerCase(), WCMMode.DISABLED.equals(mode));

        modeMap.put(PROPERTY_EDIT, WCMMode.EDIT.equals(mode));
        modeMap.put(PROPERTY_EDIT.toLowerCase(), WCMMode.EDIT.equals(mode));

        modeMap.put(PROPERTY_PREVIEW, WCMMode.PREVIEW.equals(mode));
        modeMap.put(PROPERTY_PREVIEW.toLowerCase(), WCMMode.PREVIEW.equals(mode));

        modeMap.put(PROPERTY_ANALYTICS, WCMMode.ANALYTICS.equals(mode));
        modeMap.put(PROPERTY_ANALYTICS.toLowerCase(), WCMMode.ANALYTICS.equals(mode));

        modeMap.put(PROPERTY_READ_ONLY, WCMMode.READ_ONLY.equals(mode));
        modeMap.put(PROPERTY_READ_ONLY.toLowerCase(), WCMMode.READ_ONLY.equals(mode));

        modeMap.put(PROPERTY_DESIGN, WCMMode.DESIGN.equals(mode));
        modeMap.put(PROPERTY_DESIGN.toLowerCase(), WCMMode.DESIGN.equals(mode));

        pageContext.setAttribute(getMapName(), modeMap, PageContext.PAGE_SCOPE);
    }/* w  w  w  . j  av a 2  s  .  co  m*/
}

From source file:de.hybris.platform.addonsupport.renderer.impl.DefaultAddOnCMSComponentRenderer.java

protected int getScopeForVariableName(@SuppressWarnings("unused") final String variableName) {
    return PageContext.REQUEST_SCOPE;
}

From source file:net.mlw.vlh.web.tag.ValueListSpaceTag.java

/**
 * @see javax.servlet.jsp.tagext.Tag#doStartTag()
 */// w ww .  jav a2 s .  c o m
public int doStartTag() throws JspException {

    parentRootTag = (ValueListSpaceTag) findAncestorWithClass(this, ValueListSpaceTag.class);

    Object bean;

    if ("session".equals(valueListScope)) {
        bean = pageContext.getAttribute(valueListName, PageContext.SESSION_SCOPE);
    } else if ("application".equals(valueListScope)) {
        bean = pageContext.getAttribute(valueListName, PageContext.APPLICATION_SCOPE);
    } else {
        bean = pageContext.getAttribute(valueListName, PageContext.REQUEST_SCOPE);
    }

    if (bean != null) {
        if (bean instanceof ValueList) {
            setValueList((ValueList) bean);
        } else if (bean instanceof List) {
            setValueList(new DefaultListBackedValueList((List) bean));
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("List '" + valueListName + "' was wrapped with DefaultListBackedValueList.");
            }
        } else {
            String msg = "ValueList '" + valueListName + "' of of unknown type " + bean.getClass().getName()
                    + "!";
            LOGGER.warn(msg);
        }
    } else {
        LOGGER.error("ValueList '" + valueListName + "'  was not found in the scope '"
                + (valueListScope == null ? "request" : valueListScope) + "'!");
    }

    if (bean != null) {
        pageContext.setAttribute(valueListName, bean);
    }

    tableInfo.setName(valueListName);
    tableInfo.setConfig(getConfig());
    tableInfo.setPageContext(pageContext);
    // TODO Do not swallow this!!!!!
    pageContext.setAttribute(ImagesHomeDisplayHelper.IMAGES_HOME_ATTRIBUTE_KEY,
            ((HtmlDisplayProvider) tableInfo.getConfig().getDisplayProvider("html"))
                    .getImageHome((HttpServletRequest) pageContext.getRequest()));
    /**
     * @author Luciano Cunha
     */
    excludeParameters();

    return super.doStartTag();
}

From source file:jp.troter.tags.capture.ContentForTag.java

public void concatToContextValue(String name, LinkedList<String> current) {
    String value = StringUtils.isBlank(this.value) ? this.body : this.value;
    value = CaptureUtil.nullToEmpty(value);
    if (!duplicate && current.contains(value)) {
        return;//w w w . j a va2s  .com
    }

    if (addFirst) {
        current.addFirst(value);
    } else {
        current.add(value);
    }

    pageContext.setAttribute(name, current, PageContext.REQUEST_SCOPE);
}

From source file:info.magnolia.cms.taglibs.LoadPage.java

/**
 * @see javax.servlet.jsp.tagext.Tag#doEndTag()
 *//*from w  w w  . jav  a2 s.c  o  m*/
public int doEndTag() {
    HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
    Content newActpage = Resource.getCurrentActivePage(req);
    if (StringUtils.isNotEmpty(this.templateName)) {
        Content startPage;
        try {
            startPage = Resource.getCurrentActivePage(req).getAncestor(this.level);
            HierarchyManager hm = MgnlContext.getHierarchyManager(ContentRepository.WEBSITE);
            newActpage = hm.getPage(startPage.getHandle(), this.templateName);
        } catch (RepositoryException e) {
            log.error(e.getMessage());
            return EVAL_PAGE;
        }
    } else if (StringUtils.isNotEmpty(this.path)) {
        try {
            newActpage = MgnlContext.getHierarchyManager(ContentRepository.WEBSITE).getContent(this.path);
        } catch (Exception e) {
            log.error(e.getMessage());
            return EVAL_PAGE;
        }
    } else {
        try {
            newActpage = Resource.getCurrentActivePage(req).getAncestor(this.level);
        } catch (Exception e) {
            log.error(e.getMessage());
            return EVAL_PAGE;
        }
    }
    pageContext.setAttribute(Aggregator.CURRENT_ACTPAGE, newActpage, PageContext.REQUEST_SCOPE);
    return EVAL_PAGE;
}

From source file:com.trenako.web.tags.LocalizedTextAreaTags.java

protected BindStatus getBindStatus() throws JspException {
    String resolvedPath = ExpressionEvaluationUtils.evaluateString("path", getPath(), pageContext);
    String nestedPath = (String) pageContext.getAttribute(NestedPathTag.NESTED_PATH_VARIABLE_NAME,
            PageContext.REQUEST_SCOPE);

    if (nestedPath != null && !resolvedPath.startsWith(nestedPath)
            && !resolvedPath.equals(nestedPath.substring(0, nestedPath.length() - 1))) {
        resolvedPath = nestedPath + resolvedPath;
    }/* w  w w. j a va 2s.com*/

    return new BindStatus(getRequestContext(), resolvedPath, isHtmlEscape());
}

From source file:org.gvnix.datatables.tags.RooTableTag.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//  www  . ja  v a  2s  .co  m
public int doStartTag() throws JspException {
    if (!doRender()) {
        return SKIP_BODY;
    }

    // Add reference to this tag as request attributes
    // to assure it's available for columns tags
    pageContext.setAttribute(TABLE_TAG_VARIABLE, this, PageContext.REQUEST_SCOPE);

    Boolean serverSide = (Boolean) stagingConf.get(Configuration.AJAX_SERVERSIDE);

    // Check url value
    if (serverSide != null && serverSide) {
        if (StringUtils.isBlank(url) && StringUtils.isNotBlank(path)) {
            // generate url based on path
            setUrl(path.concat("/datatables/ajax"));
        } else {
            setUrl(url);
        }
    } else {
        // Check dom data
        if (data != null) {
            setData((Collection) data);
        }
    }

    int value = super.doStartTag();

    return value;
}

From source file:net.sourceforge.fenixedu.presentationTier.TagLib.content.ContentLinkTag.java

public static int getPageScope(final String scope) {
    if (scope == null) {
        return -1;
    } else if (scope.equalsIgnoreCase("page")) {
        return PageContext.PAGE_SCOPE;
    } else if (scope.equalsIgnoreCase("request")) {
        return PageContext.REQUEST_SCOPE;
    } else if (scope.equalsIgnoreCase("session")) {
        return PageContext.SESSION_SCOPE;
    } else {//from   w w  w . java  2s .  c  o  m
        return -1;
    }
}

From source file:com.googlecode.jtiger.modules.ecside.util.ExtremeUtils.java

/**
 * Get the bean out of the proper scope.
 *///from w w w .j  ava 2 s . c  o m
public static Object retrieveFromScope(PageContext pageContext, String name, String scope) {
    if (StringUtils.isBlank(scope)) {
        return pageContext.findAttribute(name);
    }

    int scopeType = PageContext.REQUEST_SCOPE;

    if (scope.equalsIgnoreCase("page")) {
        scopeType = PageContext.PAGE_SCOPE;
    } else if (scope.equalsIgnoreCase("application")) {
        scopeType = PageContext.APPLICATION_SCOPE;
    } else if (scope.equalsIgnoreCase("session")) {
        scopeType = PageContext.SESSION_SCOPE;
    }

    return pageContext.getAttribute(name, scopeType);
}

From source file:gov.nih.nci.cabig.caaers.web.tags.csm.CSMAccessControlTag.java

/**
 * Populates the variable in the specified scope. 
 * @param varValue/*w  ww  . j a  v  a 2  s .co m*/
 */
private void setVariable(boolean varValue) {

    if (var == null)
        return;

    int intScope = StringUtils.equals(scope, "request") ? PageContext.REQUEST_SCOPE
            : StringUtils.equals(scope, "session") ? PageContext.SESSION_SCOPE
                    : StringUtils.equals(scope, "application") ? PageContext.APPLICATION_SCOPE
                            : PageContext.PAGE_SCOPE;

    pageContext.setAttribute(getVar(), varValue, intScope);
}