Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * Copyright 2006-2011 the original author or authors.
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
   * the License. You may obtain a copy of the License at
   * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations under the License.
 import java.util.Map;
 import java.util.Set;
A handler mapping for framework endpoints (those annotated with @FrameworkEndpoint).

Dave Syer
 	private Map<StringStringmappings = new HashMap<StringString>();
Custom mappings for framework endpoint paths. The keys in the map are the default framework endpoint path, e.g. "/oauth/authorize", and the values are the desired runtime paths.

mappings the mappings to set
 	public void setMappings(Map<StringStringpatternMap) {
 		this. = patternMap;

The name of the request parameter that distinguishes a call to approve an authorization. Default is

approvalParameter the approvalParameter to set
 	public void setApprovalParameter(String approvalParameter) {
 		this. = approvalParameter;
 		// Make sure user-supplied mappings take precedence by default (except the resource mapping)

 	protected boolean isHandler(Class<?> beanType) {
 		return AnnotationUtils.findAnnotation(beanTypeFrameworkEndpoint.class) != null;
 	protected RequestMappingInfo getMappingForMethod(Method methodClass<?> handlerType) {
 		RequestMappingInfo defaultMapping = super.getMappingForMethod(methodhandlerType);
 		if (defaultMapping == null) {
 			return null;
 		Set<StringdefaultPatterns = defaultMapping.getPatternsCondition().getPatterns();
 		String[] patterns = new String[defaultPatterns.size()];
 		int i = 0;
 		for (String pattern : defaultPatterns) {
 			patterns[i] = pattern;
 			if (.containsKey(pattern)) {
 				patterns[i] = .get(pattern);
 		PatternsRequestCondition patternsInfo = new PatternsRequestCondition(patterns);
 		ParamsRequestCondition paramsInfo = defaultMapping.getParamsCondition();
				&& defaultPatterns.contains("/oauth/authorize")) {
			String[] params = new String[paramsInfo.getExpressions().size()];
			Set<NameValueExpression<String>> expressions = paramsInfo.getExpressions();
			i = 0;
			for (NameValueExpression<Stringexpression : expressions) {
				String param = expression.toString();
					params[i] = ;
else {
					params[i] = param;
			paramsInfo = new ParamsRequestCondition(params);
		RequestMappingInfo mapping = new RequestMappingInfo(patternsInfodefaultMapping.getMethodsCondition(),
				paramsInfodefaultMapping.getHeadersCondition(), defaultMapping.getConsumesCondition(),
				defaultMapping.getProducesCondition(), defaultMapping.getCustomCondition());
		return mapping;
New to GrepCode? Check out our FAQ X