@Rest(title="Hello World", description="An example of the simplest-possible resource", path="/helloWorld") @HtmlDocConfig(aside={"<div style=\'max-width:400px\' class=\'text\'>","\t<p>This page shows a resource that simply response with a \'Hello world!\' message</p>","\t<p>The POJO serialized is a simple String.</p>","</div>"}) public class HelloWorldResource extends Object implements BasicRestConfig
Constructor and Description |
---|
HelloWorldResource() |
Modifier and Type | Method and Description |
---|---|
void |
error()
[* /error] - Error occurred.
|
void |
getBadRequest()
Make a request to /helloWorld/badRequest to trigger a 400 Bad Request.
|
Swagger |
getOptions(RestRequest req)
[OPTIONS /*] - Show resource options.
|
RestContextStats |
getStats(RestRequest req)
[GET /stats] - Timing statistics.
|
String |
sayHello()
GET request handler.
|
public HelloWorldResource()
@RestMethod(name="GET", path="/*", summary="Responds with \"Hello world!\"") public String sayHello()
@RestMethod public void getBadRequest() throws BadRequest
BadRequest
- A bad request.public Swagger getOptions(RestRequest req)
BasicRestConfig
getOptions
in interface BasicRestConfig
req
- The HTTP request.public void error()
BasicRestConfig
Servlet chains will often automatically redirect to
These responses should be left as-is without any additional processing.
error
in interface BasicRestConfig
public RestContextStats getStats(RestRequest req)
BasicRestConfig
Timing statistics for method invocations on this resource.
getStats
in interface BasicRestConfig
req
- The HTTP request.Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.