此内容没有您所选择的语言版本。
13.11. Configure File Extensions
Summary
Some clients, like browsers, cannot use the Accept and Accept-Language headers to negotiate the representation's media type or language. RESTEasy can map file name suffixes to media types and languages to deal with this issue. Follow these steps to map media types to file extensions, in the web.xml
file.
Procedure 13.4. Map Media Types to File Extensions
- Open the
web.xml
file for the application in a text editor. - Add the context-param
resteasy.media.type.mappings
to the file, inside theweb-app
tags:<context-param> <param-name>resteasy.media.type.mappings</param-name> </context-param>
<context-param> <param-name>resteasy.media.type.mappings</param-name> </context-param>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the parameter values. The mappings form a comma delimited list. Each mapping is delimited by a
:
:Example 13.13. Example Mapping
<context-param> <param-name>resteasy.media.type.mappings</param-name> <param-value>html : text/html, json : application/json, xml : application/xml</param-value> </context-param>
<context-param> <param-name>resteasy.media.type.mappings</param-name> <param-value>html : text/html, json : application/json, xml : application/xml</param-value> </context-param>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow