-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dscott
committed
Jun 30, 2014
0 parents
commit 3ffd7d6
Showing
4 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea/ | ||
guava-swagger.iml | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>guava-swagger</groupId> | ||
<artifactId>guava-swagger</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<dropwizard.version>0.7.1</dropwizard.version> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>1.6</version> | ||
<configuration> | ||
<createDependencyReducedPom>true</createDependencyReducedPom> | ||
<filters> | ||
<filter> | ||
<artifact>*:*</artifact> | ||
<excludes> | ||
<exclude>META-INF/*.SF</exclude> | ||
<exclude>META-INF/*.DSA</exclude> | ||
<exclude>META-INF/*.RSA</exclude> | ||
</excludes> | ||
</filter> | ||
</filters> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<transformers> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||
<mainClass>App</mainClass> | ||
</transformer> | ||
</transformers> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.dropwizard</groupId> | ||
<artifactId>dropwizard-core</artifactId> | ||
<version>${dropwizard.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.federecio</groupId> | ||
<artifactId>dropwizard-swagger</artifactId> | ||
<version>0.4</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<repositories> | ||
<repository> | ||
<id>federecio-releases</id> | ||
<url>https://repository-federecio1.forge.cloudbees.com/release/</url> | ||
</repository> | ||
</repositories> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import com.federecio.dropwizard.swagger.SwaggerDropwizard; | ||
import io.dropwizard.Application; | ||
import io.dropwizard.Configuration; | ||
import io.dropwizard.setup.Bootstrap; | ||
import io.dropwizard.setup.Environment; | ||
|
||
public class App extends Application<Configuration> | ||
{ | ||
private final SwaggerDropwizard swaggerDropwizard = new SwaggerDropwizard(); | ||
|
||
@Override | ||
public void initialize(Bootstrap<Configuration> bootstrap) { | ||
swaggerDropwizard.onInitialize(bootstrap); | ||
} | ||
|
||
@Override | ||
public void run(Configuration configuration, Environment environment) throws Exception { | ||
environment.jersey().register(new Resource()); | ||
swaggerDropwizard.onRun(configuration, environment); | ||
} | ||
|
||
public static void main(String[] args) throws Exception { | ||
new App().run(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import com.codahale.metrics.annotation.Timed; | ||
import com.google.common.base.Optional; | ||
import com.wordnik.swagger.annotations.Api; | ||
import com.wordnik.swagger.annotations.ApiImplicitParam; | ||
import com.wordnik.swagger.annotations.ApiImplicitParams; | ||
import com.wordnik.swagger.annotations.ApiOperation; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.QueryParam; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
|
||
@Api(value = "/resource", description = "About the nessie application") @Path("/resource") @Produces(MediaType.APPLICATION_JSON) | ||
public class Resource | ||
{ | ||
@ApiOperation( | ||
value = "About nessie", | ||
notes = "About nessie", | ||
response = Response.class) @GET @Timed | ||
@ApiImplicitParams(value = {@ApiImplicitParam(name = "qparam", value = "Query Parameter", dataType = "string", required = true, paramType = "query")}) | ||
|
||
public Response getAbout(@QueryParam("qparam") Optional<String> qparam) | ||
{ | ||
return Response.ok().entity(qparam).build(); | ||
} | ||
} |