Buggy code:
public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport implements Ordered , ViewResolver { private static final Log logger = LogFactory . getLog ( ContentNegotiatingViewResolver . class ) ; private static final String ACCEPT_HEADER = "Accept" ; private static final boolean jafPresent = ClassUtils . isPresent ( "javax.activation.FileTypeMap" , ContentNegotiatingViewResolver . class . getClassLoader ( ) ) ; private static final UrlPathHelper urlPathHelper = new UrlPathHelper ( ) ; private int order = Ordered . HIGHEST_PRECEDENCE ; private boolean favorPathExtension = true ; private boolean favorParameter = false ; private String parameterName = "format" ; private boolean useNotAcceptableStatusCode = false ; private boolean ignoreAcceptHeader = false ; private boolean useJaf = true ; private ConcurrentMap < String , MediaType > mediaTypes = new ConcurrentHashMap < String , MediaType > ( ) ; private List < View > defaultViews ; private MediaType defaultContentType ; private List < ViewResolver > viewResolvers ; public void setOrder ( int order ) { } public int getOrder ( ) { } public void setFavorPathExtension ( boolean favorPathExtension ) { } public void setFavorParameter ( boolean favorParameter ) { } public void setParameterName ( String parameterName ) { } public void setIgnoreAcceptHeader ( boolean ignoreAcceptHeader ) { } public void setUseNotAcceptableStatusCode ( boolean useNotAcceptableStatusCode ) { } public void setMediaTypes ( Map < String , String > mediaTypes ) { } public void setDefaultViews ( List < View > defaultViews ) { } public void setDefaultContentType ( MediaType defaultContentType ) { } public void setUseJaf ( boolean useJaf ) { } public void setViewResolvers ( List < ViewResolver > viewResolvers ) { } @ Override protected void initServletContext ( ServletContext servletContext ) { } public View resolveViewName ( String viewName , Locale locale ) throws Exception { } protected List < MediaType > getMediaTypes ( HttpServletRequest request ) { if ( this . favorPathExtension ) { <START_BUG> String requestUri = ContentNegotiatingViewResolver . urlPathHelper . getRequestUri ( request ) ; <END_BUG> String filename = WebUtils . extractFullFilenameFromUrlPath ( requestUri ) ; MediaType mediaType = getMediaTypeFromFilename ( filename ) ; if ( mediaType != null ) { if ( ContentNegotiatingViewResolver . logger . isDebugEnabled ( ) ) { ContentNegotiatingViewResolver . logger . debug ( ( ( ( ( "Requested<seq2seq4repair_space>media<seq2seq4repair_space>type<seq2seq4repair_space>is<seq2seq4repair_space>'" + mediaType ) + "'<seq2seq4repair_space>(based<seq2seq4repair_space>on<seq2seq4repair_space>filename<seq2seq4repair_space>'" ) + filename ) + "')" ) ) ; } return Collections . singletonList ( mediaType ) ; } } if ( this . favorParameter ) { if ( ( request . getParameter ( this . parameterName ) ) != null ) { String parameterValue = request . getParameter ( this . parameterName ) ; MediaType mediaType = getMediaTypeFromParameter ( parameterValue ) ; if ( mediaType != null ) { if ( ContentNegotiatingViewResolver . logger . isDebugEnabled ( ) ) { ContentNegotiatingViewResolver . logger . debug ( ( ( ( ( ( ( "Requested<seq2seq4repair_space>media<seq2seq4repair_space>type<seq2seq4repair_space>is<seq2seq4repair_space>'" + mediaType ) + "'<seq2seq4repair_space>(based<seq2seq4repair_space>on<seq2seq4repair_space>parameter<seq2seq4repair_space>'" ) + ( this . parameterName ) ) + "'='" ) + parameterValue ) + "')" ) ) ; } return Collections . singletonList ( mediaType ) ; } } } if ( ! ( this . ignoreAcceptHeader ) ) { String acceptHeader = request . getHeader ( ContentNegotiatingViewResolver . ACCEPT_HEADER ) ; if ( StringUtils . hasText ( acceptHeader ) ) { try { List < MediaType > acceptableMediaTypes = MediaType . parseMediaTypes ( acceptHeader ) ; List < MediaType > producibleMediaTypes = getProducibleMediaTypes ( request ) ; Set < MediaType > compatibleMediaTypes = new LinkedHashSet < MediaType > ( ) ; for ( MediaType acceptable : acceptableMediaTypes ) { for ( MediaType producible : producibleMediaTypes ) { if ( acceptable . isCompatibleWith ( producible ) ) { compatibleMediaTypes . add ( getMostSpecificMediaType ( acceptable , producible ) ) ; } } } List < MediaType > mediaTypes = new ArrayList < MediaType > ( compatibleMediaTypes ) ; MediaType . sortByQualityValue ( mediaTypes ) ; if ( ContentNegotiatingViewResolver . logger . isDebugEnabled ( ) ) { ContentNegotiatingViewResolver . logger . debug ( ( ( ( ( ( "Requested<seq2seq4repair_space>media<seq2seq4repair_space>types<seq2seq4repair_space>are<seq2seq4repair_space>" + mediaTypes ) + "<seq2seq4repair_space>based<seq2seq4repair_space>on<seq2seq4repair_space>Accept<seq2seq4repair_space>header<seq2seq4repair_space>types<seq2seq4repair_space>" ) + "and<seq2seq4repair_space>producible<seq2seq4repair_space>media<seq2seq4repair_space>types<seq2seq4repair_space>" ) + producibleMediaTypes ) + ")" ) ) ; } return mediaTypes ; } catch ( IllegalArgumentException ex ) { if ( ContentNegotiatingViewResolver . logger . isDebugEnabled ( ) ) { ContentNegotiatingViewResolver . logger . debug ( ( ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>parse<seq2seq4repair_space>accept<seq2seq4repair_space>header<seq2seq4repair_space>[" + acceptHeader ) + "]:<seq2seq4repair_space>" ) + ( ex . getMessage ( ) ) ) ) ; } return null ; } } } if ( ( this . defaultContentType ) != null ) { if ( ContentNegotiatingViewResolver . logger . isDebugEnabled ( ) ) { ContentNegotiatingViewResolver . logger . debug ( ( ( "Requested<seq2seq4repair_space>media<seq2seq4repair_space>types<seq2seq4repair_space>is<seq2seq4repair_space>" + ( this . defaultContentType ) ) + "<seq2seq4repair_space>(based<seq2seq4repair_space>on<seq2seq4repair_space>defaultContentType<seq2seq4repair_space>property)" ) ) ; } return Collections . singletonList ( this . defaultContentType ) ; } else { return Collections . emptyList ( ) ; } } @ SuppressWarnings ( "unchecked" ) private List < MediaType > getProducibleMediaTypes ( HttpServletRequest request ) { } private MediaType getMostSpecificMediaType ( MediaType type1 , MediaType type2 ) { } protected MediaType getMediaTypeFromFilename ( String filename ) { } protected MediaType getMediaTypeFromParameter ( String parameterValue ) { } private List < View > getCandidateViews ( String viewName , Locale locale , List < MediaType > requestedMediaTypes ) throws Exception { } private List < String > getExtensionsForMediaType ( MediaType requestedMediaType ) { } private View getBestView ( List < View > candidateViews , List < MediaType > requestedMediaTypes ) { } private static class ActivationMediaTypeFactory { private static final FileTypeMap fileTypeMap ; private static FileTypeMap loadFileTypeMapFromContextSupportModule ( ) { } public static MediaType getMediaType ( String fileName ) { } } private static final View NOT_ACCEPTABLE_VIEW = new View ( ) { public String getContentType ( ) { } public void render ( Map < String , ? > model , HttpServletRequest request , HttpServletResponse response ) { } } ; }

Fix:
String requestUri = ContentNegotiatingViewResolver . urlPathHelper . getLookupPathForRequest ( request ) ;