spring-framework / org.springframework.web.accept / ServletPathExtensionContentNegotiationStrategy

ServletPathExtensionContentNegotiationStrategy

open class ServletPathExtensionContentNegotiationStrategy : PathExtensionContentNegotiationStrategy

Extends PathExtensionContentNegotiationStrategy that also uses ServletContext#getMimeType(String) to resolve file extensions.

Author
Rossen Stoyanchev

Since
3.2

Constructors

<init>

ServletPathExtensionContentNegotiationStrategy(context: ServletContext)

Create an instance without any mappings to start with. Mappings may be added later when extensions are resolved through ServletContext#getMimeType(String) or via org.springframework.http.MediaTypeFactory.

ServletPathExtensionContentNegotiationStrategy(servletContext: ServletContext, mediaTypes: MutableMap<String, MediaType>)

Create an instance with the given extension-to-MediaType lookup.

Functions

getMediaTypeForResource

open fun getMediaTypeForResource(resource: Resource): MediaType

Extends the base class PathExtensionContentNegotiationStrategy#getMediaTypeForResource with the ability to also look up through the ServletContext.

Inherited Functions

setUrlPathHelper

open fun setUrlPathHelper(urlPathHelper: UrlPathHelper): Unit

Configure a UrlPathHelper to use in #getMediaTypeKey in order to derive the lookup path for a target request URL path.

setUseJaf

open fun setUseJaf(useJaf: Boolean): Unit