-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRestApplication.mustache
More file actions
55 lines (43 loc) · 1.39 KB
/
RestApplication.mustache
File metadata and controls
55 lines (43 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package {{invokerPackage}};
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import java.util.Set;
import java.util.HashSet;
{{#useSwaggerFeature}}
import io.swagger.jaxrs.config.BeanConfig;
{{/useSwaggerFeature}}
{{#apiInfo}}
{{#apis}}
import {{package}}.impl.{{classname}}ServiceImpl;
{{/apis}}
{{/apiInfo}}
@ApplicationPath("{{{contextPath}}}")
public class RestApplication extends Application {
{{#useSwaggerFeature}}
public RestApplication() {
super();
// Customize the dynamic contract
BeanConfig beanConfig = new BeanConfig();
beanConfig.setTitle("{{appName}}");
beanConfig.setVersion("{{version}}");
beanConfig.setSchemes(new String[] { "{{scheme}}" });
beanConfig.setHost("{{host}}");
beanConfig.setBasePath("{{basePathWithoutHost}}");
beanConfig.setResourcePackage("{{invokerPackage}}");
beanConfig.setScan(true);
}
{{/useSwaggerFeature}}
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new HashSet<Class<?>>();
{{#apiInfo}}
{{#apis}}
resources.add({{classname}}ServiceImpl.class);
{{/apis}}
{{/apiInfo}}
{{#useSwaggerFeature}}
resources.add(io.swagger.jaxrs.listing.ApiListingResource.class);
resources.add(io.swagger.jaxrs.listing.SwaggerSerializers.class);
{{/useSwaggerFeature}}
return resources;
}
}