@ -2526,6 +2526,7 @@ public class ReplacementComputeValue implements MethodReplacer {
@@ -2526,6 +2526,7 @@ public class ReplacementComputeValue implements MethodReplacer {
@ -6545,7 +6546,7 @@ public Service userService() {
@@ -6545,7 +6546,7 @@ public Service userService() {
protected abstract Command createCommand();
} ]]></programlisting></para>
<para>Using Java-configurtion support we can easily create a
<para>Using Java-configuration support we can easily create a
subclass of <code>CommandManager</code> where the abstract
<code>createCommand()</code> is overridden in such a way that it
'looks up' a brand new (prototype) command object: <programlisting
@ -6851,4 +6852,4 @@ public class CachingMovieCatalog implements MovieCatalog {
@@ -6851,4 +6852,4 @@ public class CachingMovieCatalog implements MovieCatalog {
for more detail. For more on AspectJ load-time weaving, see <xref
String message = (String) exp.getValue();</programlisting>The value of the
message variable is simply 'Hello World'.</para>
message variable is simply 'Hello World'.</para>
<para>The SpEL classes and interfaces you are most likely to use are
located in the packages <package>org.springframework.expression</package>
and its subpackages <package>spel.antlr</package> and
and its subpackages <package>spel.antlr</package> and
<package>spel.support</package>.</para>
<para>The expression language is based on a grammar and uses ANTLR to
@ -143,10 +142,10 @@ String message = (String) exp.getValue();</programlisting>The value of the
@@ -143,10 +142,10 @@ String message = (String) exp.getValue();</programlisting>The value of the
can be thrown, <classname>ParseException</classname> and
<classname>EvaluationException</classname> when calling
<para>SpEL supports a wide range of features, such a calling methods,
accessing properties and calling constructors.</para>
<para>SpEL supports a wide range of features, such as calling methods,
accessing properties and calling constructors.</para>
<para>As an example of method invocation, we call the 'concat' method on
the string literal</para>
@ -155,23 +154,28 @@ String message = (String) exp.getValue();</programlisting>The value of the
@@ -155,23 +154,28 @@ String message = (String) exp.getValue();</programlisting>The value of the
<para>The more common usage of SpEL is provide an expression string that
is evaluated against a specific object instance. In the following example
we retrieve the <literal>Name</literal> property from an instance of the
Inventor class.</para>
Inventor class.</para>
<para><programlistinglanguage="java">// Create and set a calendar
GregorianCalendar c = new GregorianCalendar();
@ -211,7 +215,7 @@ String name = (String) exp.getValue(context);</programlisting>In the last
@@ -211,7 +215,7 @@ String name = (String) exp.getValue(context);</programlisting>In the last
Tesla". The class StandardEvaluationContext is where you can specify which
object the "Name" property will be evaluated against. You can reuse the
same expression over and over again and set a new root object on the
evaluation context. Expressions are evaluated using reflection.</para>
evaluation context. Expressions are evaluated using reflection.</para>
<para><note>
<para>In standalone usage of SpEL you will need to create the parser
@ -227,10 +231,10 @@ String name = (String) exp.getValue(context);</programlisting>In the last
@@ -227,10 +231,10 @@ String name = (String) exp.getValue(context);</programlisting>In the last
boolean result = exp.getValue(context, Boolean.class); // evaluates to true</programlisting>
<section>
<title>The EvaluationContext interface</title>
<title>The EvaluationContext interface</title>
<para>The interface <interfacename>EvaluationContext</interfacename> is
used when evaluating an expression to resolve properties, methods,
used when evaluating an expression to resolve properties, methods,
fields, and to help perform type conversion. The out-of-the-box
the <emphasis>Object to XML mapping</emphasis> functionality mentioned
earlier.</para>
@ -449,13 +443,13 @@ public class AppConfig{
@@ -449,13 +443,13 @@ public class AppConfig{
<para>Work in progress... not part of the Spring 3.0 M3 release.</para>
</section>
<sectionid="new-feature-embedded-databases">
<title>Support for embedded databases</title>
<para>
Convenient support for <linklinkend="jdbc-embedded-database-support">embedded Java database engines</link>, including HSQL, H2, and Derby, is now provided.
<para><classname>AbstractAtomFeedView</classname> requires you to
implement the <methodname>buildFeedEntries</methodname> method and
@ -488,10 +486,10 @@ public class ContentController {
@@ -488,10 +486,10 @@ public class ContentController {
<para>The <methodname>buildFeedItems</methodname> and
<methodname>buildFeedEntires</methodname> pass in the HTTP request in
case you need to access the Locale. The HTTP response in passed in
case you need to access the Locale. The HTTP response is passed in
only for the setting of cookies or other HTTP headers. The feed will
automatically be written to the response object after the method
returns.</para>
returns.</para>
<para>For an example of creating a Atom view please refer to Alef
Arendsen's SpringSource TeamBlog <ulink
@ -508,7 +506,11 @@ public class ContentController {
@@ -508,7 +506,11 @@ public class ContentController {
explicitly using <classname>MarhsallingView</classname>'s
<property>modelKey</property> bean property. Alternatively, the view
will iterate over all model properties marhsall only those types that
are supported by the <interfacename>Marshaller</interfacename>.</para>
are supported by the <interfacename>Marshaller</interfacename>. For
more information on the functionality in the
<classname>org.springframework.oxm</classname> package refer to the
chapter <linklinkend="oxm">Marshalling XML using O/X
Mappers</link>.</para>
</section>
</section>
@ -517,7 +519,7 @@ public class ContentController {
@@ -517,7 +519,7 @@ public class ContentController {
<para>A key principle of REST is the use of the Uniform Interface. This
means that all resources (URLs) can be manipulated using the same four
HTTP method: GET, PUT, POST, and DELETE. For each methods, the HTTP
HTTP methods: GET, PUT, POST, and DELETE. For each methods, the HTTP
specification defines the exact semantics. For instance, a GET should
always be a safe operation, meaning that is has no side effects, and a
PUT or DELETE should be idempotent, meaning that you can repeat these
@ -566,26 +568,26 @@ public String deletePet(@PathVariable int ownerId, @PathVariable int petId) {
@@ -566,26 +568,26 @@ public String deletePet(@PathVariable int ownerId, @PathVariable int petId) {
used to determine change in content at a given URL. It can be considered
to be the more sophisticated successor to the
<literal>Last-Modified</literal> header. When a server returns a
representation with an ETag header, client can use this header in
subsequent GETs, in a <literal>If-None-Match</literal> header. If the
representation with an ETag header, the client can use this header in
subsequent GETs, in an<literal>If-None-Match</literal> header. If the
content has not changed, the server will return <literal>304: Not
Modified</literal>.</para>
<para>Support for ETags is provided by the servlet filter
<classname>ShallowEtagHeaderFilter</classname>. Since it is a plain
Servlet Filter, and thus can be used in combination any web framework.
The <classname>ShallowEtagHeaderFilter</classname> filter creates
so-called shallow ETags (as opposed to a deep ETags, more about that
later). The way it works is quite simple: the filter simply caches the
content of the rendered JSP (or other content), generates a MD5 hash
over that, and returns that as a ETag header in the response. The next
time a client sends a request for the same resource, it use that hash as
the <literal>If-None-Match</literal> value. The filter notices this,
renders the view again, and compares the two hashes. If they are equal,
a <literal>304</literal> is returned. It is important to note that this
filter will not save processing power, as the view is still rendered.
The only thing it saves is bandwidth, as the rendered response is not
sent back over the wire.</para>
Servlet Filter, and thus can be used in combination with any web
framework. The <classname>ShallowEtagHeaderFilter</classname> filter
creates so-called shallow ETags (as opposed to deep ETags, more about
that later). The way it works is quite simple: the filter simply caches
the content of the rendered JSP (or other content), generates an MD5
hash over that, and returns that as an ETag header in the response. The
next time a client sends a request for the same resource, it uses that
hash as the <literal>If-None-Match</literal> value. The filter notices
this, renders the view again, and compares the two hashes. If they are
equal, a <literal>304</literal> is returned. It is important to note
that this filter will not save processing power, as the view is still
rendered. The only thing it saves is bandwidth, as the rendered response
is not sent back over the wire.</para>
<para>Deep ETags are a bit more complicated. In this case, the ETag is
based on the underlying domain objects, RDMBS tables, etc. Using this
@ -623,18 +625,18 @@ public class SimpleController {
@@ -623,18 +625,18 @@ public class SimpleController {
the types in the list, then the method annotated with the matching
<classname>@ExceptionHandler</classname> will be invoked. If the
annotation value is not set then the exception types listed as method
arguments are used.</para>
arguments are used.</para>
<para>Much like standard controller methods annotated with a
<classname>@RequestMapping</classname> annotation, the method arguments
and return values of <classname>@ExceptionHandler</classname> methods
are very flexible. For example, the
<classname>HttpServletRequest</classname> can be access in Servlet
<classname>HttpServletRequest</classname> can be accessed in Servlet
environments and the <classname>PortletRequest</classname> in Portlet
environments. The return type can be a <classname>String</classname>,
which is interpreted as a view name or a
<classname>ModelAndView</classname> object. Please refer to the API
documentation for more details.</para>
documentation for more details.</para>
</section>
</section>
@ -655,7 +657,7 @@ public class SimpleController {
@@ -655,7 +657,7 @@ public class SimpleController {
uses the Object-to-XML framework that is part of the
<classname>org.springframework.oxm</classname> package. This gives you a
wide range of choices of XML to Object mapping technologies to choose
from.</para>
from.</para>
<para>This section describes how to use the
<classname>RestTemplate</classname> and its associated
@ -684,9 +686,9 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
@@ -684,9 +686,9 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
}
}</programlisting>
<para>RestTemplate provides higher level methods that correspond to
each of the six main HTTP methods that make invoking many RESTful
services a one-liner and enforce REST best practices.</para>
<para>RestTemplate provides higher level methods that correspond to each
of the six main HTTP methods that make invoking many RESTful services a
one-liner and enforce REST best practices.</para>
<table>
<title>Overview of RestTemplate methods</title>
@ -756,9 +758,9 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
@@ -756,9 +758,9 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
naming convention, the first part indicates what HTTP method is being
invoked and the second part indicates what is returned. For example, the
method <methodname>getForObject</methodname> will perform a GET, convert
the HTTP response into an object type of your choice, and returns that
the HTTP response into an object type of your choice and return that
object. The method <methodname>postForLocation</methodname> will do a
POST, converting the given object into a HTTP request, and returns the
POST, converting the given object into a HTTP request and return the
response HTTP Location header where the newly created object can be
found In case of an exception processing the HTTP request, an exception
of the type <classname>RestClientException</classname> will be
@ -781,20 +783,20 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
@@ -781,20 +783,20 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
<para>Each method takes URI template arguments in two forms, either as a
<literal>String</literal> variable length argument or a
<literal>Map<String,String></literal>. For example,</para>
<literal>Map<String,String></literal>. For example,</para>
<programlistinglanguage="java">String result = restTemplate.getForObject("http://example.com/hotels/{hotel}/bookings/{booking}",
String.class,"42", "21");
</programlisting>
<para>using variable length arguments and</para>
<para>using variable length arguments and</para>
<programlistinglanguage="java">Map<String, String> vars = Collections.singletonMap("hotel", 42);
<programlistinglanguage="java">Map<String, String> vars = Collections.singletonMap("hotel", "42");