Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
7df3a327
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7df3a327
编写于
1月 26, 2016
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
3779fe9b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
74 addition
and
72 deletion
+74
-72
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
...ork/web/servlet/handler/AbstractHandlerMethodMapping.java
+65
-57
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolver.java
...method/annotation/PathVariableMethodArgumentResolver.java
+9
-14
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/VersionResourceResolver.java
...amework/web/servlet/resource/VersionResourceResolver.java
+0
-1
未找到文件。
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
浏览文件 @
7df3a327
...
...
@@ -153,6 +153,28 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
return
this
.
mappingRegistry
;
}
/**
* Register the given mapping.
* <p>This method may be invoked at runtime after initialization has completed.
* @param mapping the mapping for the handler method
* @param handler the handler
* @param method the method
*/
public
void
registerMapping
(
T
mapping
,
Object
handler
,
Method
method
)
{
this
.
mappingRegistry
.
register
(
mapping
,
handler
,
method
);
}
/**
* Un-register the given mapping.
* <p>This method may be invoked at runtime after initialization has completed.
* @param mapping the mapping to unregister
*/
public
void
unregisterMapping
(
T
mapping
)
{
this
.
mappingRegistry
.
unregister
(
mapping
);
}
// Handler method detection
/**
* Detects handler methods at initialization.
...
...
@@ -196,13 +218,6 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
handlerMethodsInitialized
(
getHandlerMethods
());
}
/**
* Whether the given type is a handler with handler methods.
* @param beanType the type of the bean being checked
* @return "true" if this a handler type, "false" otherwise.
*/
protected
abstract
boolean
isHandler
(
Class
<?>
beanType
);
/**
* Look for handler methods in a handler.
* @param handler the bean name of a handler or a handler instance
...
...
@@ -230,16 +245,6 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
}
}
/**
* Provide the mapping for a handler method. A method for which no
* mapping can be provided is not a handler method.
* @param method the method to provide a mapping for
* @param handlerType the handler type, possibly a sub-type of the method's
* declaring class
* @return the mapping, or {@code null} if the method is not mapped
*/
protected
abstract
T
getMappingForMethod
(
Method
method
,
Class
<?>
handlerType
);
/**
* Register a handler method and its unique mapping. Invoked at startup for
* each detected handler method.
...
...
@@ -272,11 +277,6 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
return
handlerMethod
;
}
/**
* Extract and return the URL paths contained in a mapping.
*/
protected
abstract
Set
<
String
>
getMappingPathPatterns
(
T
mapping
);
/**
* Extract and return the CORS configuration for the mapping.
*/
...
...
@@ -291,25 +291,8 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
protected
void
handlerMethodsInitialized
(
Map
<
T
,
HandlerMethod
>
handlerMethods
)
{
}
/**
* Register the given mapping.
* <p>This method may be invoked at runtime after initialization has completed.
* @param mapping the mapping for the handler method
* @param handler the handler
* @param method the method
*/
public
void
registerMapping
(
T
mapping
,
Object
handler
,
Method
method
)
{
this
.
mappingRegistry
.
register
(
mapping
,
handler
,
method
);
}
/**
* Un-register the given mapping.
* <p>This method may be invoked at runtime after initialization has completed.
* @param mapping the mapping to unregister
*/
public
void
unregisterMapping
(
T
mapping
)
{
this
.
mappingRegistry
.
unregister
(
mapping
);
}
// Handler method lookup
/**
* Look up a handler method for the given request.
...
...
@@ -395,23 +378,6 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
}
}
/**
* Check if a mapping matches the current request and return a (potentially
* new) mapping with conditions relevant to the current request.
* @param mapping the mapping to get a match for
* @param request the current HTTP servlet request
* @return the match, or {@code null} if the mapping doesn't match
*/
protected
abstract
T
getMatchingMapping
(
T
mapping
,
HttpServletRequest
request
);
/**
* Return a comparator for sorting matching mappings.
* The returned comparator should sort 'better' matches higher.
* @param request the current request
* @return the comparator (never {@code null})
*/
protected
abstract
Comparator
<
T
>
getMappingComparator
(
HttpServletRequest
request
);
/**
* Invoked when a matching mapping is found.
* @param mapping the matching mapping
...
...
@@ -452,6 +418,48 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
}
// Abstract template methods
/**
* Whether the given type is a handler with handler methods.
* @param beanType the type of the bean being checked
* @return "true" if this a handler type, "false" otherwise.
*/
protected
abstract
boolean
isHandler
(
Class
<?>
beanType
);
/**
* Provide the mapping for a handler method. A method for which no
* mapping can be provided is not a handler method.
* @param method the method to provide a mapping for
* @param handlerType the handler type, possibly a sub-type of the method's
* declaring class
* @return the mapping, or {@code null} if the method is not mapped
*/
protected
abstract
T
getMappingForMethod
(
Method
method
,
Class
<?>
handlerType
);
/**
* Extract and return the URL paths contained in a mapping.
*/
protected
abstract
Set
<
String
>
getMappingPathPatterns
(
T
mapping
);
/**
* Check if a mapping matches the current request and return a (potentially
* new) mapping with conditions relevant to the current request.
* @param mapping the mapping to get a match for
* @param request the current HTTP servlet request
* @return the match, or {@code null} if the mapping doesn't match
*/
protected
abstract
T
getMatchingMapping
(
T
mapping
,
HttpServletRequest
request
);
/**
* Return a comparator for sorting matching mappings.
* The returned comparator should sort 'better' matches higher.
* @param request the current request
* @return the comparator (never {@code null})
*/
protected
abstract
Comparator
<
T
>
getMappingComparator
(
HttpServletRequest
request
);
/**
* A registry that maintains all mappings to handler methods, exposing methods
* to perform lookups and providing concurrent access.
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/PathVariableMethodArgumentResolver.java
浏览文件 @
7df3a327
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -33,7 +33,6 @@ import org.springframework.web.bind.annotation.ValueConstants;
import
org.springframework.web.context.request.NativeWebRequest
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
;
import
org.springframework.web.method.annotation.RequestParamMapMethodArgumentResolver
;
import
org.springframework.web.method.support.ModelAndViewContainer
;
import
org.springframework.web.method.support.UriComponentsContributor
;
import
org.springframework.web.servlet.HandlerMapping
;
...
...
@@ -43,22 +42,18 @@ import org.springframework.web.util.UriComponentsBuilder;
/**
* Resolves method arguments annotated with an @{@link PathVariable}.
*
* <p>An @{@link PathVariable} is a named value that gets resolved from a URI
* template variable. It is always required and does not have a default value
* to fall back on. See the base class
* <p>An @{@link PathVariable} is a named value that gets resolved from a URI template variable.
* It is always required and does not have a default value to fall back on. See the base class
* {@link org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver}
* for more information on how named values are processed.
*
* <p>If the method parameter type is {@link Map}, the name specified in the
* annotation is used to resolve the URI variable String value. The value is
* then converted to a {@link Map} via type conversion assuming a suitable
* {@link Converter} or {@link PropertyEditor} has been registered.
* Or if the annotation does not specify name the
* {@link RequestParamMapMethodArgumentResolver} is used instead to provide
* access to all URI variables in a map.
* <p>If the method parameter type is {@link Map}, the name specified in the annotation is used
* to resolve the URI variable String value. The value is then converted to a {@link Map} via
* type conversion, assuming a suitable {@link Converter} or {@link PropertyEditor} has been
* registered.
*
* <p>A {@link WebDataBinder} is invoked to apply type conversion to resolved
*
path variable
values that don't yet match the method parameter type.
* <p>A {@link WebDataBinder} is invoked to apply type conversion to resolved
path variable
* values that don't yet match the method parameter type.
*
* @author Rossen Stoyanchev
* @author Arjen Poutsma
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/VersionResourceResolver.java
浏览文件 @
7df3a327
...
...
@@ -28,7 +28,6 @@ import java.util.Comparator;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.core.io.AbstractResource
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录