Browse Source

Polishing

(cherry picked from commit 730bd02)
pull/713/head
Juergen Hoeller 11 years ago
parent
commit
dcb821edb5
  1. 18
      spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandler.java
  2. 6
      spring-web/src/main/java/org/springframework/web/util/WebUtils.java
  3. 2
      spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContext.java

18
spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandler.java

@ -188,7 +188,7 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan @@ -188,7 +188,7 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan
}
/**
* The configured {@link ConversionService}.
* Return the configured {@link ConversionService}.
*/
public ConversionService getConversionService() {
return this.conversionService;
@ -206,14 +206,14 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan @@ -206,14 +206,14 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan
}
/**
* Return the PathMatcher implementation to use for matching destinations
* Return the PathMatcher implementation to use for matching destinations.
*/
public PathMatcher getPathMatcher() {
return this.pathMatcher;
}
/**
* The configured Validator instance
* Return the configured Validator instance.
*/
public Validator getValidator() {
return this.validator;
@ -343,17 +343,17 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan @@ -343,17 +343,17 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan
@Override
protected SimpMessageMappingInfo getMappingForMethod(Method method, Class<?> handlerType) {
MessageMapping typeAnnotation = AnnotationUtils.findAnnotation(handlerType, MessageMapping.class);
MessageMapping messageAnnot = AnnotationUtils.findAnnotation(method, MessageMapping.class);
if (messageAnnot != null) {
SimpMessageMappingInfo result = createMessageMappingCondition(messageAnnot);
MessageMapping messageAnnotation = AnnotationUtils.findAnnotation(method, MessageMapping.class);
if (messageAnnotation != null) {
SimpMessageMappingInfo result = createMessageMappingCondition(messageAnnotation);
if (typeAnnotation != null) {
result = createMessageMappingCondition(typeAnnotation).combine(result);
}
return result;
}
SubscribeMapping subsribeAnnotation = AnnotationUtils.findAnnotation(method, SubscribeMapping.class);
if (subsribeAnnotation != null) {
SimpMessageMappingInfo result = createSubscribeCondition(subsribeAnnotation);
SubscribeMapping subscribeAnnotation = AnnotationUtils.findAnnotation(method, SubscribeMapping.class);
if (subscribeAnnotation != null) {
SimpMessageMappingInfo result = createSubscribeCondition(subscribeAnnotation);
if (typeAnnotation != null) {
result = createMessageMappingCondition(typeAnnotation).combine(result);
}

6
spring-web/src/main/java/org/springframework/web/util/WebUtils.java

@ -109,6 +109,7 @@ public abstract class WebUtils { @@ -109,6 +109,7 @@ public abstract class WebUtils {
/**
* Use of response encoding for HTML escaping parameter at the servlet context level
* (i.e. a context-param in {@code web.xml}): "responseEncodedHtmlEscape".
* @since 4.1.2
*/
public static final String RESPONSE_ENCODED_HTML_ESCAPE_CONTEXT_PARAM = "responseEncodedHtmlEscape";
@ -207,7 +208,7 @@ public abstract class WebUtils { @@ -207,7 +208,7 @@ public abstract class WebUtils {
return null;
}
String param = servletContext.getInitParameter(HTML_ESCAPE_CONTEXT_PARAM);
return (StringUtils.hasText(param)? Boolean.valueOf(param) : null);
return (StringUtils.hasText(param) ? Boolean.valueOf(param) : null);
}
/**
@ -221,13 +222,14 @@ public abstract class WebUtils { @@ -221,13 +222,14 @@ public abstract class WebUtils {
* default in case of no setting at the global level.
* @param servletContext the servlet context of the web application
* @return whether response encoding is used for HTML escaping (null = no explicit default)
* @since 4.1.2
*/
public static Boolean getResponseEncodedHtmlEscape(ServletContext servletContext) {
if (servletContext == null) {
return null;
}
String param = servletContext.getInitParameter(RESPONSE_ENCODED_HTML_ESCAPE_CONTEXT_PARAM);
return (StringUtils.hasText(param)? Boolean.valueOf(param) : null);
return (StringUtils.hasText(param) ? Boolean.valueOf(param) : null);
}
/**

2
spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContext.java

@ -265,6 +265,8 @@ public class RequestContext { @@ -265,6 +265,8 @@ public class RequestContext {
// context-param in web.xml, if any.
this.defaultHtmlEscape = WebUtils.getDefaultHtmlEscape(this.webApplicationContext.getServletContext());
// Determine response-encoded HTML escape setting from the "responseEncodedHtmlEscape"
// context-param in web.xml, if any.
this.responseEncodedHtmlEscape = WebUtils.getResponseEncodedHtmlEscape(this.webApplicationContext.getServletContext());
this.urlPathHelper = new UrlPathHelper();

Loading…
Cancel
Save