parameter _captcha need to be availabe in request
@return
@throws Exception
490953
@GET
	@Path("validate")
	public boolean validate(@Context HttpServletRequest request) throws Exception {
		return captchaEngine.validate(request);
	}
1312924
public void requestVoiceVerificationCode(Locale locale, Optional<String> captchaToken) throws IOException {
    this.pushServiceSocket.requestVoiceVerificationCode(locale, captchaToken);
  }
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;
    }
1184810
public void doTag()
            throws JspException
    {
        // First look for the exception in the pageflow/struts request attribute.  If it's not there,
        // look for it in the request attribute the container provides for web.xml-configured error
        // pages.
        InternalStringBuilder results = new InternalStringBuilder(128);
        PageContext pageContext = getPageContext();
        Throwable e = (Throwable) pageContext.getAttribute(Globals.EXCEPTION_KEY, PageContext.REQUEST_SCOPE);

        if (e == null) {
            ServletRequest req = pageContext.getRequest();
            e = (Throwable) req.getAttribute("javax.servlet.error.exception");
            if (e == null) {
                e = (Throwable) req.getAttribute("javax.servlet.jsp.jspException");
            }
        }

        if (!_showStackTrace && _showDevModeStackTrace) {
            boolean devMode = !AdapterManager.getServletContainerAdapter(pageContext.getServletContext()).isInProductionMode();
            if (devMode)
                _showStackTrace = true;
        }

        if (e != null) {
            if (_showMessage) {
                String msg = e.getMessage();
                // if we have message lets output the exception name and the name of the
                if ((msg != null) && (msg.length() > 0)) {
                    if (!_showStackTrace)
                        msg = e.getClass().getName() + ": " + msg;
                    results.append(HtmlExceptionFormatter.format(msg, e, _showStackTrace));
                }
                else {
                    results.append(HtmlExceptionFormatter.format(e.getClass().getName(), e, _showStackTrace));
                }
            }
            else {
                results.append(HtmlExceptionFormatter.format(null, e, _showStackTrace));
            }
            ResponseUtils.write(pageContext, results.toString());
        }
    }
5227
public int doEndTag()
            throws JspException {

        if(hasErrors())
            reportErrors();
        else {
            AbstractCallMethod cm = (AbstractCallMethod)getParent();
            cm.addParameter(_type, _isNull ? null : _value);
        }

        localRelease();
        return EVAL_PAGE;
    }
945707
private function validateSettings()
    {
        // Validate Merchant ID
        if (!Icepay_Parameter_Validation::merchantID($this->getMerchantID()))
            throw new Exception('Merchant ID not set, use the setMerchantID() method', 1001);

        // Validate SecretCode
        if (!Icepay_Parameter_Validation::secretCode($this->getSecretCode()))
            throw new Exception('Secretcode ID not set, use the setSecretCode() method', 1002);
    }
465557
private function handleHTTP()
    {
    	try
    	{
			$method = new ReflectionMethod($this->classname, $_REQUEST["svc"]);
    	}
    	catch (Exception $ex)
    	{
    		echo '{ error: "Method does not exists" }';
    		exit;
    	}
		if (!$method->isPublic())
		{
    		echo '{ error: "Method is not public" }';
			exit;
		}

		$params = $method->getParameters();
		$paramValues = array();
		$missingParams = array();
		foreach ($params as $param)
		{
			$paramName = $param->getName();
			$paramValue = ( isset($_REQUEST[$paramName]) ? $_REQUEST[$paramName] : null);
			if (is_null($paramValue) && $param->isDefaultValueAvailable())
			{
				$paramValue = $param->getDefaultValue();
			}
			if (is_null($paramValue))
			{
				$missingParams[] = $paramName;
			}
			else
			{
				$paramValues[$paramName] = $paramValue;
			}
		}
		if (count($missingParams) > 0)
		{
			echo '{ error: "Missing params", parameters: [ "' . implode('","', $missingParams) . '"] }';
		}
		else
		{
			try
			{
				$result = $method->invokeArgs($this, $paramValues);
				if (is_array($result))
				{
					echo json_encode($result);
				}
				elseif (is_object($result))
				{
					echo '{ error: "Return type is not supported" } ';
				}
				else
				{
					echo $result;
				}
			}
			catch (Exception $ex)
			{
				echo '{ error: "' . $ex->getMessage() . '" }';
			}
		}
    }
874987
static public function captcha($token_name='_form_token', $apiurl=null, $settings=[])
    {
        if (is_array($token_name)) {
            $settings = $token_name;
            $token_name = null;
        }
        $token_name || $token_name = '_form_token';
        
        if (is_array($apiurl)) {
            $settings = $apiurl;
            $apiurl = null;
        }
        $apiurl || $apiurl = Ioc::url('api:common/getCaptchaImage');
        
        $str = '';
        $class = isset($settings['class']) ? $settings['class'] : 'captcha-image';
        $settings['style'] = isset($settings['style']) ? $settings['style'] : '';
        $settings['style'] .= ';cursor:pointer;';
        foreach ($settings as $k => $v) {
            if (in_array($k, ['width', 'height', 'id', 'style'])) {
                $str .= $k . '="' . $v . '" ';
            }
        }
        $str = '<img src="" class="' . $class . '" title="点击刷新" ' . $str . '/>';
        $isLoad = isset(static::$isLoaded['captcha']) && static::$isLoaded['captcha'] ? true : false;
        if (!$isLoad) {
            $str .= <<<EOF
            <script>
            $(function (){
                var captcha_image_load = function(){
                    var self = $(".${class}");
                    var data = {};
                    var token = self.parents("form").find("input[name=${token_name}]");
                    if (token.length) {
                    	data['_form_token'] = token.val();
                    }
                    
        	    	$.get("{$apiurl}", data, function(data){
                        if (data) {
                            self.attr("src", "data:image/jpg;base64," + data.base64);
                        }
                    });
        	    };
                $(".${class}").on("click", captcha_image_load);
                setTimeout(function () {
                    $(".${class}").first().click();
                }, 1000);
            });
            </script>
EOF;
        }
        
        return $str;
    }
428888
public static HttpServletRequest getHttpServletRequestFromRequestAttributes() {
        try {
            return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
        } catch (final Exception e) {
            LOGGER.trace(e.getMessage(), e);
        }
        return null;
    }
1192495
public int doEndTag()
            throws JspException
    {
        String idScript = null;

        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();

        // Acquire the label value we will be generating
        if (_value == null)
            _value = Bundle.getString("Tags_ButtonText", null);
        _state.value = _value;

        // Generate an HTML element
        _state.disabled = isDisabled();

        // Add parameters for popup window support.
        if (_popupSupport != null) {
            _popupSupport.addParams(this, request);
        }

        // targetScope implies an extra parameter.  If there's no action on this button, get the action from the
        // nearest form, so we can construct an action url with our extra parameter.
        if (_targetScope != null && _action == null) {
            Form parentForm = getNearestForm();
            if (parentForm != null) {
                _action = parentForm.getAction();
            }
        }

        if (_action == null && _params != null && _popupSupport == null) {
            Form parentForm = getNearestForm();
            if (parentForm != null) {
                _action = parentForm.getAction();
            }
        }

        if (_action != null) {
            boolean isAction = PageFlowTagUtils.isAction(request, _action);
            if (isAction) {

                // If the action we're submitting to is checking for double-submits, save a token in the session.
                // This will be written out as a param (below), and will be checked in PageFlowRequestProcessor.
                String token = PageFlowTagUtils.getToken(request, _action);
                if (token != null) {
                    if (_params == null) {
                        _params = new HashMap();
                    }
                    _params.put(Constants.TOKEN_KEY, token);
                }

                // Add the scope ID parameter if there's one on the tag, or if there's one in the request.
                if (_targetScope != null) {
                    if (_params == null) {
                        _params = new HashMap();
                    }
                    _params.put(ScopedServletUtils.SCOPE_ID_PARAM, _targetScope);
                }

                String overrideAction = ACTION_OVERRIDE + _action;
                overrideAction = HtmlUtils.addParams(overrideAction, _params, response.getCharacterEncoding());
                String buttonOutput = URLRewriterService.getNamePrefix(pageContext.getServletContext(),
                        pageContext.getRequest(), overrideAction) + overrideAction;
                if (buttonOutput.indexOf(";") > -1) {
                    buttonOutput = buttonOutput.substring(0, buttonOutput.indexOf(";"));
                }
                _state.name = buttonOutput;

                // don't write the id attribute
                Form parentForm = getNearestForm();
                idScript = renderNameAndId(request, _state, parentForm);
            }
            else {
                // set the error because the action is invalid
                registerTagError(Bundle.getString("Tags_BadAction", _action), null);
            }
        }
        else {
            Form parentForm = getNearestForm();
            idScript = renderNameAndId(request, _state, parentForm);
        }

        boolean buttonDisableAndSubmit = false;
        boolean buttonDisable = false;
        
        // if the user overrides the onclick we will ignore this
        if (getOnClick() == null) {
            if (_disableSecondClick) {
                Form parentForm = getNearestForm();
                String href = getActionUrl(request, response);
                String entry;
                if (parentForm != null && href != null && (_state.type == null || _state.type == INPUT_SUBMIT)) {
                    entry = ScriptRequestState.getString("buttonDisableAndSubmitFormAction",
                            new Object[]{parentForm.getRealFormId(), href});
                    buttonDisableAndSubmit = true;
                }
                else {
                    entry = ScriptRequestState.getString("buttonDisableAction", null);
                    buttonDisable = true;
                }
                _state.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK, entry);
                if (parentForm != null)
                    parentForm.insureRealId();
            }
            else if (_popupSupport != null) {
                String href = getActionUrl(request, response);

                if (href != null) {
                    href = response.encodeURL(href);
                    setOnClick(_popupSupport.getOnClick(request,href));
                }
            }
        }
        
        // report any errors that may have been generated.
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = null;
        if (_renderAsButton) {
            br = TagRenderingBase.Factory.getRendering(TagRenderingBase.BUTTON_TAG, request);
            br.doStartTag(writer, _state);
            // add the body content
            if (_text != null)
                write(_text);
            else if (_value != null)
                write(_value);
        }
        else {
            br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_SUBMIT_TAG, request);
            br.doStartTag(writer, _state);
        }
        br.doEndTag(writer);

        //Emit javascript if this button needs to sumbit the form or open a popup window
        if (idScript != null || _popupSupport != null || buttonDisable || buttonDisableAndSubmit) {
            ScriptRequestState srs = ScriptRequestState.getScriptRequestState(request);
            InternalStringBuilder script = new InternalStringBuilder(32);
            StringBuilderRenderAppender scriptWriter = new StringBuilderRenderAppender(script);
            IScriptReporter sr = getScriptReporter();

            if (buttonDisableAndSubmit)
                srs.writeFeature(sr, scriptWriter, CoreScriptFeature.BUTTON_DISABLE_AND_SUBMIT, true, false, null);
            if (buttonDisable)
                srs.writeFeature(sr, scriptWriter, CoreScriptFeature.BUTTON_DISABLE, true, false, null);
            if (_popupSupport != null)
                _popupSupport.writeScript(request, srs, getScriptReporter(), scriptWriter);
            if (idScript != null)
                scriptWriter.append(idScript);
            write(script.toString());
        }
        
        // Evaluate the remainder of this page
        localRelease();
        return EVAL_PAGE;
    }
556008
public static boolean validate(Controller controller, String userInputString) {
		String captchaKey = controller.getCookie(captchaName);
		if (validate(captchaKey, userInputString)) {
			controller.removeCookie(captchaName);
			return true;
		}
		return false;
	}
1253317
public Request single(final CharSequence name) throws HttpException {
        final Iterator<Request> parts = this.part(name).iterator();
        if (!parts.hasNext()) {
            throw new HttpException(
                HttpURLConnection.HTTP_BAD_REQUEST,
                String.format(
                    "form param \"%s\" is mandatory", name
                )
            );
        }
        return parts.next();
    }
188339
private Function<HttpRequestContext, String> createQuerySubstitution(final String param) {
        return new Function<HttpRequestContext, String>() {
            @Override
            public String apply(HttpRequestContext request) {
                MultivaluedMap<String, String> params = request.getQueryParameters();
                if (!params.containsKey(param)) {
                    throw new IllegalStateException("Parameter required for authentication is missing: " + param);
                }
                List<String> values = params.get(param);
                if (values.size() != 1) {
                    throw new IllegalStateException("Exactly one parameter expected for authentication: " + param);
                }
                return values.get(0);
            }
        };
    }
741246
protected function _exception() {
        $url = '.' . $this->request->src . '.' . $this->request->controller . '.' . $this->request->action;

        if (in_array($url, $this->config['user']['security']['spam']['config']['exception'])) {
            $this->_exception = true;
        }

        return $this->_exception;
    }
1150747
protected function NeedCaptcha()
    {
        $bNeedCaptcha = false;
        $oUser = TdbDataExtranetUser::GetInstance();
        $oModuleConfiguration = $this->GetModuleConfiguration();
        if (!$oModuleConfiguration->fieldAllowWriteReviewLoggedinUsersOnly && !$oUser->IsLoggedIn()) {
            $bNeedCaptcha = true;
        }

        return $bNeedCaptcha;
    }
338496
public synchronized EvernoteHtmlHelper getHtmlHelperBusiness() throws TException, EDAMUserException, EDAMSystemException {
        if (mHtmlHelperBusiness == null) {
            authenticateToBusiness();
            mHtmlHelperBusiness = createHtmlHelper(mBusinessAuthenticationResult.getAuthenticationToken());
        }
        return mHtmlHelperBusiness;
    }
622665
public int doStartTag() throws JspException
    {
        JspTag parentTag = SimpleTagSupport.findAncestorWithClass(this, IUrlParams.class);
        if (parentTag == null) {
            String msg = Bundle.getString("Tags_InvalidParameterParent");
            registerTagError(msg, null);
            reportErrors();
        }
        else {
            IUrlParams parent = (IUrlParams) parentTag;
            parent.addParameter(_name, _value, null);
        }
        localRelease();
        return SKIP_BODY;
    }