Browse Source

Polishing

Issue: SPR-11262
pull/531/head
Juergen Hoeller 12 years ago
parent
commit
d628025f13
  1. 4
      spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalTaskExecutorThreadPool.java
  2. 6
      spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java
  3. 2
      spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java
  4. 3
      spring-web/src/main/java/org/springframework/http/converter/support/AllEncompassingFormHttpMessageConverter.java
  5. 1
      spring-web/src/main/java/org/springframework/web/client/RestTemplate.java
  6. 14
      spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java
  7. 17
      spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
  8. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java

4
spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalTaskExecutorThreadPool.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -87,7 +87,7 @@ public class LocalTaskExecutorThreadPool implements ThreadPool { @@ -87,7 +87,7 @@ public class LocalTaskExecutorThreadPool implements ThreadPool {
@Override
public int blockForAvailableThreads() {
// The present implementation always returns 1, making Quartz (1.6)
// The present implementation always returns 1, making Quartz
// always schedule any tasks that it feels like scheduling.
// This could be made smarter for specific TaskExecutors,
// for example calling {@code getMaximumPoolSize() - getActiveCount()}

6
spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java

@ -151,8 +151,6 @@ public abstract class SchedulerAccessor implements ResourceLoaderAware { @@ -151,8 +151,6 @@ public abstract class SchedulerAccessor implements ResourceLoaderAware {
* in combination with the Trigger.
* @see #setTriggers
* @see org.quartz.JobDetail
* @see JobDetailBean
* @see JobDetailAwareTrigger
*/
public void setJobDetails(JobDetail... jobDetails) {
// Use modifiable ArrayList here, to allow for further adding of
@ -180,15 +178,11 @@ public abstract class SchedulerAccessor implements ResourceLoaderAware { @@ -180,15 +178,11 @@ public abstract class SchedulerAccessor implements ResourceLoaderAware {
* "jobDetails" property of this FactoryBean.
* @see #setJobDetails
* @see org.quartz.JobDetail
* @see JobDetailAwareTrigger
* @see CronTriggerBean
* @see SimpleTriggerBean
*/
public void setTriggers(Trigger... triggers) {
this.triggers = Arrays.asList(triggers);
}
/**
* Specify Quartz SchedulerListeners to be registered with the Scheduler.
*/

2
spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java

@ -245,7 +245,7 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea @@ -245,7 +245,7 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea
sti.setRepeatCount(this.repeatCount);
sti.setPriority(this.priority);
sti.setMisfireInstruction(this.misfireInstruction);
cti.setDescription(this.description);
sti.setDescription(this.description);
this.simpleTrigger = sti;
*/

3
spring-web/src/main/java/org/springframework/http/converter/support/AllEncompassingFormHttpMessageConverter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.http.converter.support;
import javax.xml.transform.Source;

1
spring-web/src/main/java/org/springframework/web/client/RestTemplate.java

@ -157,6 +157,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat @@ -157,6 +157,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
this.messageConverters.add(new ResourceHttpMessageConverter());
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
if (romePresent) {
this.messageConverters.add(new AtomFeedHttpMessageConverter());
this.messageConverters.add(new RssChannelHttpMessageConverter());

14
spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java

@ -133,6 +133,9 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { @@ -133,6 +133,9 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
private static final boolean javaxValidationPresent = ClassUtils.isPresent(
"javax.validation.Validator", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
private static boolean romePresent =
ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
private static final boolean jaxb2Present =
ClassUtils.isPresent("javax.xml.bind.Binder", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
@ -144,9 +147,6 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { @@ -144,9 +147,6 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", AnnotationDrivenBeanDefinitionParser.class.getClassLoader()) &&
ClassUtils.isPresent("org.codehaus.jackson.JsonGenerator", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
private static boolean romePresent =
ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
@ -338,7 +338,6 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { @@ -338,7 +338,6 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
}
private void configurePathMatchingProperties(RootBeanDefinition handlerMappingDef, Element element) {
Element pathMatchingElement = DomUtils.getChildElementByTagName(element, "path-matching");
if(pathMatchingElement != null) {
if (pathMatchingElement.hasAttribute("suffix-pattern")) {
@ -370,12 +369,12 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { @@ -370,12 +369,12 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
props.put("atom", MediaType.APPLICATION_ATOM_XML_VALUE);
props.put("rss", "application/rss+xml");
}
if (jackson2Present || jacksonPresent) {
props.put("json", MediaType.APPLICATION_JSON_VALUE);
}
if (jaxb2Present) {
props.put("xml", MediaType.APPLICATION_XML_VALUE);
}
if (jackson2Present || jacksonPresent) {
props.put("json", MediaType.APPLICATION_JSON_VALUE);
}
return props;
}
@ -485,7 +484,6 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { @@ -485,7 +484,6 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
if (jaxb2Present) {
messageConverters.add(createConverterDefinition(Jaxb2RootElementHttpMessageConverter.class, source));
}
if (jackson2Present) {
messageConverters.add(createConverterDefinition(MappingJackson2HttpMessageConverter.class, source));
}

17
spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java

@ -20,7 +20,6 @@ import java.util.ArrayList; @@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.xml.transform.Source;
@ -143,6 +142,9 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv @@ -143,6 +142,9 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv
*/
public class WebMvcConfigurationSupport implements ApplicationContextAware, ServletContextAware {
private static boolean romePresent =
ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", WebMvcConfigurationSupport.class.getClassLoader());
private static final boolean jaxb2Present =
ClassUtils.isPresent("javax.xml.bind.Binder", WebMvcConfigurationSupport.class.getClassLoader());
@ -154,8 +156,6 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv @@ -154,8 +156,6 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", WebMvcConfigurationSupport.class.getClassLoader()) &&
ClassUtils.isPresent("org.codehaus.jackson.JsonGenerator", WebMvcConfigurationSupport.class.getClassLoader());
private static boolean romePresent =
ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", WebMvcConfigurationSupport.class.getClassLoader());
private ServletContext servletContext;
@ -225,9 +225,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv @@ -225,9 +225,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
InterceptorRegistry registry = new InterceptorRegistry();
addInterceptors(registry);
registry.addInterceptor(new ConversionServiceExposingInterceptor(mvcConversionService()));
interceptors = registry.getInterceptors();
this.interceptors = registry.getInterceptors();
}
return interceptors.toArray();
return this.interceptors.toArray();
}
/**
@ -264,12 +264,12 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv @@ -264,12 +264,12 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
map.put("atom", MediaType.APPLICATION_ATOM_XML);
map.put("rss", MediaType.valueOf("application/rss+xml"));
}
if (jackson2Present || jacksonPresent) {
map.put("json", MediaType.APPLICATION_JSON);
}
if (jaxb2Present) {
map.put("xml", MediaType.APPLICATION_XML);
}
if (jackson2Present || jacksonPresent) {
map.put("json", MediaType.APPLICATION_JSON);
}
return map;
}
@ -552,6 +552,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv @@ -552,6 +552,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
messageConverters.add(new ResourceHttpMessageConverter());
messageConverters.add(new SourceHttpMessageConverter<Source>());
messageConverters.add(new AllEncompassingFormHttpMessageConverter());
if (romePresent) {
messageConverters.add(new AtomFeedHttpMessageConverter());
messageConverters.add(new RssChannelHttpMessageConverter());

4
spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -209,7 +209,7 @@ public class MappingJackson2JsonView extends AbstractView { @@ -209,7 +209,7 @@ public class MappingJackson2JsonView extends AbstractView {
/**
* Set whether to serialize models containing a single attribute as a map or whether to
* extract the single value from the model and serialize it directly.
* <p>The effect of setting this flag is similar to using {@code MappingJacksonHttpMessageConverter}
* <p>The effect of setting this flag is similar to using {@code MappingJackson2HttpMessageConverter}
* with an {@code @ResponseBody} request-handling method.
* <p>Default is {@code false}.
*/

Loading…
Cancel
Save