public class ServletPathExtensionContentNegotiationStrategy extends PathExtensionContentNegotiationStrategy
PathExtensionContentNegotiationStrategy
that also uses
ServletContext.getMimeType(String)
to resolve file extensions.Constructor and Description |
---|
ServletPathExtensionContentNegotiationStrategy(javax.servlet.ServletContext context)
Create an instance without any mappings to start with.
|
ServletPathExtensionContentNegotiationStrategy(javax.servlet.ServletContext servletContext,
Map<String,org.springframework.http.MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
Modifier and Type | Method and Description |
---|---|
org.springframework.http.MediaType |
getMediaTypeForResource(org.springframework.core.io.Resource resource)
Extends the base class
PathExtensionContentNegotiationStrategy.getMediaTypeForResource(org.springframework.core.io.Resource)
with the ability to also look up through the ServletContext. |
protected org.springframework.http.MediaType |
handleNoMatch(org.springframework.web.context.request.NativeWebRequest webRequest,
String extension)
Resolve file extension via
ServletContext.getMimeType(String)
and also delegate to base class for a potential JAF lookup. |
getMediaTypeKey, setIgnoreUnknownExtensions, setUseJaf
handleMatch, resolveMediaTypes
addMapping, getAllFileExtensions, getAllMediaTypes, lookupMediaType, resolveFileExtensions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllFileExtensions, resolveFileExtensions
public ServletPathExtensionContentNegotiationStrategy(javax.servlet.ServletContext servletContext, Map<String,org.springframework.http.MediaType> mediaTypes)
public ServletPathExtensionContentNegotiationStrategy(javax.servlet.ServletContext context)
ServletContext.getMimeType(String)
or via JAF.protected org.springframework.http.MediaType handleNoMatch(org.springframework.web.context.request.NativeWebRequest webRequest, String extension) throws org.springframework.web.HttpMediaTypeNotAcceptableException
ServletContext.getMimeType(String)
and also delegate to base class for a potential JAF lookup.handleNoMatch
in class PathExtensionContentNegotiationStrategy
org.springframework.web.HttpMediaTypeNotAcceptableException
public org.springframework.http.MediaType getMediaTypeForResource(org.springframework.core.io.Resource resource)
PathExtensionContentNegotiationStrategy.getMediaTypeForResource(org.springframework.core.io.Resource)
with the ability to also look up through the ServletContext.getMediaTypeForResource
in class PathExtensionContentNegotiationStrategy
resource
- the resource to look upnull
.Copyright © 2006–2018 TinyGroup. All rights reserved.