|  | 
| 1 | 1 | /* | 
| 2 |  | - * Copyright 2002-2013 the original author or authors. | 
|  | 2 | + * Copyright 2002-2015 the original author or authors. | 
| 3 | 3 |  * | 
| 4 | 4 |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
| 5 | 5 |  * you may not use this file except in compliance with the License. | 
|  | 
| 48 | 48 | import org.springframework.beans.factory.BeanInitializationException; | 
| 49 | 49 | import org.springframework.beans.factory.NoSuchBeanDefinitionException; | 
| 50 | 50 | import org.springframework.context.ApplicationContext; | 
| 51 |  | -import org.springframework.core.OrderComparator; | 
|  | 51 | +import org.springframework.core.annotation.AnnotationAwareOrderComparator; | 
| 52 | 52 | import org.springframework.core.io.ClassPathResource; | 
| 53 | 53 | import org.springframework.core.io.support.PropertiesLoaderUtils; | 
| 54 | 54 | import org.springframework.core.style.StylerUtils; | 
|  | 
| 66 | 66 |  * controllers. Dispatches to registered handlers for processing a portlet request. | 
| 67 | 67 |  * | 
| 68 | 68 |  * <p>This portlet is very flexible: It can be used with just about any workflow, | 
| 69 |  | - * with the installation of the appropriate adapter classes. It offers the | 
| 70 |  | - * following functionality that distinguishes it from other request-driven | 
| 71 |  | - * portlet MVC frameworks: | 
|  | 69 | + * with the installation of the appropriate adapter classes. It offers the following | 
|  | 70 | + * functionality that distinguishes it from other request-driven Portlet MVC frameworks: | 
| 72 | 71 |  * | 
| 73 | 72 |  * <ul> | 
| 74 | 73 |  * <li>It is based around a JavaBeans configuration mechanism. | 
|  | 
| 77 | 76 |  * as part of an application - to control the routing of requests to handler objects. | 
| 78 | 77 |  * Default is a {@link org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping}. | 
| 79 | 78 |  * HandlerMapping objects can be defined as beans in the portlet's application context, | 
| 80 |  | - * implementing the HandlerMapping interface, overriding the default HandlerMapping if present. | 
| 81 |  | - * HandlerMappings can be given any bean name (they are tested by type). | 
|  | 79 | + * implementing the HandlerMapping interface, overriding the default HandlerMapping | 
|  | 80 | + * if present. HandlerMappings can be given any bean name (they are tested by type). | 
| 82 | 81 |  * | 
| 83 | 82 |  * <li>It can use any {@link HandlerAdapter}; this allows for using any handler interface. | 
| 84 | 83 |  * The default adapter is {@link org.springframework.web.portlet.mvc.SimpleControllerHandlerAdapter} | 
|  | 
| 102 | 101 |  * (they are tested by type). | 
| 103 | 102 |  * | 
| 104 | 103 |  * <li>The dispatcher's strategy for resolving multipart requests is determined by a | 
| 105 |  | - * {@link org.springframework.web.portlet.multipart.PortletMultipartResolver} implementation. | 
| 106 |  | - * An implementations for Jakarta Commons FileUpload is included: | 
|  | 104 | + * {@link org.springframework.web.portlet.multipart.PortletMultipartResolver} | 
|  | 105 | + * implementation. An implementations for Apache Commons FileUpload is included: | 
| 107 | 106 |  * {@link org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver}. | 
| 108 | 107 |  * The MultipartResolver bean name is "portletMultipartResolver"; default is none. | 
| 109 | 108 |  * </ul> | 
| 110 | 109 |  * | 
| 111 |  | - * <p><b>NOTE: The {@code @RequestMapping} annotation will only be processed | 
| 112 |  | - * if a corresponding {@code HandlerMapping} (for type level annotations) | 
| 113 |  | - * and/or {@code HandlerAdapter} (for method level annotations) | 
| 114 |  | - * is present in the dispatcher.</b> This is the case by default. | 
| 115 |  | - * However, if you are defining custom {@code HandlerMappings} or | 
| 116 |  | - * {@code HandlerAdapters}, then you need to make sure that a | 
| 117 |  | - * corresponding custom {@code DefaultAnnotationHandlerMapping} | 
| 118 |  | - * and/or {@code AnnotationMethodHandlerAdapter} is defined as well | 
| 119 |  | - * - provided that you intend to use {@code @RequestMapping}. | 
|  | 110 | + * <p><b>NOTE: The {@code @RequestMapping} annotation will only be processed if a | 
|  | 111 | + * corresponding {@code HandlerMapping} (for type-level annotations) and/or | 
|  | 112 | + * {@code HandlerAdapter} (for method-level annotations) is present in the dispatcher.</b> | 
|  | 113 | + * This is the case by default. However, if you are defining custom {@code HandlerMappings} | 
|  | 114 | + * or {@code HandlerAdapters}, then you need to make sure that a corresponding custom | 
|  | 115 | + * {@code DefaultAnnotationHandlerMapping} and/or {@code AnnotationMethodHandlerAdapter} | 
|  | 116 | + * is defined as well - provided that you intend to use {@code @RequestMapping}. | 
| 120 | 117 |  * | 
| 121 | 118 |  * <p><b>A web application can define any number of DispatcherPortlets.</b> | 
| 122 |  | - * Each portlet will operate in its own namespace, loading its own application | 
| 123 |  | - * context with mappings, handlers, etc. Only the root application context | 
| 124 |  | - * as loaded by {@link org.springframework.web.context.ContextLoaderListener}, | 
| 125 |  | - * if any, will be shared. | 
|  | 119 | + * Each portlet will operate in its own namespace, loading its own application context | 
|  | 120 | + * with mappings, handlers, etc. Only the root application context as loaded by | 
|  | 121 | + * {@link org.springframework.web.context.ContextLoaderListener}, if any, will be shared. | 
| 126 | 122 |  * | 
| 127 | 123 |  * <p>Thanks to Rainer Schmitz, Nick Lothian and Eric Dalquist for their suggestions! | 
| 128 | 124 |  * | 
| @@ -401,7 +397,7 @@ private void initHandlerMappings(ApplicationContext context) { | 
| 401 | 397 | 			if (!matchingBeans.isEmpty()) { | 
| 402 | 398 | 				this.handlerMappings = new ArrayList<HandlerMapping>(matchingBeans.values()); | 
| 403 | 399 | 				// We keep HandlerMappings in sorted order. | 
| 404 |  | -				OrderComparator.sort(this.handlerMappings); | 
|  | 400 | +				AnnotationAwareOrderComparator.sort(this.handlerMappings); | 
| 405 | 401 | 			} | 
| 406 | 402 | 		} | 
| 407 | 403 | 		else { | 
| @@ -439,7 +435,7 @@ private void initHandlerAdapters(ApplicationContext context) { | 
| 439 | 435 | 			if (!matchingBeans.isEmpty()) { | 
| 440 | 436 | 				this.handlerAdapters = new ArrayList<HandlerAdapter>(matchingBeans.values()); | 
| 441 | 437 | 				// We keep HandlerAdapters in sorted order. | 
| 442 |  | -				OrderComparator.sort(this.handlerAdapters); | 
|  | 438 | +				AnnotationAwareOrderComparator.sort(this.handlerAdapters); | 
| 443 | 439 | 			} | 
| 444 | 440 | 		} | 
| 445 | 441 | 		else { | 
| @@ -477,7 +473,7 @@ private void initHandlerExceptionResolvers(ApplicationContext context) { | 
| 477 | 473 | 			if (!matchingBeans.isEmpty()) { | 
| 478 | 474 | 				this.handlerExceptionResolvers = new ArrayList<HandlerExceptionResolver>(matchingBeans.values()); | 
| 479 | 475 | 				// We keep HandlerExceptionResolvers in sorted order. | 
| 480 |  | -				OrderComparator.sort(this.handlerExceptionResolvers); | 
|  | 476 | +				AnnotationAwareOrderComparator.sort(this.handlerExceptionResolvers); | 
| 481 | 477 | 			} | 
| 482 | 478 | 		} | 
| 483 | 479 | 		else { | 
| @@ -516,7 +512,7 @@ private void initViewResolvers(ApplicationContext context) { | 
| 516 | 512 | 			if (!matchingBeans.isEmpty()) { | 
| 517 | 513 | 				this.viewResolvers = new ArrayList<ViewResolver>(matchingBeans.values()); | 
| 518 | 514 | 				// We keep ViewResolvers in sorted order. | 
| 519 |  | -				OrderComparator.sort(this.viewResolvers); | 
|  | 515 | +				AnnotationAwareOrderComparator.sort(this.viewResolvers); | 
| 520 | 516 | 			} | 
| 521 | 517 | 		} | 
| 522 | 518 | 		else { | 
|  | 
0 commit comments