Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
965fca80
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,发现更多精彩内容 >>
提交
965fca80
编写于
7月 29, 2015
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
faab2209
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
46 addition
and
42 deletion
+46
-42
spring-core/src/main/java/org/springframework/core/MethodParameter.java
...c/main/java/org/springframework/core/MethodParameter.java
+1
-1
spring-jms/src/main/java/org/springframework/jms/listener/adapter/AbstractAdaptableMessageListener.java
...ms/listener/adapter/AbstractAdaptableMessageListener.java
+18
-19
spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessagingMessageListenerAdapter.java
...jms/listener/adapter/MessagingMessageListenerAdapter.java
+4
-4
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/JsonViewRequestBodyAdvice.java
...vlet/mvc/method/annotation/JsonViewRequestBodyAdvice.java
+10
-7
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/JsonViewResponseBodyAdvice.java
...let/mvc/method/annotation/JsonViewResponseBodyAdvice.java
+8
-7
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/InfoReceiver.java
...pringframework/web/socket/sockjs/client/InfoReceiver.java
+2
-1
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/Transport.java
...g/springframework/web/socket/sockjs/client/Transport.java
+2
-3
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/XhrTransport.java
...pringframework/web/socket/sockjs/client/XhrTransport.java
+1
-0
未找到文件。
spring-core/src/main/java/org/springframework/core/MethodParameter.java
浏览文件 @
965fca80
...
...
@@ -207,7 +207,7 @@ public class MethodParameter {
/**
* Return the index of the method/constructor parameter.
* @return the parameter index (
never negativ
e)
* @return the parameter index (
-1 in case of the return typ
e)
*/
public
int
getParameterIndex
()
{
return
this
.
parameterIndex
;
...
...
spring-jms/src/main/java/org/springframework/jms/listener/adapter/AbstractAdaptableMessageListener.java
浏览文件 @
965fca80
...
...
@@ -40,8 +40,8 @@ import org.springframework.jms.support.destination.DynamicDestinationResolver;
import
org.springframework.util.Assert
;
/**
* An abstract
{@link MessageListener} adapter providing the necessary infrastructure
*
to extract the payload of a {@link Message}
* An abstract
JMS {@link MessageListener} adapter providing the necessary
*
infrastructure to extract the payload of a JMS {@link Message}.
*
* @author Juergen Hoeller
* @author Stephane Nicoll
...
...
@@ -217,7 +217,7 @@ public abstract class AbstractAdaptableMessageListener
return
message
;
}
catch
(
JMSException
ex
)
{
throw
new
MessageConversionException
(
"Could not
unmarshal
message"
,
ex
);
throw
new
MessageConversionException
(
"Could not
convert JMS
message"
,
ex
);
}
}
...
...
@@ -246,10 +246,12 @@ public abstract class AbstractAdaptableMessageListener
sendResponse
(
session
,
destination
,
response
);
}
catch
(
Exception
ex
)
{
throw
new
ReplyFailureException
(
"Failed to send reply with payload
'"
+
result
+
"'
"
,
ex
);
throw
new
ReplyFailureException
(
"Failed to send reply with payload
["
+
result
+
"]
"
,
ex
);
}
}
else
{
// No JMS Session available
if
(
logger
.
isWarnEnabled
())
{
logger
.
warn
(
"Listener method returned result ["
+
result
+
"]: not generating response message for it because of no JMS Session given"
);
...
...
@@ -266,25 +268,21 @@ public abstract class AbstractAdaptableMessageListener
* @see #setMessageConverter
*/
protected
Message
buildMessage
(
Session
session
,
Object
result
)
throws
JMSException
{
Object
content
=
(
result
instanceof
JmsResponse
?
((
JmsResponse
<?>)
result
).
getResponse
()
:
result
);
Object
content
=
(
result
instanceof
JmsResponse
?
((
JmsResponse
<?>)
result
).
getResponse
()
:
result
);
if
(
content
instanceof
org
.
springframework
.
messaging
.
Message
)
{
return
this
.
messagingMessageConverter
.
toMessage
(
content
,
session
);
}
MessageConverter
converter
=
getMessageConverter
();
if
(
converter
!=
null
)
{
if
(
content
instanceof
org
.
springframework
.
messaging
.
Message
)
{
return
this
.
messagingMessageConverter
.
toMessage
(
content
,
session
);
}
else
{
return
converter
.
toMessage
(
content
,
session
);
}
return
converter
.
toMessage
(
content
,
session
);
}
else
{
if
(!(
content
instanceof
Message
))
{
throw
new
MessageConversionException
(
"No MessageConverter specified - cannot handle message ["
+
content
+
"]"
);
}
return
(
Message
)
content
;
if
(!(
content
instanceof
Message
))
{
throw
new
MessageConversionException
(
"No MessageConverter specified - cannot handle message ["
+
content
+
"]"
);
}
return
(
Message
)
content
;
}
/**
...
...
@@ -307,6 +305,7 @@ public abstract class AbstractAdaptableMessageListener
private
Destination
getResponseDestination
(
Message
request
,
Message
response
,
Session
session
,
Object
result
)
throws
JMSException
{
if
(
result
instanceof
JmsResponse
)
{
JmsResponse
<?>
jmsResponse
=
(
JmsResponse
)
result
;
Destination
destination
=
jmsResponse
.
resolveDestination
(
getDestinationResolver
(),
session
);
...
...
@@ -418,7 +417,7 @@ public abstract class AbstractAdaptableMessageListener
if
(
converter
!=
null
)
{
return
converter
.
toMessage
(
payload
,
session
);
}
throw
new
IllegalStateException
(
"No message converter
, cannot handle '"
+
payload
+
"'
"
);
throw
new
IllegalStateException
(
"No message converter
- cannot handle ["
+
payload
+
"]
"
);
}
}
...
...
spring-jms/src/main/java/org/springframework/jms/listener/adapter/MessagingMessageListenerAdapter.java
浏览文件 @
965fca80
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -77,7 +77,7 @@ public class MessagingMessageListenerAdapter extends AbstractAdaptableMessageLis
return
(
Message
<?>)
getMessagingMessageConverter
().
fromMessage
(
jmsMessage
);
}
catch
(
JMSException
ex
)
{
throw
new
MessageConversionException
(
"Could not
unmarshal
message"
,
ex
);
throw
new
MessageConversionException
(
"Could not
convert JMS
message"
,
ex
);
}
}
...
...
@@ -90,8 +90,8 @@ public class MessagingMessageListenerAdapter extends AbstractAdaptableMessageLis
return
this
.
handlerMethod
.
invoke
(
message
,
jmsMessage
,
session
);
}
catch
(
MessagingException
ex
)
{
throw
new
ListenerExecutionFailedException
(
createMessagingErrorMessage
(
"Listener method could not "
+
"be invoked with the
incoming message"
),
ex
);
throw
new
ListenerExecutionFailedException
(
createMessagingErrorMessage
(
"Listener method could not be invoked with
incoming message"
),
ex
);
}
catch
(
Exception
ex
)
{
throw
new
ListenerExecutionFailedException
(
"Listener method '"
+
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/JsonViewRequestBodyAdvice.java
浏览文件 @
965fca80
...
...
@@ -28,22 +28,23 @@ import org.springframework.http.converter.json.AbstractJackson2HttpMessageConver
import
org.springframework.http.converter.json.MappingJacksonInputMessage
;
/**
* A {@
code RequestBodyAdvice} implementation that adds support for
*
Jackson's {@code @JsonView} annotation declared on a Spring MVC
*
{@code @HttpEntity} and {@code @RequestBody} method parameters
.
* A {@
link RequestBodyAdvice} implementation that adds support for Jackson's
*
{@code @JsonView} annotation declared on a Spring MVC {@code @HttpEntity}
*
or {@code @RequestBody} method parameter
.
*
* <p>The deserialization view specified in the annotation will be passed in to
*
the {@code MappingJackson2HttpMessageConverter} which will then use it to
* deserialize the request body with.
* <p>The deserialization view specified in the annotation will be passed in to
the
*
{@link org.springframework.http.converter.json.MappingJackson2HttpMessageConverter}
*
which will then use it to
deserialize the request body with.
*
* <p>Note that despite {@code @JsonView} allowing for more than one class to
* be specified, the use for a request body advice is only supported with
* exactly one class argument. Consider the use of a composite interface.
*
* <p>Jackson 2.5
.0 or later is required
.
* <p>Jackson 2.5
or later is required for parameter-level use of {@code @JsonView}
.
*
* @author Sebastien Deleuze
* @since 4.2
* @see com.fasterxml.jackson.annotation.JsonView
* @see com.fasterxml.jackson.databind.ObjectMapper#readerWithView(Class)
*/
public
class
JsonViewRequestBodyAdvice
extends
RequestBodyAdviceAdapter
{
...
...
@@ -51,6 +52,7 @@ public class JsonViewRequestBodyAdvice extends RequestBodyAdviceAdapter {
@Override
public
boolean
supports
(
MethodParameter
methodParameter
,
Type
targetType
,
Class
<?
extends
HttpMessageConverter
<?>>
converterType
)
{
return
(
AbstractJackson2HttpMessageConverter
.
class
.
isAssignableFrom
(
converterType
)
&&
methodParameter
.
getParameterAnnotation
(
JsonView
.
class
)
!=
null
);
}
...
...
@@ -58,6 +60,7 @@ public class JsonViewRequestBodyAdvice extends RequestBodyAdviceAdapter {
@Override
public
HttpInputMessage
beforeBodyRead
(
HttpInputMessage
inputMessage
,
MethodParameter
methodParameter
,
Type
targetType
,
Class
<?
extends
HttpMessageConverter
<?>>
selectedConverterType
)
throws
IOException
{
JsonView
annotation
=
methodParameter
.
getParameterAnnotation
(
JsonView
.
class
);
Class
<?>[]
classes
=
annotation
.
value
();
if
(
classes
.
length
!=
1
)
{
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/JsonViewResponseBodyAdvice.java
浏览文件 @
965fca80
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -26,13 +26,13 @@ import org.springframework.http.server.ServerHttpRequest;
import
org.springframework.http.server.ServerHttpResponse
;
/**
* A {@
code ResponseBodyAdvice} implementation that adds support for
*
Jackson's {@code @JsonView} annotation declared on a Spring MVC
*
{@code @RequestMapping}
or {@code @ExceptionHandler} method.
* A {@
link ResponseBodyAdvice} implementation that adds support for Jackson's
*
{@code @JsonView} annotation declared on a Spring MVC {@code @RequestMapping}
* or {@code @ExceptionHandler} method.
*
* <p>The serialization view specified in the annotation will be passed in to
*
the {@code MappingJackson2HttpMessageConverter} which will then use it to
* serialize the response body with.
* <p>The serialization view specified in the annotation will be passed in to
the
*
{@link org.springframework.http.converter.json.MappingJackson2HttpMessageConverter}
*
which will then use it to
serialize the response body with.
*
* <p>Note that despite {@code @JsonView} allowing for more than one class to
* be specified, the use for a response body advice is only supported with
...
...
@@ -40,6 +40,7 @@ import org.springframework.http.server.ServerHttpResponse;
*
* @author Rossen Stoyanchev
* @since 4.1
* @see com.fasterxml.jackson.annotation.JsonView
* @see com.fasterxml.jackson.databind.ObjectMapper#writerWithView(Class)
*/
public
class
JsonViewResponseBodyAdvice
extends
AbstractMappingJacksonResponseBodyAdvice
{
...
...
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/InfoReceiver.java
浏览文件 @
965fca80
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.socket.sockjs.client
;
import
java.net.URI
;
...
...
@@ -43,4 +44,4 @@ public interface InfoReceiver {
*/
String
executeInfoRequest
(
URI
infoUrl
,
HttpHeaders
headers
);
}
\ No newline at end of file
}
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/Transport.java
浏览文件 @
965fca80
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.socket.sockjs.client
;
package
org.springframework.web.socket.sockjs.client
;
import
java.util.List
;
...
...
@@ -40,7 +40,6 @@ public interface Transport {
/**
* Connect the transport.
*
* @param request the transport request.
* @param webSocketHandler the application handler to delegate lifecycle events to.
* @return a future to indicate success or failure to connect.
...
...
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/XhrTransport.java
浏览文件 @
965fca80
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.socket.sockjs.client
;
import
java.net.URI
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录