Skip to content

Commit 6843f97

Browse files
committed
updated sample for resteasy eap java8
1 parent ec599d4 commit 6843f97

File tree

19 files changed

+396
-994
lines changed

19 files changed

+396
-994
lines changed

samples/server/petstore/jaxrs-resteasy/eap-java8/build.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ dependencies {
1515
providedCompile 'javax.annotation:javax.annotation-api:1.2'
1616
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
1717
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
18-
1918
providedCompile 'javax.validation:validation-api:1.1.0.Final'
20-
21-
22-
2319
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.6.3'
24-
2520
testCompile 'junit:junit:4.12',
2621
'org.hamcrest:hamcrest-core:1.3'
2722
}

samples/server/petstore/jaxrs-resteasy/eap-java8/pom.xml

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</plugin>
2626
<plugin>
2727
<artifactId>maven-failsafe-plugin</artifactId>
28-
<version>2.6</version>
28+
<version>2.18.1</version>
2929
<executions>
3030
<execution>
3131
<goals>
@@ -35,6 +35,40 @@
3535
</execution>
3636
</executions>
3737
</plugin>
38+
<plugin>
39+
<groupId>org.eclipse.jetty</groupId>
40+
<artifactId>jetty-maven-plugin</artifactId>
41+
<version>${jetty-version}</version>
42+
<configuration>
43+
<webApp>
44+
<contextPath>/</contextPath>
45+
</webApp>
46+
<scanIntervalSeconds>10</scanIntervalSeconds>
47+
<stopKey>alpha</stopKey>
48+
<stopPort>9099</stopPort>
49+
<stopWait>2</stopWait>
50+
</configuration>
51+
<executions>
52+
<execution>
53+
<id>start-jetty</id>
54+
<phase>pre-integration-test</phase>
55+
<goals>
56+
<goal>start</goal>
57+
</goals>
58+
<configuration>
59+
<scanIntervalSeconds>0</scanIntervalSeconds>
60+
<daemon>true</daemon>
61+
</configuration>
62+
</execution>
63+
<execution>
64+
<id>stop-jetty</id>
65+
<phase>post-integration-test</phase>
66+
<goals>
67+
<goal>stop</goal>
68+
</goals>
69+
</execution>
70+
</executions>
71+
</plugin>
3872
<plugin>
3973
<groupId>org.codehaus.mojo</groupId>
4074
<artifactId>build-helper-maven-plugin</artifactId>
@@ -67,49 +101,46 @@
67101
<groupId>javax.servlet</groupId>
68102
<artifactId>servlet-api</artifactId>
69103
<version>${servlet-api-version}</version>
70-
<scope>provided</scope>
71104
</dependency>
72105

73106
<dependency>
74107
<groupId>org.jboss.resteasy</groupId>
75108
<artifactId>resteasy-jaxrs</artifactId>
76109
<version>${resteasy-version}</version>
77-
<scope>provided</scope>
110+
</dependency>
111+
<dependency>
112+
<groupId>org.jboss.resteasy</groupId>
113+
<artifactId>resteasy-servlet-initializer</artifactId>
114+
<version>${resteasy-version}</version>
78115
</dependency>
79116
<dependency>
80117
<groupId>org.jboss.resteasy</groupId>
81118
<artifactId>jaxrs-api</artifactId>
82119
<version>${resteasy-version}</version>
83-
<scope>provided</scope>
84120
</dependency>
85121
<dependency>
86122
<groupId>org.jboss.resteasy</groupId>
87123
<artifactId>resteasy-validator-provider-11</artifactId>
88124
<version>${resteasy-version}</version>
89-
<scope>provided</scope>
90125
</dependency>
91126
<dependency>
92127
<groupId>org.jboss.resteasy</groupId>
93128
<artifactId>resteasy-multipart-provider</artifactId>
94129
<version>${resteasy-version}</version>
95-
<scope>provided</scope>
96130
</dependency>
97131
<dependency>
98132
<groupId>org.jboss.resteasy</groupId>
99133
<artifactId>resteasy-jackson2-provider</artifactId>
100134
<version>${resteasy-version}</version>
101-
<scope>provided</scope>
102135
</dependency>
103136
<dependency>
104137
<groupId>javax.annotation</groupId>
105138
<artifactId>javax.annotation-api</artifactId>
106139
<version>1.2</version>
107-
<scope>provided</scope>
108140
</dependency>
109-
110141
<dependency>
111-
<groupId>io.swagger</groupId>
112-
<artifactId>swagger-jaxrs</artifactId>
142+
<groupId>io.swagger.core.v3</groupId>
143+
<artifactId>swagger-jaxrs2</artifactId>
113144
<version>${swagger-core-version}</version>
114145
</dependency>
115146
<dependency>
@@ -138,23 +169,38 @@
138169
</exclusion>
139170
</exclusions>
140171
</dependency>
141-
142172
<!-- Bean Validation API support -->
143173
<dependency>
144174
<groupId>javax.validation</groupId>
145175
<artifactId>validation-api</artifactId>
146176
<version>1.1.0.Final</version>
147-
<scope>provided</scope>
148177
</dependency>
149-
150-
151-
152178
<dependency>
153179
<groupId>com.fasterxml.jackson.datatype</groupId>
154180
<artifactId>jackson-datatype-jsr310</artifactId>
155181
<version>2.6.3</version>
156182
</dependency>
157-
183+
<dependency>
184+
<groupId>com.fasterxml.jackson.core</groupId>
185+
<artifactId>jackson-databind</artifactId>
186+
<version>2.6.3</version>
187+
</dependency>
188+
<dependency>
189+
<groupId>com.fasterxml.jackson.core</groupId>
190+
<artifactId>jackson-core</artifactId>
191+
<version>2.6.3</version>
192+
</dependency>
193+
<dependency>
194+
<groupId>com.fasterxml.jackson.core</groupId>
195+
<artifactId>jackson-annotations</artifactId>
196+
<version>2.6.3</version>
197+
</dependency>
198+
<dependency>
199+
<groupId>org.apache.httpcomponents</groupId>
200+
<artifactId>httpclient</artifactId>
201+
<version>4.5.2</version>
202+
<scope>test</scope>
203+
</dependency>
158204

159205
</dependencies>
160206
<repositories>
@@ -167,7 +213,7 @@
167213
</repository>
168214
</repositories>
169215
<properties>
170-
<swagger-core-version>1.5.18</swagger-core-version>
216+
<swagger-core-version>2.0.0</swagger-core-version>
171217
<jetty-version>9.2.9.v20150224</jetty-version>
172218
<resteasy-version>3.0.11.Final</resteasy-version>
173219
<slf4j-version>1.6.3</slf4j-version>

samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/io/swagger/api/PetApi.java

Lines changed: 57 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33
import io.swagger.model.*;
44

5-
import io.swagger.annotations.ApiParam;
6-
import io.swagger.jaxrs.*;
7-
5+
import io.swagger.v3.oas.annotations.Operation;
6+
import io.swagger.v3.oas.annotations.Parameter;
7+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
8+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
9+
import io.swagger.v3.oas.annotations.media.ArraySchema;
10+
import io.swagger.v3.oas.annotations.media.Content;
11+
import io.swagger.v3.oas.annotations.media.Schema;
12+
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
13+
14+
import java.io.File;
815
import io.swagger.model.ModelApiResponse;
916
import io.swagger.model.Pet;
1017

11-
1218
import java.util.List;
1319
import java.util.Map;
1420

@@ -18,102 +24,87 @@
1824
import javax.ws.rs.core.Response;
1925
import javax.ws.rs.core.SecurityContext;
2026
import javax.ws.rs.*;
21-
2227
import javax.validation.constraints.*;
23-
24-
28+
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
2529
@Path("/pet")
2630

2731

28-
@io.swagger.annotations.Api(description = "the pet API")
29-
30-
3132
public interface PetApi {
3233

33-
3434
@POST
35-
3635
@Consumes({ "application/json", "application/xml" })
37-
38-
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, tags={ "pet", })
39-
@io.swagger.annotations.ApiResponses(value = {
40-
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
41-
public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext);
36+
@Operation(summary = "Add a new pet to the store", description = "", tags={ "pet" })
37+
@ApiResponses(value = {
38+
@ApiResponse(responseCode = "405", description = "Invalid input")
39+
})
40+
Response addPet(@Parameter(description = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext);
4241

4342
@DELETE
4443
@Path("/{petId}")
45-
46-
47-
@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, tags={ "pet", })
48-
@io.swagger.annotations.ApiResponses(value = {
49-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
50-
public Response deletePet( @PathParam("petId") Integer petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext);
44+
@Operation(summary = "Deletes a pet", description = "", tags={ "pet" })
45+
@ApiResponses(value = {
46+
@ApiResponse(responseCode = "400", description = "Invalid pet value")
47+
})
48+
Response deletePet( @PathParam("petId") Integer petId,@Parameter(description = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext);
5149

5250
@GET
5351
@Path("/findByStatus")
54-
5552
@Produces({ "application/xml", "application/json" })
56-
@io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", tags={ "pet", })
57-
@io.swagger.annotations.ApiResponses(value = {
58-
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
59-
60-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) })
61-
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext);
53+
@Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings", tags={ "pet" })
54+
@ApiResponses(value = {
55+
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))),
56+
@ApiResponse(responseCode = "400", description = "Invalid status value")
57+
})
58+
Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext);
6259

6360
@GET
6461
@Path("/findByTags")
65-
6662
@Produces({ "application/xml", "application/json" })
67-
@io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", tags={ "pet", })
68-
@io.swagger.annotations.ApiResponses(value = {
69-
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
70-
71-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) })
72-
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext);
63+
@Operation(summary = "Finds Pets by tags", description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", tags={ "pet" })
64+
@ApiResponses(value = {
65+
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))),
66+
@ApiResponse(responseCode = "400", description = "Invalid tag value")
67+
})
68+
Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext);
7369

7470
@GET
7571
@Path("/{petId}")
76-
7772
@Produces({ "application/xml", "application/json" })
78-
@io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, tags={ "pet", })
79-
@io.swagger.annotations.ApiResponses(value = {
80-
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class),
81-
82-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
83-
84-
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) })
85-
public Response getPetById( @PathParam("petId") Integer petId,@Context SecurityContext securityContext);
73+
@Operation(summary = "Find pet by ID", description = "Returns a single pet", tags={ "pet" })
74+
@ApiResponses(value = {
75+
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Pet.class))),
76+
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
77+
@ApiResponse(responseCode = "404", description = "Pet not found")
78+
})
79+
Response getPetById( @PathParam("petId") Integer petId,@Context SecurityContext securityContext);
8680

8781
@PUT
88-
8982
@Consumes({ "application/json", "application/xml" })
90-
91-
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, tags={ "pet", })
92-
@io.swagger.annotations.ApiResponses(value = {
93-
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
94-
95-
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class),
96-
97-
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) })
98-
public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet,@Context SecurityContext securityContext);
83+
@Operation(summary = "Update an existing pet", description = "", tags={ "pet" })
84+
@ApiResponses(value = {
85+
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
86+
@ApiResponse(responseCode = "404", description = "Pet not found"),
87+
@ApiResponse(responseCode = "405", description = "Validation exception")
88+
})
89+
Response updatePet(@Parameter(description = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext);
9990

10091
@POST
10192
@Path("/{petId}")
10293
@Consumes({ "application/x-www-form-urlencoded" })
103-
104-
@io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, tags={ "pet", })
105-
@io.swagger.annotations.ApiResponses(value = {
106-
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
107-
public Response updatePetWithForm( @PathParam("petId") Integer petId,@ApiParam(value = "" ) Object body,@Context SecurityContext securityContext);
94+
@Operation(summary = "Updates a pet in the store with form data", description = "", tags={ "pet" })
95+
@ApiResponses(value = {
96+
@ApiResponse(responseCode = "405", description = "Invalid input")
97+
})
98+
Response updatePetWithForm( @PathParam("petId") Integer petId,@Parameter(description = "")@FormParam("name") String name,@Parameter(description = "")@FormParam("status") String status,@Context SecurityContext securityContext);
10899

109100
@POST
110101
@Path("/{petId}/uploadImage")
111102
@Consumes({ "multipart/form-data" })
112103
@Produces({ "application/json" })
113-
@io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, tags={ "pet", })
114-
@io.swagger.annotations.ApiResponses(value = {
115-
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
116-
public Response uploadFile( @PathParam("petId") Integer petId,@ApiParam(value = "" ) Object body,@Context SecurityContext securityContext);
104+
@Operation(summary = "uploads an image", description = "", tags={ "pet" })
105+
@ApiResponses(value = {
106+
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = ModelApiResponse.class)))
107+
})
108+
Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Integer petId,@Context SecurityContext securityContext);
117109

118110
}
119-

0 commit comments

Comments
 (0)