Skip to content

Commit 3b9c28f

Browse files
committed
added bootstrap sample
1 parent cc4b3ff commit 3b9c28f

File tree

1 file changed

+31
-0
lines changed
  • samples/server/petstore/jersey2/src/main/java/io/swagger/api

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package io.swagger.api;
2+
3+
import io.swagger.jaxrs.config.SwaggerContextService;
4+
import io.swagger.models.*;
5+
6+
import io.swagger.models.auth.*;
7+
8+
import javax.servlet.http.HttpServlet;
9+
import javax.servlet.ServletContext;
10+
import javax.servlet.ServletConfig;
11+
import javax.servlet.ServletException;
12+
13+
public class Bootstrap extends HttpServlet {
14+
@Override
15+
public void init(ServletConfig config) throws ServletException {
16+
Info info = new Info()
17+
.title("Swagger Server")
18+
.description("This is a sample server Petstore server. You can find out more about\nSwagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n")
19+
.termsOfService("http://swagger.io/terms/")
20+
.contact(new Contact()
21+
.email("[email protected]"))
22+
.license(new License()
23+
.name("Apache 2.0")
24+
.url("http://www.apache.org/licenses/LICENSE-2.0.html"));
25+
26+
ServletContext context = config.getServletContext();
27+
Swagger swagger = new Swagger().info(info);
28+
29+
new SwaggerContextService().withServletConfig(config).updateSwagger(swagger);
30+
}
31+
}

0 commit comments

Comments
 (0)