Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dscott committed Jun 30, 2014
0 parents commit 3ffd7d6
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
guava-swagger.iml
target/
73 changes: 73 additions & 0 deletions pom.xml
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>
25 changes: 25 additions & 0 deletions src/main/java/App.java
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);
}
}
28 changes: 28 additions & 0 deletions src/main/java/Resource.java
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();
}
}

0 comments on commit 3ffd7d6

Please sign in to comment.