diff --git a/examples/helpers/inbound/dropwizard-parse-example/README.md b/examples/helpers/inbound/dropwizard-parse-example/README.md new file mode 100644 index 00000000..dea9a801 --- /dev/null +++ b/examples/helpers/inbound/dropwizard-parse-example/README.md @@ -0,0 +1,13 @@ +# ParseExample + +How to start the ParseExample application +--- + +1. Run `mvn clean install` to build your application +1. Start application with `java -jar target/dropwizard-parse-example-1.0-SNAPSHOT.jar server config.yml` +1. To check that your application is running enter url `http://localhost:8080` + +Health Check +--- + +To see your applications health enter url `http://localhost:8081/healthcheck` diff --git a/examples/helpers/inbound/dropwizard-parse-example/config.yml b/examples/helpers/inbound/dropwizard-parse-example/config.yml new file mode 100644 index 00000000..4285a87e --- /dev/null +++ b/examples/helpers/inbound/dropwizard-parse-example/config.yml @@ -0,0 +1,4 @@ +logging: + level: INFO + loggers: + com.sendgrid: DEBUG diff --git a/examples/helpers/inbound/dropwizard-parse-example/dependency-reduced-pom.xml b/examples/helpers/inbound/dropwizard-parse-example/dependency-reduced-pom.xml new file mode 100644 index 00000000..08435570 --- /dev/null +++ b/examples/helpers/inbound/dropwizard-parse-example/dependency-reduced-pom.xml @@ -0,0 +1,124 @@ + + + 4.0.0 + com.sendgrid + dropwizard-parse-example + ParseExample + 1.0-SNAPSHOT + + 3.0.0 + + + + + maven-shade-plugin + 2.4.1 + + + package + + shade + + + + + true + + + + ${mainClass} + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + maven-jar-plugin + 2.6 + + + + true + ${mainClass} + + + + + + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + + + maven-source-plugin + 2.4 + + + attach-sources + + jar + + + + + + maven-javadoc-plugin + 2.10.3 + + + attach-javadocs + + jar + + + + + + + + + + maven-project-info-reports-plugin + 2.8.1 + + false + false + + + + maven-javadoc-plugin + 2.10.3 + + + + + + + io.dropwizard + dropwizard-bom + ${dropwizard.version} + pom + import + + + + + 1.0.3 + com.sendgrid.ParseExampleApplication + UTF-8 + UTF-8 + + + diff --git a/examples/helpers/inbound/dropwizard-parse-example/pom.xml b/examples/helpers/inbound/dropwizard-parse-example/pom.xml new file mode 100644 index 00000000..d28cba71 --- /dev/null +++ b/examples/helpers/inbound/dropwizard-parse-example/pom.xml @@ -0,0 +1,146 @@ + + + + 4.0.0 + + 3.0.0 + + + com.sendgrid + dropwizard-parse-example + 1.0-SNAPSHOT + jar + + ParseExample + + + UTF-8 + UTF-8 + 1.0.3 + com.sendgrid.ParseExampleApplication + + + + + + io.dropwizard + dropwizard-bom + ${dropwizard.version} + pom + import + + + + + + + io.dropwizard + dropwizard-core + + + io.dropwizard + dropwizard-forms + + + + + + + maven-shade-plugin + 2.4.1 + + true + + + + ${mainClass} + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + package + + shade + + + + + + maven-jar-plugin + 2.6 + + + + true + ${mainClass} + + + + + + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + + + maven-source-plugin + 2.4 + + + attach-sources + + jar + + + + + + maven-javadoc-plugin + 2.10.3 + + + attach-javadocs + + jar + + + + + + + + + + + maven-project-info-reports-plugin + 2.8.1 + + false + false + + + + maven-javadoc-plugin + 2.10.3 + + + + diff --git a/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/ParseExampleApplication.java b/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/ParseExampleApplication.java new file mode 100644 index 00000000..802ffaef --- /dev/null +++ b/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/ParseExampleApplication.java @@ -0,0 +1,32 @@ +package com.sendgrid; + +import com.sendgrid.resources.ParseResource; +import io.dropwizard.Application; +import io.dropwizard.forms.MultiPartBundle; +import io.dropwizard.setup.Bootstrap; +import io.dropwizard.setup.Environment; + +public class ParseExampleApplication extends Application { + + public static void main(final String[] args) throws Exception { + new ParseExampleApplication().run(args); + } + + @Override + public String getName() { + return "ParseExample"; + } + + @Override + public void initialize(final Bootstrap bootstrap) { + bootstrap.addBundle(new MultiPartBundle()); + } + + @Override + public void run(final ParseExampleConfiguration configuration, + final Environment environment) { + final ParseResource resource = new ParseResource(); + environment.jersey().register(resource); + } + +} diff --git a/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/ParseExampleConfiguration.java b/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/ParseExampleConfiguration.java new file mode 100644 index 00000000..4088c0c2 --- /dev/null +++ b/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/ParseExampleConfiguration.java @@ -0,0 +1,10 @@ +package com.sendgrid; + +import io.dropwizard.Configuration; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.hibernate.validator.constraints.*; +import javax.validation.constraints.*; + +public class ParseExampleConfiguration extends Configuration { + // TODO: implement service configuration +} diff --git a/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/api/Parse.java b/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/api/Parse.java new file mode 100644 index 00000000..e70c60aa --- /dev/null +++ b/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/api/Parse.java @@ -0,0 +1,17 @@ +package com.sendgrid.api; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Parse { + + @JsonProperty + private String envelope; + + public String getEnvelope() { + return envelope; + } + + public void setEnvelope(String envelope) { + this.envelope = envelope; + } +} diff --git a/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/resources/ParseResource.java b/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/resources/ParseResource.java new file mode 100644 index 00000000..69d81b08 --- /dev/null +++ b/examples/helpers/inbound/dropwizard-parse-example/src/main/java/com/sendgrid/resources/ParseResource.java @@ -0,0 +1,32 @@ +package com.sendgrid.resources; + +import com.sendgrid.api.Parse; +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.hibernate.validator.constraints.NotBlank; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.MediaType; + +@Path("/") +public class ParseResource { + + @GET + public String hello() { + return "hello"; + } + + @POST + @Path("/inbound") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public String inbound(@FormDataParam("data") Parse parse) { + System.out.println(parse.getEnvelope()); + return "OK"; + } +} + + diff --git a/examples/helpers/inbound/dropwizard-parse-example/src/main/resources/banner.txt b/examples/helpers/inbound/dropwizard-parse-example/src/main/resources/banner.txt new file mode 100644 index 00000000..e783f16d --- /dev/null +++ b/examples/helpers/inbound/dropwizard-parse-example/src/main/resources/banner.txt @@ -0,0 +1,6 @@ +================================================================================ + + ParseExample + +================================================================================ +