dropwizard

Getting NoViableAltException: unexpected token: WITH with JPA

百般思念 提交于 2019-12-10 22:57:45
问题 I am using solution given by @klin in my last question as below. with given_values (fingerprint, last_fetched) as ( values ('a', '2017-01-01'::date), ('b', '2017-02-01') ) select * from tracks t join given_values v on t.audio_fingerprint = v.fingerprint and t.modified_date > v.last_fetched; I am using JPA and Hibernate with Dropwizard. I am having Entity hierarchy like this. Track can have one or more Structure CueMarker Transition Genre Want to load Track and it's child entities data, for

Session management in Dropwizard 0.8.x

怎甘沉沦 提交于 2019-12-10 19:40:19
问题 Can someone give me insight of how do I implement session management in Dropwizard 0.8.x or above. I was using Dropwizard 0.7.0 till now and working perfectly in it. But I really confused by change docs provided when I migrated to 0.8.x. In Dropwizard 0.7.0 (which I was using previously) it was done like the following /*MainApplication.class session handler */ environment.jersey().register(HttpSessionProvider.class); environment.servlets().setSessionHandler(new SessionHandler()); /*Resource

Dropwizard: Is a .yml config mandatory?

非 Y 不嫁゛ 提交于 2019-12-10 17:07:31
问题 I've got a basic Dropwizard v1.2.0 application. I can execute it from my command line by running: java -jar application.jar server config.yml Is it possible for Dropwizard to work without passing it a config.yml file? I'm asking because, right now, my config.yml looks like this: mySetting: ${DW_MY_SETTING} defaultSetting: ${DW_DEFAULT_SETTING:-default value} I'm using the 'DW_MY_SETTING' and 'DW_DEFAULT_SETTING' environment variables to populate config.yml , and then the values in config.yml

Dropwizard + Jersey : “Not inside a request scope” when creating custom annotation

吃可爱长大的小学妹 提交于 2019-12-10 15:54:27
问题 I have a simple Dropwizard 0.8.1 REST service that pulls in Jersey 2.17. Upstream of the REST/Jetty service I have some authentication service that adds some nice authorization information to the HTTP Header that gets passed to my Dropwizard app. I would love to be able to create a custom annotation in my Resource that hides all the messy header-parsing-to-POJO garbage. Something like this: @Path("/v1/task") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public

With the shaded jar from dropwizard I got: Class path contains multiple SLF4J bindings

筅森魡賤 提交于 2019-12-10 15:06:18
问题 I probably made something stupid here. There is something (smallish) wrong with my dropwizard setup. Running the shaded jar works fine, but when executing integration tests I get this warning: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/graphhopper/web/target/graphhopper-web-0.11-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/user/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3

Run migrations programmatically in Dropwizard

家住魔仙堡 提交于 2019-12-10 13:12:59
问题 I have dropwizard-application (0.7.0) for which I want to run integration tests. I've set up an integration test using DropwizardAppRule, like this: @ClassRule public static final DropwizardAppRule<MyAppConfiguration> RULE = new DropwizardAppRule<MyAppConfiguration>( MyApplication.class, Resources.getResource("testconfiguration.yml").getPath()); When I try to run the below tests using it, it doesn't work because I haven't run my migrations. What is the best way to run the migrations? Test:

SFTP ChannelSftp.put stop it's execution process but successfully being uploaded or copy the source file

人盡茶涼 提交于 2019-12-10 12:25:02
问题 details: in my API i have struggle on debugging why is that the ChannelSftp.put method hangs up or stop it's execution process but when checking it's output it is successfully being uploaded. here's my code snippet: MyService.class @Inject MyConfiguration conf; public String copyAndMove( String fileName ){ try{ MyServer origin = conf.getOriginServer().setFileName( fileName ); MyServer destination = conf.getDestinationServer().setFileName( fileName ); SFTPServer originSftpServer = new

Registering Dropwizard configuration with Jersey 2 (HK2) DI

倾然丶 夕夏残阳落幕 提交于 2019-12-10 12:22:45
问题 In my Dropwizard (1.2.4) application I'm having trouble injecting my Dropwizard configuration into classes that are instantiated by HK2. What's the best way to achieve this? 回答1: Just bind the configuration instance . @Override public void run(final DummyConfiguration conf, Environment env) { env.jersey().register(new AbstractBinder() { @Override public void configure() { bind(conf).to(DummyConfiguration.class); } }) } Now you can @Inject the DummyConfiguration anywhere you need it. 来源: https

Exception Handling/Mapping for a particular class

不打扰是莪最后的温柔 提交于 2019-12-10 10:52:39
问题 I have resource class which itself's talks with a internal service. This resource acts a rest API for the service. The service layer can throw unexpected exceptions, thus the resource should handle those handled unexpected exceptions and log it. I am using dropwizard framework which in turns use jersey. It goes like this. @PATH(/user) @GET public Response getUser(@QueryParam("id") String userId) { assertNotNull(userId); try { User user = service.getUser(userId); return Response.ok(user).build

Dropwizard and Protocol Buffers by example

こ雲淡風輕ζ 提交于 2019-12-10 10:27:47
问题 Please note: Although this question specifically mentions Dropwizard, I believe anyone with Jersey/JAX-RS experience should be able to answer this question, as I would imagine Dropwizard is just following Jersey/JAX-RS conventions under the hood. I have a Dropwizard service that reds/writes in JSON and works beautifully. I would like to now switch it to read/write binary data (to minimize network bandidth). I see there is the Dropwizard-Protobuf lib but I have a few concerns about