Skip to content

Commit 562747e

Browse files
committed
Review recent documentation and default servlet changes
- Relocate and fix typos in interface-based @RequestMapping tip (SPR-7537) - Fix typos in constructor-arg 'name' disambiguation section (SPR-7443) - Polish whitespace in DefaultServletHttpRequestHandler (SPR-7553)
1 parent c1d2c36 commit 562747e

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/resource/DefaultServletHttpRequestHandler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ public class DefaultServletHttpRequestHandler implements HttpRequestHandler, Ser
5151

5252
/** Default Servlet name used by Tomcat, Jetty, JBoss, and GlassFish */
5353
private static final String COMMON_DEFAULT_SERVLET_NAME = "default";
54-
54+
5555
/** Default Servlet name used by Google App Engine */
5656
private static final String GAE_DEFAULT_SERVLET_NAME = "_ah_default";
57-
57+
5858
/** Default Servlet name used by Resin */
5959
private static final String RESIN_DEFAULT_SERVLET_NAME = "resin-file";
60-
60+
6161
/** Default Servlet name used by WebLogic */
6262
private static final String WEBLOGIC_DEFAULT_SERVLET_NAME = "FileServlet";
63-
63+
6464
/** Default Servlet name used by WebSphere */
6565
private static final String WEBSPHERE_DEFAULT_SERVLET_NAME = "SimpleFileServlet";
6666

@@ -104,7 +104,7 @@ else if (this.servletContext.getNamedDispatcher(WEBSPHERE_DEFAULT_SERVLET_NAME)
104104
throw new IllegalStateException("Unable to locate the default servlet for serving static content. " +
105105
"Please set the 'defaultServletName' property explicitly.");
106106
}
107-
}
107+
}
108108
}
109109

110110

spring-framework-reference/src/beans-dependencies.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ public class ExampleBean {
171171
&lt;/bean&gt;</programlisting>
172172

173173
<para>Keep in mind that to make this work out of the box your code
174-
has to be compiled with the debug flag enabled so that Spring can
175-
lookup the parameter name from the constructor. If you can't compile
174+
must be compiled with the debug flag enabled so that Spring can
175+
look up the parameter name from the constructor. If you can't compile
176176
your code with debug flag (or don't want to) you can use
177177
<interfacename><ulink
178178
url="http://download.oracle.com/javase/6/docs/api/java/beans/ConstructorProperties.html">@ConstructorProperties</ulink></interfacename>

spring-framework-reference/src/mvc.xml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -667,18 +667,6 @@ public class HelloWorldController {
667667

668668
&lt;/beans&gt;</programlisting>
669669

670-
<para>A common pitfall when working with annotated controller classes is
671-
a scenario where you want apply functionality to it that involves
672-
creating a proxy for the controller object (transactional controllers
673-
e.g.). Usually you will introduce an interface for the controller then
674-
to use JDK dynamic proxies. To make this work you have to move the
675-
<interfacename>@RequestMapping</interfacename> annotations to the
676-
interface as well as the mapping lookup only "sees" the interface
677-
exposed by the proxy then. An alternative might be to activate
678-
<code>proxy-target-class="true"</code> in the configuration for the
679-
functionality applied to the controller (in our transaction scenario in
680-
<code>&lt;tx:annotation-driven /&gt;</code>). For more information on
681-
various proxying mechanisms see <xref linkend="aop-proxying" />.</para>
682670
</section>
683671

684672
<section id="mvc-ann-requestmapping">
@@ -777,6 +765,25 @@ public class ClinicController {
777765

778766
}</programlisting>
779767

768+
<tip>
769+
<title>Working with interface-based @Controller classes</title>
770+
<para>A common pitfall when working with annotated controller classes
771+
happens when applying functionality that requires creating a proxy
772+
proxy for the controller object (e.g.
773+
<interfacename>@Transactional</interfacename> methods). Usually you
774+
will introduce an interface for the controller in order to use JDK
775+
dynamic proxies. To make this work you must move the
776+
<interfacename>@RequestMapping</interfacename> annotations to the
777+
interface as as the mapping mechanism can only "see" the interface
778+
exposed by the proxy. As an alternative, you may choose to activate
779+
<code>proxy-target-class="true"</code> in the configuration for the
780+
functionality applied to the controller (in our transaction scenario
781+
in <code>&lt;tx:annotation-driven /&gt;</code>). Doing so indicates
782+
that CGLIB-based subclass proxies should be used instead of
783+
interface-based JDK proxies. For more information on various proxying
784+
mechanisms see <xref linkend="aop-proxying"/>.</para>
785+
</tip>
786+
780787
<section id="mvc-ann-requestmapping-uri-templates">
781788
<title>URI Templates</title>
782789

0 commit comments

Comments
 (0)