/** * Override to provide handling when a key is not resolved via. * {@link #lookupMediaType}. Sub-classes can take further steps to * determine the media type(s). If a MediaType is returned from * this method it will be added to the cache in the base class. */ @Nullable protected MediaType handleNoMatch(NativeWebRequest request, String key) throws HttpMediaTypeNotAcceptableException { if (!isUseRegisteredExtensionsOnly()) { Optional<MediaType> mediaType = MediaTypeFactory.getMediaType("file." + key); if (mediaType.isPresent()) { return mediaType.get(); } } if (isIgnoreUnknownExtensions()) { return null; } throw new HttpMediaTypeNotAcceptableException(getAllMediaTypes()); }
/** * Override to provide handling when a key is not resolved via. * {@link #lookupMediaType}. Sub-classes can take further steps to * determine the media type(s). If a MediaType is returned from * this method it will be added to the cache in the base class. */ @Nullable protected MediaType handleNoMatch(NativeWebRequest request, String key) throws HttpMediaTypeNotAcceptableException { if (!isUseRegisteredExtensionsOnly()) { Optional<MediaType> mediaType = MediaTypeFactory.getMediaType("file." + key); if (mediaType.isPresent()) { return mediaType.get(); } } if (isIgnoreUnknownExtensions()) { return null; } throw new HttpMediaTypeNotAcceptableException(getAllMediaTypes()); }
/** * Override to provide handling when a key is not resolved via. * {@link #lookupMediaType}. Sub-classes can take further steps to * determine the media type(s). If a MediaType is returned from * this method it will be added to the cache in the base class. */ @Nullable protected MediaType handleNoMatch(NativeWebRequest request, String key) throws HttpMediaTypeNotAcceptableException { if (!isUseRegisteredExtensionsOnly()) { Optional<MediaType> mediaType = MediaTypeFactory.getMediaType("file." + key); if (mediaType.isPresent()) { return mediaType.get(); } } if (isIgnoreUnknownExtensions()) { return null; } throw new HttpMediaTypeNotAcceptableException(getAllMediaTypes()); }
/** * Override to provide handling when a key is not resolved via. * {@link #lookupMediaType}. Sub-classes can take further steps to * determine the media type(s). If a MediaType is returned from * this method it will be added to the cache in the base class. */ @Nullable protected MediaType handleNoMatch(NativeWebRequest request, String key) throws HttpMediaTypeNotAcceptableException { if (!isUseRegisteredExtensionsOnly()) { Optional<MediaType> mediaType = MediaTypeFactory.getMediaType("file." + key); if (mediaType.isPresent()) { return mediaType.get(); } } if (isIgnoreUnknownExtensions()) { return null; } throw new HttpMediaTypeNotAcceptableException(getAllMediaTypes()); }