本文整理汇总了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;
}
}
示例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.");
}
}
示例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;
}
示例4: getMediaTypeKey
import org.springframework.web.context.request.NativeWebRequest; //导入方法依赖的package包/类
@Override
protected String getMediaTypeKey(NativeWebRequest webRequest) {
return webRequest.getParameter(this.parameterName);
}