Gets the PageContext scope value for the textual scope name.

@exception  JspTagException  if invalid scope
172229
public static int getScopeId(String scope) throws JspTagException {
		if(scope==null || PAGE.equals(scope)) return PageContext.PAGE_SCOPE;
		else if(REQUEST.equals(scope)) return PageContext.REQUEST_SCOPE;
		else if(SESSION.equals(scope)) return PageContext.SESSION_SCOPE;
		else if(APPLICATION.equals(scope)) return PageContext.APPLICATION_SCOPE;
		else throw new LocalizedJspTagException(ApplicationResources.accessor, "Scope.scope.invalid", scope);
	}
50120
public int doEndTag() throws JspException
    {
        Object val = evaluateDataSource();

        ServletRequest req = pageContext.getRequest();

        if (_dataInput != null) {
            val = _dataInput.toString();
        }

        // if there were expression errors report them
        if (hasErrors())
            return reportAndExit(SKIP_BODY);

        if (val != null) {
            _value = val.toString();
        }

        // Create an appropriate "input" element based on our parameters
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        if (_value != null) {
            InternalStringBuilder sb = new InternalStringBuilder(_value.length() + 16);
            StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb);
            HtmlUtils.filter(_value, sbAppend);
            _state.value = sb.toString();
        }

        // correct for null text here
        if (_state.value == null)
            _state.value = "";

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);

        hiddenTag.doStartTag(writer, _state);
        hiddenTag.doEndTag(writer);

        if (!ref.isNull())
            write((String) ref.getRef());

        // Continue processing this page
        localRelease();
        return SKIP_BODY;
    }
1331479
public static PageFlowContext getContext() {
        PageFlowContext ctxt = (PageFlowContext) pageflowContext.get();
        if (ctxt == null) {
            ctxt = new PageFlowContext();
            pageflowContext.set(ctxt);
        }
        return ctxt;
    }
667662
public int doEndTag() throws JspException
    {
        popIdScope();
        
        // if there are errors then we should output the error table
        ErrorHandling.reportCollectedErrors(pageContext, this);

        // The body tag may cause the scope Div to be closed, if not we must do it now
        //if (getIdScope() != null && !_scopeEnded) {
        //    _writer.append("</div>");
        //}

        // the script can be written out by another tag,  typically this would be the <body> tag.
        writeScript(_writer);

        // close the html tag
        if (!_scopeEnded)
            _writer.append("\n");
        _br.doEndTag(_writer);
        localRelease();
        return EVAL_PAGE;
    }
522445
private String getNarrowestScope(FacesContext facesContext, String valueExpression)
    {
        List<String> expressions = extractExpressions(valueExpression);
        // exclude NONE scope, if there are more than one ValueExpressions (see Spec for details)
        String narrowestScope = expressions.size() == 1 ? NONE : APPLICATION;
        boolean scopeFound = false;
        
        for (String expression : expressions)
        {
            String valueScope = getScope(facesContext, expression);
            if (valueScope == null)
            {
                continue;
            }
            // we have found at least one valid scope at this point
            scopeFound = true;
            if (SCOPE_COMPARATOR.compare(valueScope, narrowestScope) < 0)
            {
                narrowestScope = valueScope;
            }
        }
        
        return scopeFound ? narrowestScope : null;
    }
1320586
public int doEndTag() throws JspException
    {
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        String idScript = null;
        String altText = null;
        char accessKey = 0x00;

        // Remove the page scope attributes we created
        pageContext.removeAttribute(RADIOBUTTONGROUP_KEY);
        ServletRequest req = pageContext.getRequest();
        if (_cr == null)
            _cr = TagRenderingBase.Factory.getConstantRendering(req);

        //InternalStringBuilder results = new InternalStringBuilder(128);
        if (_saveBody != null)
            write(_saveBody.toString());

        // if this is a repeater we output the content during the body processing
        if (_repeater) {
            // Render a tag representing the end of our current form
            if (isVertical())
                _cr.end_TABLE(_writer);

            if (idScript != null)
                write(idScript);

            //write(results.toString());
            localRelease();
            return EVAL_PAGE;
        }

        // Render a tag representing the end of our current form
        if (_dynamicAttrs instanceof Map) {
            Map dynamicRadiosMap = (Map) _dynamicAttrs;
            Iterator keyIterator = dynamicRadiosMap.keySet().iterator();
            int idx = 0;
            while (keyIterator.hasNext()) {
                Object optionValue = keyIterator.next();
                String optionDisplay = null;
                if (dynamicRadiosMap.get(optionValue) != null) {
                    optionDisplay = dynamicRadiosMap.get(optionValue).toString();
                }
                else {
                    optionDisplay = "";
                }

                if (optionValue != null) {
                    addOption(_writer, INPUT_RADIO, optionValue.toString(), optionDisplay, idx++, altText, accessKey, _disabled);
                }
                
                if (hasErrors()) {
                    reportErrors();
                    localRelease();
                    return EVAL_PAGE;
                }
                write("\n");

            }
        }
        else {
            assert(_dynamicAttrs instanceof Iterator);

            Iterator it = (Iterator) _dynamicAttrs;
            int idx = 0;
            while (it.hasNext()) {
                Object o = it.next();
                if (o == null)
                    continue;

                if (o instanceof GroupOption) {
                    GroupOption go = (GroupOption) o;
                    addOption(_writer, INPUT_RADIO, go.getValue(), go.getName(), idx++, go.getAlt(), go.getAccessKey(), _disabled);
                }
                else {
                    String radioValue = o.toString();
                    addOption(_writer, INPUT_RADIO, radioValue, radioValue, idx++, altText, accessKey, _disabled);
                }
                if (hasErrors()) {
                    reportErrors();
                    localRelease();
                    return EVAL_PAGE;
                }
                write("\n");
            }
        }

        if (isVertical()) {
            _cr.end_TABLE(_writer);
        }

        if (idScript != null)
            write(idScript);

        //write(results.toString());
        localRelease();
        return EVAL_PAGE;
    }
67726
private static Object getSessionVar(HttpServletRequest request, ServletContext servletContext, String name)
    {
        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();

        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName = ScopedServletUtils.getScopedSessionAttrName(name, unwrappedRequest);
        return sh.getAttribute( rc, attrName );
    }
784668
public static LocalizationContext getLocalizationContext(PageContext pc, String basename) {

        LocalizationContext locCtxt = null;
        ResourceBundle bundle = null;

        if ((basename == null) || basename.equals("")) {
            return new LocalizationContext();
        }

        // Try preferred locales
        Locale pref = getLocale(pc, javax.servlet.jsp.jstl.core.Config.FMT_LOCALE);
        if (pref != null) {
            // Preferred locale is application-based
            bundle = findMatch(basename, pref);
            if (bundle != null) {
                locCtxt = new LocalizationContext(bundle, pref);
            }
        }

        if (locCtxt == null) {
            // No match found with preferred locales, try using fallback locale
            locCtxt = BundleSupport.getLocalizationContext(pc, basename);
        } else {
            // set response locale
            if (locCtxt.getLocale() != null) {
                setResponseLocale(pc, locCtxt.getLocale());
            }
        }

        return locCtxt;
    }
231458
private void lookupBeanScopeAndName(HttpServletRequest request, ServletContext servletContext)
            throws JspException
    {
        // Look up the application module configuration information we need
        _appConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);
        if (_appConfig == null) { // Backwards compatibility hack
            _appConfig = (ModuleConfig) servletContext.getAttribute(Globals.MODULE_KEY);
        }
        if (_appConfig == null) {
            registerTagError(Bundle.getString("Tags_FormNoApplicationConfig"), null);
            return;
        }
        _servlet = (ActionServlet) servletContext.getAttribute(Globals.ACTION_SERVLET_KEY);
        _flowController = PageFlowUtils.getCurrentPageFlow(request, pageContext.getServletContext());

        // check to see if this is a bad action
        
        PageFlowTagUtils.MappingAndController mac = PageFlowTagUtils.getActionMapping(request, _flowController, _state.action);
        if (mac == null) {
            FlowController globalApp = PageFlowUtils.getSharedFlow(InternalConstants.GLOBALAPP_CLASSNAME, request);
            mac = PageFlowTagUtils.getActionMapping(request, globalApp, _state.action);
        }
        if (mac == null) {
            registerTagError(Bundle.getString("Tags_BadAction", _state.action), null);
            return;
        }

        _flowController = mac.controller;
        _mapping = mac.mapping;
        assert (_mapping != null) : "Mapping not found for controller";
        _appConfig = _mapping.getModuleConfig();

        // Were the required values already specified?
        if (_beanName != null) {
            if (!_explicitBeanType) {
                registerTagError(Bundle.getString("Tags_FormNameNoType"), null);
                return;
            }
            if (_beanScope == null)
                _beanScope = "session";
            return;
        }

        // Look up the form bean definition
        FormBeanConfig formBeanConfig = _appConfig.findFormBeanConfig(_mapping.getName());
        if (formBeanConfig == null) {
            // clear any _beanType
            _beanType = null;
        }
        else {
            // Calculate the required values
            _beanName = _mapping.getAttribute();
            _beanScope = _mapping.getScope();
            _beanType = formBeanConfig.getType();
        }
    }
145900
private void copyTagToPageScope(int scope) {
	Iterator iter = null;

	switch (scope) {
	case VariableInfo.NESTED:
	    if (nestedVars != null) {
		iter = nestedVars.iterator();
	    }
	    break;
	case VariableInfo.AT_BEGIN:
	    if (atBeginVars != null) {
		iter = atBeginVars.iterator();
	    }
	    break;
	case VariableInfo.AT_END:
	    if (atEndVars != null) {
		iter = atEndVars.iterator();
	    }
	    break;
	}

	while ((iter != null) && iter.hasNext()) {
	    String varName = (String) iter.next();
	    Object obj = getAttribute(varName);
	    varName = findAlias(varName);
	    if (obj != null) {
		invokingJspCtxt.setAttribute(varName, obj);
	    } else {
		invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE);
	    }
	}
    }
513310
public Variables beforeCall(PageContext pc) {
	Variables parent = pc.variablesScope();
	pc.setVariablesScope(scope);
	return parent;
    }
446039
public int doEndTag() throws JspException
    {
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
        ServletContext context = pageContext.getServletContext();

        try {
            boolean encoded = false;
            UrlConfig urlConfig = ConfigUtil.getConfig().getUrlConfig();
            if (urlConfig != null) {
                encoded = !urlConfig.isUrlEncodeUrls();
            }

            FreezableMutableURI uri = new FreezableMutableURI();
            uri.setEncoding(response.getCharacterEncoding());
            uri.setURI(url, encoded);
            boolean needsToBeSecure = false;
            if (_params != null) {
                uri.addParameters(_params, false );
            }
            if (!uri.isAbsolute() && PageFlowUtils.needsToBeSecure(context, request, url, true)) {
                needsToBeSecure = true;
            }

            URLRewriterService.rewriteURL(context, request, response, uri, URLType.ACTION, needsToBeSecure);
            String key = PageFlowUtils.getURLTemplateKey(URLType.ACTION, needsToBeSecure);
            boolean forXML = TagRenderingBase.Factory.isXHTML(request);
            URIContext uriContext = URIContextFactory.getInstance(forXML);
            String uriString = URLRewriterService.getTemplatedURL(context, request, uri, key, uriContext);
            write(response.encodeURL(uriString));
        }
        catch (URISyntaxException e) {
            // report the error...
            String s = Bundle.getString("Tags_RewriteURL_URLException",
                    new Object[]{url, e.getMessage()});
            registerTagError(s, e);
            reportErrors();
        }

        localRelease();
        return EVAL_PAGE;
    }
920362
public int doEndTag() throws JspException {
        // Trim
        String trimmed = truncateWS(bodyContent.getString());
        try {
            // Print trimmed content
            //pageContext.getOut().print("<!--TWS-->\n");
            pageContext.getOut().print(trimmed);
            //pageContext.getOut().print("\n<!--/TWS-->");
        }
        catch (IOException ioe) {
            throw new JspException(ioe);
        }

        return super.doEndTag();
    }
1282396
@Override
    public int doEndTag() throws JspException {
        String result;                // the eventual result

        // add (already encoded) parameters
        String baseUrl = resolveUrl(value, context, pageContext);
        result = params.aggregateParams(baseUrl);

        // if the URL is relative, rewrite it
        if (!UrlUtil.isAbsoluteUrl(result)) {
            HttpServletResponse response =
                    ((HttpServletResponse) pageContext.getResponse());
            result = response.encodeURL(result);
        }

        // store or print the output
        if (var != null) {
            pageContext.setAttribute(var, result, scope);
        } else {
            try {
                pageContext.getOut().print(result);
            } catch (java.io.IOException ex) {
                throw new JspTagException(ex.toString(), ex);
            }
        }

        return EVAL_PAGE;
    }
1281131
public void setScope(String scopeName) {
        if ("page".equals(scopeName)) {
            scope = PageContext.PAGE_SCOPE;
        }
        else if ("request".equals(scopeName)) {
            scope = PageContext.REQUEST_SCOPE;
        }
        else if ("session".equals(scopeName)) {
            scope = PageContext.SESSION_SCOPE;
        }
        else if ("application".equals(scopeName)) {
            scope = PageContext.APPLICATION_SCOPE;
        }
    }
1292233
@Override
    public XValue call(Scope scope) {
        Elements context = scope.context();
        List<String> res = new LinkedList<>();
        if (context!=null&&context.size()>0){
            if (scope.isRecursion()){
                NodeTest allTextFun = Scanner.findNodeTestByName("allText");
                return allTextFun.call(scope);
            }else {
                for (Element e:context){
                    if ("script".equals(e.nodeName())){
                        res.add(e.data());
                    }else {
                        res.add(e.ownText());
                    }
                }
            }
        }
        return XValue.create(res);
    }
206208
private Session getJSessionScope(PageContext pc, RefBoolean isNew) throws PageException {
	HttpSession httpSession = pc.getSession();
	ApplicationContext appContext = pc.getApplicationContext();
	Object session = null;// this is from type object, because it is possible that httpSession return object from
	// prior restart

	int s = (int) appContext.getSessionTimeout().getSeconds();
	if (maxSessionTimeout < s) maxSessionTimeout = s;

	if (httpSession != null) {
	    httpSession.setMaxInactiveInterval(maxSessionTimeout + 60);
	    session = httpSession.getAttribute(appContext.getName());
	}
	else {
	    Map<String, Scope> context = getSubMap(cfSessionContexts, appContext.getName());
	    session = context.get(pc.getCFID());
	}

	JSession jSession = null;
	if (session instanceof JSession) {
	    jSession = (JSession) session;
	    try {
		if (jSession.isExpired()) {
		    jSession.touch();
		}
		info(getLog(), "use existing JSession for " + appContext.getName() + "/" + pc.getCFID());

	    }
	    catch (ClassCastException cce) {
		error(getLog(), cce);
		// if there is no HTTPSession
		if (httpSession == null) return getCFSessionScope(pc, isNew);

		jSession = new JSession();
		httpSession.setAttribute(appContext.getName(), jSession);
		isNew.setValue(true);
	    }
	}
	else {
	    // if there is no HTTPSession
	    if (httpSession == null) return getCFSessionScope(pc, isNew);

	    info(getLog(), "create new JSession for " + appContext.getName() + "/" + pc.getCFID());
	    jSession = new JSession();
	    httpSession.setAttribute(appContext.getName(), jSession);
	    isNew.setValue(true);
	    Map<String, Scope> context = getSubMap(cfSessionContexts, appContext.getName());
	    context.put(pc.getCFID(), jSession);
	}
	jSession.touchBeforeRequest(pc);
	return jSession;
    }