Polishing
This commit is contained in:
parent
e2518e0b7c
commit
97ea43681b
|
@ -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.
|
||||
|
@ -20,21 +20,23 @@ import org.springframework.beans.BeansException;
|
|||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Exception thrown when a {@code BeanFactory} is asked for a bean instance
|
||||
* for which it cannot find a definition.
|
||||
* Exception thrown when a {@code BeanFactory} is asked for a bean instance for which it
|
||||
* cannot find a definition. This may point to a non-existing bean, a non-unique bean,
|
||||
* or a manually registered singleton instance without an associated bean definition.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @see BeanFactory#getBean(String)
|
||||
* @see BeanFactory#getBean(Class)
|
||||
* @see NoUniqueBeanDefinitionException
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class NoSuchBeanDefinitionException extends BeansException {
|
||||
|
||||
/** Name of the missing bean. */
|
||||
/** Name of the missing bean */
|
||||
private String beanName;
|
||||
|
||||
/** Required type of the missing bean. */
|
||||
/** Required type of the missing bean */
|
||||
private Class<?> beanType;
|
||||
|
||||
|
||||
|
|
|
@ -62,13 +62,14 @@ public class TilesView extends AbstractUrlBasedView {
|
|||
* Specify whether to always include the view rather than forward to it.
|
||||
* <p>Default is "false". Switch this flag on to enforce the use of a
|
||||
* Servlet include, even if a forward would be possible.
|
||||
* @see TilesViewResolver#setAlwaysInclude(Boolean)
|
||||
* @since 4.1.2
|
||||
* @see TilesViewResolver#setAlwaysInclude
|
||||
*/
|
||||
public void setAlwaysInclude(boolean alwaysInclude) {
|
||||
this.alwaysInclude = alwaysInclude;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkResource(final Locale locale) throws Exception {
|
||||
TilesContainer container = ServletUtil.getContainer(getServletContext());
|
||||
|
|
|
@ -48,25 +48,27 @@ public class TilesViewResolver extends UrlBasedViewResolver {
|
|||
setViewClass(requiredViewClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether to always include the view rather than forward to it.
|
||||
* <p>Default is "false". Switch this flag on to enforce the use of a
|
||||
* Servlet include, even if a forward would be possible.
|
||||
* @see TilesView#setAlwaysInclude
|
||||
* @since 4.1.2
|
||||
*/
|
||||
public void setAlwaysInclude(Boolean alwaysInclude) {
|
||||
this.alwaysInclude = alwaysInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires {@link TilesView}.
|
||||
* This resolver requires {@link TilesView}.
|
||||
*/
|
||||
@Override
|
||||
protected Class<?> requiredViewClass() {
|
||||
return TilesView.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether to always include the view rather than forward to it.
|
||||
* <p>Default is "false". Switch this flag on to enforce the use of a
|
||||
* Servlet include, even if a forward would be possible.
|
||||
* @since 4.1.2
|
||||
* @see TilesView#setAlwaysInclude
|
||||
*/
|
||||
public void setAlwaysInclude(Boolean alwaysInclude) {
|
||||
this.alwaysInclude = alwaysInclude;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected AbstractUrlBasedView buildView(String viewName) throws Exception {
|
||||
TilesView view = (TilesView) super.buildView(viewName);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the configured {@code UrlPathHelper}.
|
||||
* Return the configured {@code UrlPathHelper}.
|
||||
*/
|
||||
public UrlPathHelper getPathHelper() {
|
||||
return this.pathHelper;
|
||||
|
@ -85,7 +85,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the configured {@code PathMatcher}.
|
||||
* Return the configured {@code PathMatcher}.
|
||||
*/
|
||||
public PathMatcher getPathMatcher() {
|
||||
return this.pathMatcher;
|
||||
|
@ -93,7 +93,6 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
|||
|
||||
/**
|
||||
* Manually configure the resource mappings.
|
||||
*
|
||||
* <p><strong>Note:</strong> by default resource mappings are auto-detected
|
||||
* from the Spring {@code ApplicationContext}. However if this property is
|
||||
* used, the auto-detection is turned off.
|
||||
|
@ -107,7 +106,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the resource mappings, either manually configured or auto-detected
|
||||
* Return the resource mappings, either manually configured or auto-detected
|
||||
* when the Spring {@code ApplicationContext} is refreshed.
|
||||
*/
|
||||
public Map<String, ResourceHttpRequestHandler> getHandlerMap() {
|
||||
|
@ -115,7 +114,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {@code false} if resource mappings were manually configured,
|
||||
* Return {@code false} if resource mappings were manually configured,
|
||||
* {@code true} otherwise.
|
||||
*/
|
||||
public boolean isAutodetect() {
|
||||
|
@ -134,7 +133,6 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
|||
}
|
||||
|
||||
protected void detectResourceHandlers(ApplicationContext appContext) {
|
||||
|
||||
logger.debug("Looking for resource handler mappings");
|
||||
|
||||
Map<String, SimpleUrlHandlerMapping> map = appContext.getBeansOfType(SimpleUrlHandlerMapping.class);
|
||||
|
@ -162,7 +160,6 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
|||
* A variation on {@link #getForLookupPath(String)} that accepts a full request
|
||||
* URL path (i.e. including context and servlet path) and returns the full request
|
||||
* URL path to expose for public use.
|
||||
*
|
||||
* @param request the current request
|
||||
* @param requestUrl the request URL path to resolve
|
||||
* @return the resolved public URL path or {@code null} if unresolved
|
||||
|
@ -189,12 +186,10 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
|||
* if a match is found use the {@code ResourceResolver} chain of the matched
|
||||
* {@code ResourceHttpRequestHandler} to resolve the URL path to expose for
|
||||
* public use.
|
||||
*
|
||||
* <p>It is expected the given path is what Spring MVC would use for request
|
||||
* mapping purposes, i.e. excluding context and servlet path portions.
|
||||
*
|
||||
* <p>It is expected that the given path is what Spring MVC would use for
|
||||
* request mapping purposes, i.e. excluding context and servlet path portions.
|
||||
* @param lookupPath the lookup path to check
|
||||
* @return the resolved public URL path or {@code null} if unresolved
|
||||
* @return the resolved public URL path, or {@code null} if unresolved
|
||||
*/
|
||||
public final String getForLookupPath(String lookupPath) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
|
|
|
@ -81,8 +81,8 @@ public class TilesView extends AbstractUrlBasedView {
|
|||
* Specify whether to always include the view rather than forward to it.
|
||||
* <p>Default is "false". Switch this flag on to enforce the use of a
|
||||
* Servlet include, even if a forward would be possible.
|
||||
* @see TilesViewResolver#setAlwaysInclude(Boolean)
|
||||
* @since 4.1.2
|
||||
* @see TilesViewResolver#setAlwaysInclude
|
||||
*/
|
||||
public void setAlwaysInclude(boolean alwaysInclude) {
|
||||
this.alwaysInclude = alwaysInclude;
|
||||
|
@ -99,6 +99,7 @@ public class TilesView extends AbstractUrlBasedView {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkResource(final Locale locale) throws Exception {
|
||||
HttpServletRequest servletRequest = null;
|
||||
|
|
|
@ -41,6 +41,15 @@ public class TilesViewResolver extends UrlBasedViewResolver {
|
|||
setViewClass(requiredViewClass());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This resolver requires {@link TilesView}.
|
||||
*/
|
||||
@Override
|
||||
protected Class<?> requiredViewClass() {
|
||||
return TilesView.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link Renderer} to use. If not specified, a default
|
||||
* {@link org.apache.tiles.renderer.DefinitionRenderer} will be used.
|
||||
|
@ -54,20 +63,13 @@ public class TilesViewResolver extends UrlBasedViewResolver {
|
|||
* Specify whether to always include the view rather than forward to it.
|
||||
* <p>Default is "false". Switch this flag on to enforce the use of a
|
||||
* Servlet include, even if a forward would be possible.
|
||||
* @see TilesView#setAlwaysInclude
|
||||
* @since 4.1.2
|
||||
* @see TilesView#setAlwaysInclude
|
||||
*/
|
||||
public void setAlwaysInclude(Boolean alwaysInclude) {
|
||||
this.alwaysInclude = alwaysInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires {@link TilesView}.
|
||||
*/
|
||||
@Override
|
||||
protected Class<?> requiredViewClass() {
|
||||
return TilesView.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TilesView buildView(String viewName) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue