dropwizard

Dropwizard configuration file security

柔情痞子 提交于 2019-12-01 06:43:36
问题 A configuration file (.yml) is being used for a rest api developed with Dropwizard (0.9.2 - latest release). Most of the credentials needed by the api such as database password secret key etc., are stored in the configuration file. We have implemented most of the things based on the items mentioned in the reference found at dropwizard configuration reference . The question is clear. How secure is it (storing these information in a configuration file as plain text.)? If not, what is the proper

Dropwizard in tomcat container

本秂侑毒 提交于 2019-12-01 06:30:36
问题 I have an existing app, that runs in tomcat. Now I am evaluating dropwizard for my new rest webservices. Now, dropwizard comes with inbuilt jetty. How do I deploy it with my tomcat container and not with its jetty container? 回答1: You can't do this. Dropwizard embeds Jetty. You should look into just using Jersey as a standard web application. 回答2: It makes a lot of sense to roll out your application as a jar, but sometimes you are bounded by company/enterprise standards and you're obliged to

How can I test HMAC authentication using Dropwizard?

≡放荡痞女 提交于 2019-12-01 05:59:58
I'm just getting started with Dropwizard 0.4.0, and I would like some help with HMAC authentication. Has anybody got any advice? Thank you in advance. At present Dropwizard doesn't support HMAC authentication right out of the box, so you'd have to write your own authenticator. A typical choice for HMAC authentication is to use the HTTP Authorization header. The following code expects this header in the following format: Authorization: <algorithm> <apiKey> <digest> An example would be Authorization: HmacSHA1 abcd-efgh-1234 sdafkljlkansdaflk2354jlkj5345345dflkmsdf The digest is built from the

Jersey/JAX-RS resource method input bean validation

送分小仙女□ 提交于 2019-12-01 05:18:54
I am using Jersey/JAX-RS via DropWizard 0.7.1 to expose RESTful service endpoints. I have all of my entity POJOs annotated with both JAX-RS and Hibernate/JSR-303 bean validation annotations like so: public class Widget { @JsonProperty("fizz") @NotNull @NotEmpty private String fizz; // Can't be empty or null @JsonProperty("buzz") @Min(value=5L) private Long buzz; // Can't be less than 5 // etc. } When a resource method receives one of these POJOs as input (under the hood, DropWizard has already deserialized the HTTP entity JSON into a Widget instance), I would like to validate it against the

Dropwizard - how to do a server side redirect from a view?

旧时模样 提交于 2019-12-01 04:18:59
I'm new to Drop Wizard , and would like to redirect from a server side view to another url in my app. Does DropWizard wrap up this common task somehow? e.g. @GET public View getView(@Context HttpServletRequest req) { View view = new View(); if (somethingBad) { // code here to redirect to another url, eg /bad_data } else { return view; } } Here's a simple code example that actually does the redirect using a WebApplicationException. So you could put this in your view, or in your resource, and just throw it whenever. URI uri2 = UriBuilder.fromUri(url).build(); Response response = Response

How can I test HMAC authentication using Dropwizard?

扶醉桌前 提交于 2019-12-01 04:16:56
问题 I'm just getting started with Dropwizard 0.4.0, and I would like some help with HMAC authentication. Has anybody got any advice? Thank you in advance. 回答1: At present Dropwizard doesn't support HMAC authentication right out of the box, so you'd have to write your own authenticator. A typical choice for HMAC authentication is to use the HTTP Authorization header. The following code expects this header in the following format: Authorization: <algorithm> <apiKey> <digest> An example would be

Jersey/JAX-RS resource method input bean validation

半世苍凉 提交于 2019-12-01 02:52:40
问题 I am using Jersey/JAX-RS via DropWizard 0.7.1 to expose RESTful service endpoints. I have all of my entity POJOs annotated with both JAX-RS and Hibernate/JSR-303 bean validation annotations like so: public class Widget { @JsonProperty("fizz") @NotNull @NotEmpty private String fizz; // Can't be empty or null @JsonProperty("buzz") @Min(value=5L) private Long buzz; // Can't be less than 5 // etc. } When a resource method receives one of these POJOs as input (under the hood, DropWizard has

Implementing long polling server using Dropwizard 0.7.0

守給你的承諾、 提交于 2019-12-01 01:54:40
I'm trying to implement a long polling server using Dropwizard 0.7.0 framework. I've been suggested to use jetty integration. After some googling, I got really confused by things like websockets, jetty continuation, cometd. My question is, what are these things and which one should I choose? And any example is really appreciated! Edited Our server has many clients, including mobile (ios, android), pc and web. Is websocket only available in web browser? Websocket is available in all the clients you have listed. Usually frameworks like Atmoshphere handles downgrading to other types of transports

How do I use a custom validator with dropwizard?

混江龙づ霸主 提交于 2019-12-01 01:30:41
I have a REST api written by someone else in which the method that handles the request to a particular url accepts a bunch of parameters that are populated from path parameters. @POST @Path("/{classid}/{studentid}/details") @Consumes(MediaType.MULTIPART_FORM_DATA) @SuppressWarnings("unchecked") public Response processFile(@FormDataParam("sourceFile") InputStream aStream, @PathParam("classid") String classId, @PathParam("studentid") String studentId, @Context HttpServletRequest httpRequest) { // Code to do stuff and return a response } The person who wrote this has used DropWizard and I have no

Dropwizard - how to do a server side redirect from a view?

跟風遠走 提交于 2019-12-01 01:12:29
问题 I'm new to Drop Wizard, and would like to redirect from a server side view to another url in my app. Does DropWizard wrap up this common task somehow? e.g. @GET public View getView(@Context HttpServletRequest req) { View view = new View(); if (somethingBad) { // code here to redirect to another url, eg /bad_data } else { return view; } } 回答1: Here's a simple code example that actually does the redirect using a WebApplicationException. So you could put this in your view, or in your resource,