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
/** * @see javax.servlet.jsp.tagext.Tag#doStartTag() *//*from w w w . j a v a 2 s . c om*/ public int doStartTag() { this.request = (HttpServletRequest) pageContext.getRequest(); this.actpage = Resource.getCurrentActivePage(request); if (StringUtils.isNotEmpty(this.contentNodeName)) { try { this.contentNode = this.actpage.getContent(this.contentNodeName); } catch (RepositoryException re) { writeSrc(StringUtils.EMPTY); } if (this.contentNode == null) { writeSrc(StringUtils.EMPTY); return SKIP_BODY; } } else { this.contentNode = Resource.getLocalContentNode(request); if (this.contentNode == null) { this.contentNode = Resource.getGlobalContentNode(request); } if (this.contentNode != null) { this.contentNodeName = this.contentNode.getName(); } else { writeSrc(StringUtils.EMPTY); return SKIP_BODY; } } if (StringUtils.isEmpty(this.nodeDataName)) { writeSrc(StringUtils.EMPTY); return SKIP_BODY; } try { this.nodeData = this.contentNode.getNodeData(this.contentNodeName); } catch (Exception e) { writeSrc(StringUtils.EMPTY); return SKIP_BODY; } if (this.nodeData == null) { writeSrc(StringUtils.EMPTY); return SKIP_BODY; } setFileProperties(); String contentNodeCollectionName = (String) pageContext.getAttribute("contentNodeCollectionName", //$NON-NLS-1$ PageContext.REQUEST_SCOPE); if (this.fileNameOnly.equals("true")) { //$NON-NLS-1$ try { writeSrc(this.fileExtendedName); } catch (Exception e) { if (log.isDebugEnabled()) log.debug(e.getMessage()); } } else { if (contentNodeCollectionName == null) { // we are not in a loop try { writeSrc(this.contentNode.getHandle() + "/" //$NON-NLS-1$ + this.nodeDataName + this.slash + this.fileExtendedName); } catch (Exception e) { if (log.isDebugEnabled()) log.debug(e.getMessage()); } } else { try { writeSrc(Resource.getLocalContentNode(request).getHandle() + "/" //$NON-NLS-1$ + this.nodeDataName + this.slash + this.fileExtendedName); } catch (Exception e) { if (log.isDebugEnabled()) log.debug(e.getMessage()); } } } return EVAL_PAGE; }
From source file:org.springmodules.validation.bean.annotation.javascript.taglib.BeanAnnotationValidateTag.java
public int doEndTag() throws JspException { if (cotvc == null) { findConverter();/*from ww w . j a va2 s.com*/ } try { if (commandObj == null) { // favour commandObj over command name commandObj = this.pageContext.getAttribute(commandName, PageContext.REQUEST_SCOPE); if (commandName == null || commandObj == null) { logger.error("Command object not found"); return EVAL_PAGE; } } JspWriter out = pageContext.getOut(); Locale locale = getRequestContext().getLocale(); WebApplicationContext webApplicationContext = getRequestContext().getWebApplicationContext(); MessageSourceAccessor messages = new MessageSourceAccessor(webApplicationContext, locale); out.write("<script type=\"text/javascript\" id=\"" + commandName + "ValangValidator\">\n"); cotvc.writeJS(commandName, commandObj, globalVar, validateOnSubmit, out, messages); out.write("\n</script>"); return EVAL_PAGE; } catch (IOException e) { throw new JspException("Could not write validation rules", e); } }
From source file:com.steeleforge.aem.ironsites.wcm.taglib.ModeHelperTag.java
protected void setupModeObject() { if (null == pageContext.getAttribute(getWcmmodeName(), PageContext.REQUEST_SCOPE)) { pageContext.setAttribute(getWcmmodeName(), mode, PageContext.REQUEST_SCOPE); }/* w ww. ja va2s . c o m*/ }
From source file:de.micromata.genome.gwiki.page.gspt.ServletStandalonePageContext.java
@Override public Object getAttribute(String key, int scope) { switch (scope) { case PageContext.REQUEST_SCOPE: return request.getAttribute(key); case PageContext.APPLICATION_SCOPE: return servletCtx.getAttribute(key); case PageContext.SESSION_SCOPE: if (session != null) { return session.getAttribute(key); }// w w w. j av a2s . c o m return null; default: return pageAttributes.get(key); } }
From source file:ar.com.zauber.commons.web.uri.assets.AbstractSpringTag.java
/** * @return the {@link AssetRepository} * Search path:// w ww .j a v a 2 s. c om * - If there is one configured in the context we use that * - if not we create one and put it in the PageContext. */ protected final AssetRepository getAssetRepository() { return resolve(AssetRepository.class, SpringBeans.REPOSITORY_KEY, REQUEST_ASSET_REPOSITORY, REQUEST_ASSET_WARNING, ASSETS_REPOSITORY_FACTORY, PageContext.REQUEST_SCOPE); }
From source file:org.hdiv.web.servlet.tags.form.FormTagTests.java
public void testWithActionFromRequest() throws Exception { String fooValue = this.confidentiality ? "0" : "bar"; queryString = "foo=" + fooValue; request.setQueryString(queryString); request.addParameter("foo", "bar"); String commandName = "myCommand"; String enctype = "my/enctype"; String method = "POST"; String onsubmit = "onsubmit"; String onreset = "onreset"; this.tag.setCommandName(commandName); this.tag.setEnctype(enctype); this.tag.setMethod(method); this.tag.setOnsubmit(onsubmit); this.tag.setOnreset(onreset); int result = this.tag.doStartTag(); assertEquals(Tag.EVAL_BODY_INCLUDE, result); assertEquals("Command name not exposed", commandName, getPageContext().getAttribute(MODEL_ATTRIBUTE_VARIABLE_NAME, PageContext.REQUEST_SCOPE)); result = this.tag.doEndTag(); assertEquals(Tag.EVAL_PAGE, result); this.tag.doFinally(); assertNull("Command name not cleared after tag ends", getPageContext().getAttribute(MODEL_ATTRIBUTE_VARIABLE_NAME, PageContext.REQUEST_SCOPE)); String output = getWriter().toString(); assertFormTagOpened(output);/*from w w w.jav a 2s .c o m*/ assertFormTagClosed(output); assertContainsAttribute(output, "action", REQUEST_URI + "?" + queryString); assertContainsAttribute(output, "enctype", enctype); assertContainsAttribute(output, "method", method); assertContainsAttribute(output, "onsubmit", onsubmit); assertContainsAttribute(output, "onreset", onreset); }
From source file:de.micromata.genome.gwiki.page.gspt.ServletStandalonePageContext.java
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override/*from w w w .j av a 2s . c o m*/ public Enumeration getAttributeNamesInScope(int scope) { switch (scope) { case PageContext.REQUEST_SCOPE: return request.getAttributeNames(); case PageContext.SESSION_SCOPE: if (session != null) { return session.getAttributeNames(); } return IteratorUtils.asEnumeration(IteratorUtils.EMPTY_ITERATOR); case PageContext.APPLICATION_SCOPE: return servletCtx.getAttributeNames(); default: return IteratorUtils.asEnumeration(pageAttributes.keySet().iterator()); } }
From source file:net.ontopia.topicmaps.nav2.utils.FrameworkUtils.java
/** * INTERNAL: Returns the values retrieved from the given variable * names or qnames in the order given./* www . j a v a2 s . c o m*/ * * @param params - variable names or qnames, separated by whitespaces. */ private static List getMultipleValuesAsList(String params, PageContext pageContext) throws JspTagException { log.debug("getMultipleValuesAsList"); // find parsecontext NavigatorPageIF ctxt = (NavigatorPageIF) pageContext.getAttribute(NavigatorApplicationIF.CONTEXT_KEY, PageContext.REQUEST_SCOPE); ParseContextIF pctxt = (ParseContextIF) ctxt.getDeclarationContext(); // get the values String[] names = StringUtils.split(params); List varlist = new ArrayList(names.length); for (int i = 0; i < names.length; i++) { Collection values; if (names[i].indexOf(':') != -1) { // it's a qname try { values = Collections.singleton(pctxt.getObject(new QName(names[i]))); } catch (AntlrWrapException e) { throw new JspTagException(e.getException().getMessage() + " (in action parameter list)"); } } else // it's a variable name values = InteractionELSupport.extendedGetValue(names[i], pageContext); varlist.add(values); } return varlist; }
From source file:org.hdiv.web.servlet.tags.UrlTagTests.java
public void testVarExplicitScope() throws JspException { tag.setValue("url/path"); tag.setVar("var"); tag.setScope("request"); tag.doStartTag();/*from w w w .j ava2s . c o m*/ tag.doEndTag(); String expectedValue = "/" + "url/path?" + this.hdivParameter; String actual = (String) context.getAttribute("var", PageContext.REQUEST_SCOPE); assertTrue(actual.startsWith(expectedValue)); }
From source file:ams.fwk.customtag.AmsDownloadTag.java
protected List getUploads() { List result = null;//from w ww. j a va 2s . com if (!"N/A".equals(typeId)) { result = (List) pageContext.getAttribute("j_files_" + programId + "_" + fileSeqNo, PageContext.REQUEST_SCOPE); if (result == null) { result = fum.getUploads(fileSeqNo, null, null); pageContext.setAttribute("j_files_" + programId + "_" + fileSeqNo, result, PageContext.REQUEST_SCOPE); } } else { result = fum.getUploads(fileSeqNo, null, null); } return result; }