News for hackers. Stuff that matters.
Re:Java REST framework Dropwizard 1.0 released by spapas82 on Tuesday July 26, 2016 @04:25PM (#12168517)
Dropwizard is great for REST APIs (... as the title says). However if you want to use traditional views (MVC, html templates, security, forms etc) then please check something else (I tried it and lost many hours -- in the end I still couldn't do even basic things).

For traditional web development, I recommend spring-boot which is almost as easy as dropwizard, it also doesn't need an application container and fully supports Spring MVC, Spring Security and all other spring related goodies.

Re:Java REST framework Dropwizard 1.0 released by tokenizerrr on Tuesday July 26, 2016 @05:29PM (#12168867)
I agree completely. For a long time I was avoiding Spring because bloat and XML, but then I finally gave in and tried Spring Boot. It is most excellent. Nearly all bloat is opt-in, it does everything, and absolutely zero XML configuration needed. I've tried Dropwizard before, and use it for two applications I have running. It works, but it's not great (because it's not just a rest API, but also has GUI and user management). I'll be porting it to Spring eventually.
Re:Java REST framework Dropwizard 1.0 released by tootie on Tuesday July 26, 2016 @09:09PM (#12169868)
Dropwizard is basically a subset of Spring. Spring can do a REST API just as easily, but also does everything else. I've used both, Dropwizard is great but there's no use case I'd select it over Spring.
Re:Java REST framework Dropwizard 1.0 released by kubek2k on Wednesday July 27, 2016 @03:08AM (#12171062)
have you ever heard of YAGNI?
Re:Java REST framework Dropwizard 1.0 released by tootie on Wednesday July 27, 2016 @08:36AM (#12172226)
Yes and so has Spring. Every module is a separate dependency. If you don't need security or DB persistence, don't include them.
Re:Java REST framework Dropwizard 1.0 released by crypto5 on Tuesday July 26, 2016 @04:55PM (#12168671)
Dropwizard has templating engines integration and form validation.
Re:Java REST framework Dropwizard 1.0 released by spapas82 on Tuesday July 26, 2016 @05:04PM (#12168713)
I'm aware of that. However, have you tried using them in any non-trivial project? (for example, a project that supports authentication ?)
Re:Java REST framework Dropwizard 1.0 released by gresrun on Tuesday July 26, 2016 @05:50PM (#12168977)
I successfully deployed several internal apps using DropWizard (0.9.x) with two different authentication schemes last year. Wasn't too difficult.
Re:Java REST framework Dropwizard 1.0 released by StreamBright on Wednesday July 27, 2016 @05:06AM (#12171423)
We are actively using it for things like that. What is your actual problem, could you show some code?
Re:Java REST framework Dropwizard 1.0 released by spapas82 on Wednesday July 27, 2016 @07:21AM (#12171897)
There's some time since I stopped trying to work with dropwizard on non-REST projects so I've forgotten most of my problems. Some of those that I wasn't able to resolve are:

- Integrating with spring-security - Integrating spring-security-tags (sec:authorize etc) in the templates - Using a different template engine in general (wanted to use thymeleaf) - Not able to bind forms to objects - Enabling pagination

Please notice that all these are related to my specific needs (server side views) and, when trying dropwizard I had all these already solved with spring-mvc. Maybe if I kept pushing I'd be able to resolve most of these but, because of lack of documentation, and generaly because I understood that dropwizard should be used to create REST APIs, not server-side views I just switched to spring boot.

Re:Java REST framework Dropwizard 1.0 released by einrealist on Tuesday July 26, 2016 @06:41PM (#12169279)
We do our "MVC" stuff with Dropwizard. There are some minor quirks (like validation). But we find it suitable enough for how we build our applications. The upcoming javax.mvc standard will probably find its way into Jersey and Dropwizard. For the views, we use Freemarker (Thymeleaf was too slow and less extensible).
Re:Java REST framework Dropwizard 1.0 released by jsight on Tuesday July 26, 2016 @04:33PM (#12168545)
What templating language did you use with Spring MVC?
Re:Java REST framework Dropwizard 1.0 released by manyxcxi on Tuesday July 26, 2016 @05:02PM (#12168702)
I've been using Thymeleaf with Spring for a while and almost always exclusively use it with Spring Boot because it's pretty much right out of the box ready to go.

I stumbled on it a long time ago because I had the problem of Java devs needing to integrate templates built by front end devs and all the churn that goes along with it.

It uses custom tag attributes like th:href to swap the computed value in on template render so you can have a completely perfect looking HTML/CSS/JS template with the placeholder values without having to convert back and forth. It's just HTML with extra attributes that get ignored when not run through the rendering process.

You can use Spring Expressions, forms, and security with pretty much no configuration, it works awesome.

It supports partials and layouts and all the good stuff you'd want for reuse and it took me about 10 minutes to create a custom dialect for it that lets me use Thymeleaf and Vue.js together very nicely.

I can't recommend Thymeleaf enough.

Re:Java REST framework Dropwizard 1.0 released by kentosi on Tuesday July 26, 2016 @06:12PM (#12169106)
One issue is if you're using Angular. Your html document needs to be xhtml compatible, meaning that an expression like this:

  <div ng-if="this() && that()" ...
Needs to become:

  <div ng-if="this() &amp;&amp; that()" ...
If this doesn't bother you (along with &gt; for <, etc) then go ahead.
Re:Java REST framework Dropwizard 1.0 released by manyxcxi on Wednesday July 27, 2016 @02:11AM (#12170858)
It doesn't have to if you write your own dialect for Thymeleaf. You can alter the flow of the output manipulation and validation- it's out of the box that it chokes on the 'weird' stuff being shoved into attribute tags nowadays for JS templates.

If you want the unescaped output there are lots of things you can do. I did something similar for Vue.js in about twenty minutes and a few lines of code.

Re:Java REST framework Dropwizard 1.0 released by Deinumite on Tuesday July 26, 2016 @04:49PM (#12168637)
I've been looking at http://www.mitchellbosecke.com/pebble/home but I have not yet had a chance to use it.
Re:Java REST framework Dropwizard 1.0 released by spapas82 on Tuesday July 26, 2016 @04:55PM (#12168669)
Hmmm seems nice and has a djangonic syntax! However I'm not really sure how easy would be to integrate with spring boot (and spring security)...
Re:Java REST framework Dropwizard 1.0 released by Deinumite on Tuesday July 26, 2016 @05:06PM (#12168725)
I'm not sure about Spring Security but as for Spring Boot itself http://www.mitchellbosecke.com/pebble/documentation/guide/sp...
Re:Java REST framework Dropwizard 1.0 released by spapas82 on Tuesday July 26, 2016 @04:38PM (#12168571)
thymeleaf (http://www.thymeleaf.org/) - it is supported directly by spring boot (spring-boot-starter-thymeleaf dependecy). Also, using thymeleaf-extras-springsecurity4 you can integrate spring security tags with thymeleaf so that you can conditionally render things depending on the current user/authority into your templates!
Re:Java REST framework Dropwizard 1.0 released by tootie on Tuesday July 26, 2016 @09:11PM (#12169872)
Freemarker. Why doesn't every template language have macros?