List of usage examples for javax.servlet.jsp PageContext REQUEST_SCOPE
int REQUEST_SCOPE
To view the source code for javax.servlet.jsp PageContext REQUEST_SCOPE.
Click Source Link
From source file:info.magnolia.cms.taglibs.util.FileSrc.java
/** * @deprecated/*w w w .j a v a 2 s . c o m*/ */ private void setFileProperties() { this.fileExtension = Server.getDefaultExtension(); Content properties = null; String contentNodeCollectionName = (String) pageContext.getAttribute("contentNodeCollectionName", //$NON-NLS-1$ PageContext.REQUEST_SCOPE); if (contentNodeCollectionName == null) { // we are not in a loop try { properties = Resource.getGlobalContentNode(this.request) .getContent(this.nodeDataName + "_properties"); //$NON-NLS-1$ } catch (Exception e) { if (log.isDebugEnabled()) log.debug(e.getMessage()); } } else { try { properties = Resource.getLocalContentNode(this.request) .getContent(this.nodeDataName + "_properties"); //$NON-NLS-1$ } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Exception caught: " + e.getMessage(), e); //$NON-NLS-1$ } } if (properties != null) { this.fileName = properties.getNodeData("fileName").getString(); //$NON-NLS-1$ this.fileExtension = properties.getNodeData("extension").getString(); //$NON-NLS-1$ if (StringUtils.isEmpty(this.fileName)) { this.fileExtendedName = "." + this.fileExtension; //$NON-NLS-1$ } else { this.slash = "/"; //$NON-NLS-1$ this.fileExtendedName = this.fileName; int posLastDot = this.fileName.lastIndexOf("."); //$NON-NLS-1$ int posExt = this.fileName.lastIndexOf("." + this.fileExtension); //$NON-NLS-1$ if (posExt == -1 || (posExt != -1 && posExt != posLastDot)) { // magnolia v 1.0: fileName saved with extension this.fileExtendedName += "." + this.fileExtension; //$NON-NLS-1$ } } } }
From source file:info.magnolia.cms.taglibs.ContentNodeIterator.java
/** * @see javax.servlet.jsp.tagext.Tag#doStartTag() *///from ww w . jav a 2 s . com public int doStartTag() { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); Collection children; try { children = getCollection(request); } catch (PathNotFoundException e) { // ok, this is normal return SKIP_BODY; } catch (AccessDeniedException e) { log.debug(e.getMessage()); return SKIP_BODY; } catch (RepositoryException e) { log.error(e.getMessage(), e); return SKIP_BODY; } this.size = children.size(); pageContext.setAttribute(ContentNodeIterator.SIZE, new Integer(size), PageContext.REQUEST_SCOPE); pageContext.setAttribute(ContentNodeIterator.CURRENT_INDEX, new Integer(this.index), PageContext.REQUEST_SCOPE); pageContext.setAttribute(ContentNodeIterator.CONTENT_NODE_COLLECTION_NAME, this.contentNodeCollectionName, PageContext.REQUEST_SCOPE); Resource.setLocalContentNodeCollectionName(request, this.contentNodeCollectionName); this.contentNodeIterator = children.iterator(); return doIteration() ? EVAL_BODY_INCLUDE : SKIP_BODY; }
From source file:de.micromata.genome.gwiki.page.gspt.ServletStandalonePageContext.java
@Override public int getAttributesScope(String key) { if (pageAttributes.containsKey(key) == true) return PageContext.PAGE_SCOPE; if (contains(request.getAttributeNames(), key) == true) return PageContext.REQUEST_SCOPE; if (session != null) { if (contains(session.getAttributeNames(), key) == true) { return PageContext.SESSION_SCOPE; }//from w w w . jav a2 s .c om } if (contains(servletCtx.getAttributeNames(), key) == true) return PageContext.APPLICATION_SCOPE; return 0; }
From source file:de.hybris.platform.acceleratorcms.tags2.CMSComponentTag.java
protected Map<String, String> createLiveEditAttributes() { final Map<String, String> data = new HashMap<>(); final ContentSlotModel contentSlot = (ContentSlotModel) pageContext.getAttribute("contentSlot", PageContext.REQUEST_SCOPE); if (contentSlot != null) { data.put("data-cms-content-slot", contentSlot.getUid()); }//from w ww . jav a 2s .co m data.put("data-cms-component", currentComponent.getUid()); data.put("data-cms-component-type", currentComponent.getItemtype()); return data; }
From source file:javax.faces.webapp.UIComponentTag.java
/** * Return the nearest JSF tag that encloses this tag. */// w ww . java 2 s. c o m public static UIComponentTag getParentUIComponentTag(PageContext pageContext) { // Question: why not just walk up the _parent chain testing for // instanceof UIComponentTag rather than maintaining a separate // stack with the pushTag and popTag methods? List list = (List) pageContext.getAttribute(COMPONENT_STACK_ATTR, PageContext.REQUEST_SCOPE); if (list != null) { return (UIComponentTag) list.get(list.size() - 1); } return null; }
From source file:com.icesoft.faces.webapp.parser.Parser.java
/** * The main parsing logic. Creates a Digester to parse page into a tag * processing tree, and then executes the JSP lifecycle across that tree. * The end result is a JSF component rooted with a UIViewRoot component. * * @param page The Reader for the page. * @param context// w w w . j ava 2s . c o m * @throws java.io.IOException If stream IO fails. * @throws org.xml.sax.SAXException If digester encounters invalid XML. */ public void parse(Reader page, FacesContext context) throws java.io.IOException, org.xml.sax.SAXException { // Need a mock pageContext StubPageContext pageContext = new StubPageContext(context); Set componentIds = new HashSet(); //placeholder tag and wire XhtmlTag rootTag = new XhtmlTag(); rootTag.setTagName("ICEtag"); rootTag.setParent(null); TagWire rootWire = new TagWire(); rootWire.setTag(rootTag); TagWire realViewWire = null; String viewTagClassName = null; synchronized (this) { digester.clear(); digester.push(rootTag); digester.push(rootWire); digester.parse(page); realViewWire = digester.getViewWire(); viewTagClassName = digester.getViewTagClassName(); } try { // #2551 We have captured the real View Tag (from wherever it was in the tree) // now we check to see if it's the first child of this fake root, and // if not, make it so. // We do this by taking all top level siblings of the fake root, and // making them the first children of the real view root, and replacing // the original viewRoot with its children in the hiearchy. // This duplicates what the previous code was doing, except the created // ViewTag has the attributes set Tag viewTag; if (null != realViewWire) { viewTag = realViewWire.getTag(); transmogrifyHierarchy(realViewWire, rootWire); viewTag.setParent(null); } else { //fallback case for pages with no view tag if (null == viewTagClassName) throw new IllegalStateException( "ICEfaces parser unable to determine JSF implementation ViewTag class."); viewTag = (Tag) Class.forName(viewTagClassName).newInstance(); rootWire.setTag(viewTag); realViewWire = rootWire; viewTag.setParent(null); } executeJspLifecycle(realViewWire, pageContext, context, componentIds); pageContext.removeAttribute("javax.faces.webapp.COMPONENT_TAG_STACK", PageContext.REQUEST_SCOPE); pageContext.removeAttribute("javax.faces.webapp.GLOBAL_ID_VIEW", PageContext.REQUEST_SCOPE); } catch (Exception e) { log.error("Failed to execute JSP lifecycle.", e); if (log.isDebugEnabled()) { log.debug("Dumping Tag Hierarchy"); if (realViewWire != null) { displayHierarchy(realViewWire); } else { displayHierarchy(rootWire); } } throw new FacesException("Failed to execute JSP lifecycle.", e); } }
From source file:de.micromata.genome.gwiki.page.gspt.ServletStandalonePageContext.java
@Override public void setAttribute(String key, Object value, int scope) { if (value == null) { removeAttribute(key, scope);/*from www . j a va2 s. c om*/ return; } switch (scope) { case PageContext.PAGE_SCOPE: pageAttributes.put(key, value); break; case PageContext.REQUEST_SCOPE: request.setAttribute(key, value); break; case PageContext.SESSION_SCOPE: if (session != null) { session.setAttribute(key, value); } break; case PageContext.APPLICATION_SCOPE: servletCtx.setAttribute(key, value); break; default: break; } }
From source file:eionet.cr.util.Util.java
/** * * @param pageContext//w w w. j av a 2 s .c om * @param objectClass * @return */ public static Object findInAnyScope(PageContext pageContext, Class objectClass) { if (pageContext == null || objectClass == null) { return null; } int[] scopes = { PageContext.APPLICATION_SCOPE, PageContext.PAGE_SCOPE, PageContext.REQUEST_SCOPE, PageContext.SESSION_SCOPE }; for (int i = 0; i < scopes.length; i++) { Enumeration attrs = pageContext.getAttributeNamesInScope(scopes[i]); while (attrs != null && attrs.hasMoreElements()) { String name = (String) attrs.nextElement(); Object o = pageContext.getAttribute(name, scopes[i]); if (o != null && objectClass.isInstance(o)) { return o; } } } return null; }
From source file:info.magnolia.cms.taglibs.ContentNodeIterator.java
/** * @return//from ww w.jav a2 s.c o m */ private boolean doIteration() { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); if (this.contentNodeIterator.hasNext()) { if (this.end != null && this.index > this.end.intValue()) { return false; } pageContext.setAttribute(ContentNodeIterator.CURRENT_INDEX, new Integer(this.index), PageContext.REQUEST_SCOPE); if (StringUtils.isNotEmpty(varStatus)) { pageContext.setAttribute(varStatus, getLoopStatus()); } for (int j = 0; j < this.step; j++) { current = this.contentNodeIterator.next(); Resource.setLocalContentNode(request, (Content) current); } this.index++; return true; } return false; }
From source file:com.geemvc.taglib.GeemvcTagSupport.java
protected Object attribute(String name) { Object bean = jspContext.getAttribute(name, PageContext.PAGE_SCOPE); if (bean == null) bean = jspContext.getAttribute(name, PageContext.REQUEST_SCOPE); if (bean == null) bean = jspContext.getAttribute(name, PageContext.SESSION_SCOPE); return bean;//w w w . j a va 2s .co m }