@Rest(allowedMethodParams="OPTIONS") @HtmlDocConfig(navlinks={"up: request:/..","options: servlet:/?method=OPTIONS"}) public abstract class BasicRestServlet extends RestServlet implements BasicRestConfig
RestServlet with default serializers and parsers defined.
Supports the following request
| Accept | Content-Type | Serializer |
|---|---|---|
| application/json text/json |
application/json | JsonSerializer |
| application/json+simple text/json+simple |
application/json | SimpleJsonSerializer |
| application/json+schema text/json+schema |
application/json | JsonSchemaSerializer |
| text/xml | text/xml | XmlDocSerializer |
| text/xml+schema | text/xml | XmlSchemaDocSerializer |
| text/html | text/html | HtmlDocSerializer |
| text/html+stripped | text/html | HtmlStrippedDocSerializer |
| text/uon | text/uon | UonSerializer |
| application/x-www-form-urlencoded | application/x-www-form-urlencoded | UrlEncodingSerializer |
| text/xml+soap | text/xml | SoapXmlSerializer |
| text/plain | text/plain | PlainTextSerializer |
Supports the following request
| Content-Type | Parser |
|---|---|
| application/json text/json |
JsonParser |
| text/xml application/xml |
XmlParser |
| text/html text/html+stripped |
HtmlParser |
| text/uon | UonParser |
| application/x-www-form-urlencoded | UrlEncodingParser |
| text/plain | PlainTextParser |
It should be noted that we do NOT add JsoParser to the list of parsers since this could cause security
issues.
Use caution when using this particular parser as it could inadvertently cause code execution security holes.
The list of serializers and parsers can be appended to using the
@Rest(serializers) and
@Rest(parsers) annotations on subclasses.
This subclass also provides a default OPTIONS page by implementing a getOptions(RestRequest) that returns a
POJO consisting of beans describing the class.
The OPTIONS page can be modified or augmented by overriding this method and providing your own data.
HtmlDocConfig(stylesheet)
to @Rest(staticFiles) to {"htdocs:htdocs" ,"styles:styles" }.
This allows files inside the | Constructor and Description |
|---|
BasicRestServlet() |
| Modifier and Type | Method and Description |
|---|---|
Swagger |
getOptions(RestRequest req)
[OPTIONS /*] - Show resource options.
|
destroy, getContext, getPath, getProperties, getRequest, getResponse, getServletConfig, init, log, log, log, log, logObjects, service, setContext, setRestResourceResolverdoDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, servicegetInitParameter, getInitParameterNames, getServletContext, getServletInfo, getServletName, initpublic BasicRestServlet()
public Swagger getOptions(RestRequest req)
getOptions in interface BasicRestConfigreq - The HTTP request.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.