當前位置: 首頁>>代碼示例>>Java>>正文


Java NativeWebRequest.getParameter方法代碼示例

本文整理匯總了Java中org.springframework.web.context.request.NativeWebRequest.getParameter方法的典型用法代碼示例。如果您正苦於以下問題:Java NativeWebRequest.getParameter方法的具體用法?Java NativeWebRequest.getParameter怎麽用?Java NativeWebRequest.getParameter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.context.request.NativeWebRequest的用法示例。


在下文中一共展示了NativeWebRequest.getParameter方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: completeConnection

import org.springframework.web.context.request.NativeWebRequest; //導入方法依賴的package包/類
/**
 * Complete the connection to the OAuth2 provider.
 *
 * @param connectionFactory the service provider's connection factory e.g. FacebookConnectionFactory
 * @param request the current web request
 * @return a new connection to the service provider
 */
public Connection completeConnection(OAuth2ConnectionFactory<?> connectionFactory, NativeWebRequest request) {
    if (connectionFactory.supportsStateParameter()) {
        verifyStateParameter(request);
    }

    String code = request.getParameter("code");
    try {
        AccessGrant accessGrant = connectionFactory.getOAuthOperations()
            .exchangeForAccess(code, callbackUrl(request), null);
        return connectionFactory.createConnection(accessGrant);
    } catch (HttpClientErrorException e) {
        log.warn("HttpClientErrorException while completing connection: " + e.getMessage());
        log.warn("      Response body: " + e.getResponseBodyAsString());
        throw e;
    }
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:24,代碼來源:ConnectSupport.java

示例2: verifyStateParameter

import org.springframework.web.context.request.NativeWebRequest; //導入方法依賴的package包/類
private void verifyStateParameter(NativeWebRequest request) {
    String state = request.getParameter("state");
    String originalState = extractCachedOAuth2State(request);
    if (state == null || !state.equals(originalState)) {
        throw new IllegalStateException("The OAuth2 'state' parameter is missing or doesn't match.");
    }
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:8,代碼來源:ConnectSupport.java

示例3: getOAuth2Parameters

import org.springframework.web.context.request.NativeWebRequest; //導入方法依賴的package包/類
private OAuth2Parameters getOAuth2Parameters(NativeWebRequest request, String defaultScope,
    MultiValueMap<String, String> additionalParameters) {
    OAuth2Parameters parameters = new OAuth2Parameters(additionalParameters);
    parameters.putAll(getRequestParameters(request, "scope"));
    parameters.setRedirectUri(callbackUrl(request));
    String scope = request.getParameter("scope");
    if (scope != null) {
        parameters.setScope(scope);
    } else if (defaultScope != null) {
        parameters.setScope(defaultScope);
    }
    return parameters;
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:14,代碼來源:ConnectSupport.java

示例4: getMediaTypeKey

import org.springframework.web.context.request.NativeWebRequest; //導入方法依賴的package包/類
@Override
protected String getMediaTypeKey(NativeWebRequest webRequest) {
	return webRequest.getParameter(this.parameterName);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:ParameterContentNegotiationStrategy.java


注:本文中的org.springframework.web.context.request.NativeWebRequest.getParameter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。