Skip to content

Commit fd8ed46

Browse files
committed
added sample files
1 parent 02c713c commit fd8ed46

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package io.swagger.model;
2+
3+
4+
5+
6+
import javax.xml.bind.annotation.XmlElement;
7+
import javax.xml.bind.annotation.XmlRootElement;
8+
import javax.xml.bind.annotation.XmlAccessType;
9+
import javax.xml.bind.annotation.XmlAccessorType;
10+
import javax.xml.bind.annotation.XmlType;
11+
12+
@XmlAccessorType(XmlAccessType.FIELD)
13+
@XmlType(name = "", propOrder =
14+
{ "code", "type", "message"
15+
})
16+
17+
@XmlRootElement(name="ApiResponse")
18+
public class ApiResponse {
19+
20+
21+
private Integer code = null;
22+
23+
private String type = null;
24+
25+
private String message = null;
26+
27+
28+
/**
29+
**/
30+
31+
public Integer getCode() {
32+
return code;
33+
}
34+
public void setCode(Integer code) {
35+
this.code = code;
36+
}
37+
38+
/**
39+
**/
40+
41+
public String getType() {
42+
return type;
43+
}
44+
public void setType(String type) {
45+
this.type = type;
46+
}
47+
48+
/**
49+
**/
50+
51+
public String getMessage() {
52+
return message;
53+
}
54+
public void setMessage(String message) {
55+
this.message = message;
56+
}
57+
58+
59+
@Override
60+
public String toString() {
61+
StringBuilder sb = new StringBuilder();
62+
sb.append("class ApiResponse {\n");
63+
64+
sb.append(" code: ").append(toIndentedString(code)).append("\n");
65+
sb.append(" type: ").append(toIndentedString(type)).append("\n");
66+
sb.append(" message: ").append(toIndentedString(message)).append("\n");
67+
sb.append("}");
68+
return sb.toString();
69+
}
70+
71+
/**
72+
* Convert the given object to string with each line indented by 4 spaces
73+
* (except the first line).
74+
*/
75+
private static String toIndentedString(Object o) {
76+
if (o == null) {
77+
return "null";
78+
}
79+
return o.toString().replace("\n", "\n ");
80+
}
81+
}
82+
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)