@@ -2151,8 +2151,13 @@ public class TimeBasedAccessInterceptor extends HandlerInterceptorAdapter {
21512151 <classname >ViewResolvers</classname >. The first
21522152 <classname >View</classname > in the list that has a compatible
21532153 <literal >Content-Type</literal > returns the representation to the
2154- client. The <literal >Accept</literal > header may include wildcards, for
2155- example text/*, in which case a <classname >View</classname > whose
2154+ client. If a compatible view cannot be supplied by the
2155+ <classname >ViewResolver</classname > chain, then the list of views specified
2156+ through the <literal >DefaultViews</literal > property will be consulted. This
2157+ latter option is appropriate for singleton <classname >Views</classname > that
2158+ can render an appropriate representation of the current resource regardless
2159+ of the logical view name. The <literal >Accept</literal > header may include
2160+ wildcards, for example text/*, in which case a <classname >View</classname > whose
21562161 Context-Type was text/xml is a compatible match.</para >
21572162
21582163 <para >To support the resolution of a view based on a file extension,
@@ -2170,6 +2175,7 @@ public class TimeBasedAccessInterceptor extends HandlerInterceptorAdapter {
21702175 < map>
21712176 < entry key="atom" value="application/atom+xml"/>
21722177 < entry key="html" value="text/html"/>
2178+ < entry key="json" value="application/json"/>
21732179 < /map>
21742180 < /property>
21752181 < property name="viewResolvers">
@@ -2181,6 +2187,11 @@ public class TimeBasedAccessInterceptor extends HandlerInterceptorAdapter {
21812187 < /bean>
21822188 < /list>
21832189 < /property>
2190+ < property name="defaultViews">
2191+ < list>
2192+ < bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
2193+ < /list>
2194+ < /property>
21842195< /bean>
21852196
21862197
@@ -2206,10 +2217,12 @@ public class TimeBasedAccessInterceptor extends HandlerInterceptorAdapter {
22062217 matches the <literal >application/atom+xml</literal > media type. This view is provided by
22072218 the <classname >BeanNameViewResolver</classname > that maps to the
22082219 <classname >SampleContentAtomView</classname > if the view name returned
2209- is <classname >content</classname >. Alternatively, client requests can be
2210- made without a file extension but with the <literal >Accept</literal > header set to the
2211- preferred media-type, and the same resolution of request to views would
2212- occur.<!-- Can you reword preceding sentence? I don't follow it.--> </para >
2220+ is <classname >content</classname >. If the request is made with the file extension
2221+ <literal >.json</literal >, the <classname >MappingJacksonJsonView</classname > instance from
2222+ the <literal >DefaultViews</literal > list will be selected regardless of the view name.
2223+ Alternatively, client requests can be made without a file extension but with the
2224+ <literal >Accept</literal > header set to the preferred media-type, and the same resolution
2225+ of request to views would occur.<!-- Can you reword preceding sentence? I don't follow it.--> </para >
22132226
22142227 <note >
22152228 <para >If <classname >ContentNegotiatingViewResolver</classname >'s list
0 commit comments