tag:blogger.com,1999:blog-637417304187784899.post826622922212868141..comments2024-01-04T09:04:42.121+00:00Comments on James Strachan's Blog: JAX-RS as the one Java web framework to rule them all?James Strachanhttp://www.blogger.com/profile/12591119339035350067noreply@blogger.comBlogger36125tag:blogger.com,1999:blog-637417304187784899.post-62836313850870608802010-01-13T09:14:59.293+00:002010-01-13T09:14:59.293+00:00Agreed. The missing piece seems to be easily integ...Agreed. The missing piece seems to be easily integrating JAX-RS on the server side with a GWT client side (which should work on any RESTful endpoint).<br /><br />A friend and colleague of mine has created this which looks interesting...<br /><br />http://hiramchirino.com/blog/2009/10/restygwt-a-better-gwt-rpc/James Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-90247920056315185582010-01-12T22:24:18.027+00:002010-01-12T22:24:18.027+00:00I've heard of a JAX-RS combination with GWT. B...I've heard of a JAX-RS combination with GWT. But I cannot say anything about it. I think there are many developers who would like to have a JAX-RS web gui framework.<br /><br />See:<br /><a href="http://stackoverflow.com/questions/2051851/state-of-the-art-java-web-framework-for-restful-gui-apps" rel="nofollow">State of the art Java web framework for RESTful GUI apps?</a>Unknownhttps://www.blogger.com/profile/07328168099002893532noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-1884646296560373762010-01-04T15:45:46.769+00:002010-01-04T15:45:46.769+00:00Hi James,
I’m using Stripes for some time now and...Hi James,<br /><br />I’m using Stripes for some time now and I’d like to switch to a JAX-RS implementation (I may go with RESTeasy of Jboss). And I asked myself the same question as you: what’s left for a Web framework after that? Since it’s almost a year now you posted this article, did you get more experience with that? In my opinion, I’d miss the Stripes’ layouts and the validation part (that we linked directly to the jquery validation plugin).Alexandru Craciunhttps://www.blogger.com/profile/04264442566863208888noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-44611386262819740972009-02-09T14:31:00.000+00:002009-02-09T14:31:00.000+00:00I meant entity provider not resolver :) But you ge...I meant entity provider not resolver :) But you get what I mean. <BR/><BR/>Or to say what I just said in another way - it should be easy to reuse all the good stuff from Struts2 from within JAX-RSJames Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-56821931728716311212009-02-09T14:30:00.000+00:002009-02-09T14:30:00.000+00:00Pete: its easy to register an entity resolver capa...Pete: its easy to register an entity resolver capable of handing the conversion of the POST payload of whatever mime type you wish (e.g. form encoding) to whatever bean types you want.<BR/><BR/>So we could easily reuse the same Struts2 multi-level-parameter binding classes inside JAX-RS.<BR/><BR/>JAX-RS is very pluggable - its easy to plugin any adapter from any MIME types to any of your application objects using whatever technologies you wish - JAXB / XStream / Jettison or some custom bindings of your choosing.James Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-12999510544302897152009-02-09T11:03:00.000+00:002009-02-09T11:03:00.000+00:00Hi James,How would we handle multi-level form para...Hi James,<BR/><BR/>How would we handle multi-level form parameters? I've been working with Struts 2 recently, in which you can give the action class properties of a complx type such as Employee. When you create a form that holds details of an employee, you name the fields things like "employee.name", or "employee.gender", and these values are mapped by the framework onto the properties of an Employee object.<BR/><BR/>I don't see any equivalent to this in the JAS-RX spec, but maybe I'm missing something?<BR/><BR/>Cheers,<BR/><BR/>PetePetehttps://www.blogger.com/profile/09232300859667948012noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-86217406753292928102009-02-04T08:27:00.000+00:002009-02-04T08:27:00.000+00:00Thanks Yellek - yes I'm aware of Grails. BTW did y...Thanks Yellek - yes I'm aware of Grails. BTW did you know I created the Groovy programming language that is behind Grails?<BR/><BR/>One of the interesting things is JAX-RS works great with Grails and Scala due to their support of annotations and static typing. See the groovy + scala examples in the Jersey distro. <BR/><BR/>So I'd like to see JAX-RS be the basis of the MVC layer in Grails too.James Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-7428402260331373682009-02-04T06:07:00.000+00:002009-02-04T06:07:00.000+00:00If you like Rails but want a Java alternative have...If you like Rails but want a Java alternative have you had a look at Grails? Grails manages to give you a Rails like experience whilst doing all the heavy lifting to integrate Hibernate, Spring and Sitemesh under the covers. AJAX and JSON rendering are easy too.<BR/><BR/>Any Java programmer should be able to pick up Groovy relatively easily as all of the class libraries are the same and you can use essentially Java syntax until you learn the Groovy shortcuts.Peter Kelleyhttps://www.blogger.com/profile/13120789747223900381noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-57827192134100160662009-01-29T09:19:00.000+00:002009-01-29T09:19:00.000+00:00Sorry Peter, but there is stuff missing. Search is...<I>Sorry Peter, but there is stuff missing. Search is missing.</I><BR/><BR/>Nope. <A HREF="http://code.google.com/p/perfbench/source/browse/trunk/perfbench/wicket-jpa/src/main/java/wicketjpa/wicket/MainPage.java" REL="nofollow">See line 37.</A><BR/><BR/><I>the whole Seam Conversation part is also missing.</I><BR/><BR/>Nope. <A HREF="http://code.google.com/p/perfbench/source/browse/trunk/perfbench/wicket-jpa/src/main/java/wicketjpa/wicket/ConfirmPage.java" REL="nofollow">See line 34.</A> Ah, I get it, after your love affair with annotations, ejb3, seam and jsr299 you were probably expecting an annotation - gotcha ;) <BR/><BR/>Also try doing bookings in multiple browser tabs, it works.Peter Thomashttps://www.blogger.com/profile/12601547950877794218noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-62657236896528105352009-01-29T08:21:00.000+00:002009-01-29T08:21:00.000+00:00Sorry Peter, but there is stuff missing. Search is...Sorry Peter, but there is stuff missing. Search is missing. Maybe I'm missing it cause it is part of Wicket, but the whole Seam Conversation part is also missing.<BR/><BR/>Also, I have to admit, now that I've explored Wicket further, the whole one class to one html file and then describing the core contents of the html file in the class model just doesn't make sense to me. That model has been done before and it doesn't work long term. I built Jakarta ECS ages ago and that was totally the wrong model.<BR/><BR/>Please, I don't mean this to be flame bait or a Wicket vs. Seam war. I'm just expressing my personal style of preference after having worked with so many different web frameworks in so many different languages for the last 15 years.ahttps://www.blogger.com/profile/11867559494404858630noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-39967116448954851702009-01-29T05:33:00.000+00:002009-01-29T05:33:00.000+00:00Jon (4 comments above) said:One thing you don't ad...Jon (4 comments above) said:<BR/><BR/><I>One thing you don't address in your posting is whether or not your application is 100% functionally complete to the Seam version.</I><BR/><BR/>@Jon: I thought I made it pretty clear that it *is*. Anyway, you can check out the source, run the demos and see for yourself.Peter Thomashttps://www.blogger.com/profile/12601547950877794218noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-11884865354161536972009-01-29T00:06:00.000+00:002009-01-29T00:06:00.000+00:001) sounds like either WebDAV or JCR (either delega...1) sounds like either WebDAV or JCR (either delegate from JAX-RS or use WebDAV/JCR directly<BR/><BR/>2) sure - its up to you how you map URI paths to classes/methods. If you want to use 1 class per path (or path segment) thats fine. <BR/><BR/>Am hoping eventually Java IDEs will be JAX-RS aware so it'll be easy to navigate from a URI to a resource bean or at least see the URI -> bean mappings.<BR/><BR/>3) this sounds like a cross cutting concern. JAX-RS focusses on implementing individual RESTful services (rather like controllers in Rails etc)<BR/><BR/>If you have cross cutting concerns you can implement them as Servlet Filters, Jersey filters or via AOP on the resource beans (depending on exactly what your concern is and at what level you want to operate).James Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-83092896793349381312009-01-28T23:41:00.000+00:002009-01-28T23:41:00.000+00:00A few practical questions:What if you webapp has a...A few practical questions:<BR/>What if you webapp has a bunch of files that are uploaded and need to be available as static entities (yet protected by some authentication mechanism eventually).<BR/><BR/>and<BR/><BR/>Doesn't url mapping have a natural grokking limit? One of the best things about Php is that 1 file = 1 controller. Once you find the path (assuming no crazy rewriting) you know what is being executed easily,<BR/><BR/>and finally,<BR/><BR/>Aren't some things are easily done extracted from class definitions. Say I want to send an HTTP caching configuration over all images served from this url stub, but all other from a different url stub should have this http header etc etc etc... Something like urlrewritefilter does that great, but JAX-RS seems to say "nah, forget configuration files, just do it class by class!"Ivanhttps://www.blogger.com/profile/00530381404081691368noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-6004327424111208122009-01-28T19:15:00.000+00:002009-01-28T19:15:00.000+00:00Peter - I confess to really liking GWT as a soluti...Peter - I confess to really liking GWT as a solution for complex rich web applications to avoid too much JavaScript and to promote reuse of code across Java client and server; all the complex UI resides on the client and relatively simple RESTful services on the server.James Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-92231049069420716902009-01-28T17:57:00.000+00:002009-01-28T17:57:00.000+00:00@Peter: Thank you so much for doing the analysis. ...@Peter: Thank you so much for doing the analysis. One thing you don't address in your posting is whether or not your application is 100% functionally complete to the Seam version.<BR/><BR/>While memory and cpu usage is important, it is honestly not a concern of mine. Disk is cheap and servers are cheap... I run on 16gig 8core dell 2950's. What is more important is whether or not the application is easy to code and is functionally complete.<BR/><BR/>Additionally, I'm just not a fan of Wicket compared with Seam. Annotations, ejb3 beans/entities, jboss, etc. is definitely the way to go when it comes to creating large scale enterprise 3tier applications. I wish jsr299 was done already. =)ahttps://www.blogger.com/profile/11867559494404858630noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-34352505175859143882009-01-28T17:56:00.000+00:002009-01-28T17:56:00.000+00:00Okay, okay, just that you said in your post that y...Okay, okay, just that you said in your post that you were <I>focussing on web frameworks that spend most of their time rendering HTML / XML / JSON and not building complex server side UI stuff</I>. You commented above that "heavy and complex" server stuff is ok - well now you can take your flame-retardant suit off ;)<BR/><BR/>I've done a fair amount of UI work in Javascript and while it indeed isn't rocket science - it certainly isn't something I would recommend if you have the option of using Java instead.Peter Thomashttps://www.blogger.com/profile/12601547950877794218noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-56154125015042835262009-01-28T17:24:00.000+00:002009-01-28T17:24:00.000+00:00Controllers in JAX-RS don't have to be lightweight...Controllers in JAX-RS don't have to be lightweight; they can be heavy and complex if you wish (working with EJBs or BPEL or whatever you like). Inject whatever you need in your controllers to do whatever you want to do.<BR/><BR/>While implementing complex rich clients on the client side is non trivial, its not exactly rocket science either - and complex applications are not trivial anyway - wherever you put the logic :)James Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-15903841967865868842009-01-28T17:08:00.000+00:002009-01-28T17:08:00.000+00:00I'm not necessarily saying everything you ever bui...<I>I'm not necessarily saying everything you ever build in a web application will be both HTML enabled and XML/JSON enabled.</I><BR/><BR/>Huh, I thought the title of this blog post was "the one Java web framework to rule them all? ;)<BR/><BR/>But agreed, my point is you typically can't get away with having only annotations and "lightweight" controllers on the server and implementing view-related logic, state handling and security on the client is non-trivial.Peter Thomashttps://www.blogger.com/profile/12601547950877794218noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-85971007837541656662009-01-28T16:50:00.000+00:002009-01-28T16:50:00.000+00:00sduskis - not totally sure yet, was kinda thinking...sduskis - not totally sure yet, was kinda thinking out loud :)<BR/><BR/>I wonder if we need some way to be able to kinda generate an ETag more generically from an entity? e.g. annotating a couple of fields to denote the things the framework should use to generate an ETag that the client side or server side could use?James Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-60165733857448766972009-01-28T16:41:00.000+00:002009-01-28T16:41:00.000+00:00Peterhelping the application programmer focus on r...Peter<BR/><BR/><I><BR/>helping the application programmer focus on returning DTOs<BR/><BR/>This would indeed be fine for simple CRUD screens but what if there is significant business logic. Doesn't this mean that you need to process JSON (or XML) and end up working in Javascript more?<BR/></I><BR/><BR/>Well it depends on your application. You might have a very complex bit of logic exposed as a REST service; which - say - a rich client or Excel or ruby or whatever does all the work client side then posts the completed DTO.<BR/><BR/>You only have to expose RESTfully resources you want - I'm not necessarily saying everything you ever build in a web application will be both HTML enabled and XML/JSON enabled.<BR/><BR/><BR/><I><BR/>Also in my experience, the typical UI involves stuff that can't be easily categorized as "server side logic" - for e.g. showing / hiding controls / sections of the page depending on data. This code has to go somewhere.<BR/></I><BR/><BR/>It depends what kind of UI you are building. Is it inside Microsoft Office or .Net - in a rich client or a web browser etc. Either way you can do show/hide of parts of a page either on the server side or client side; its up to you.James Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-27957392271348847502009-01-28T15:09:00.000+00:002009-01-28T15:09:00.000+00:00@James, the issue of "if-modified checks with etag...@James, the issue of "if-modified checks with etags and the like" is a cross-cutting concern that we've thought about a lot. <BR/><BR/>We do have a client-side interceptor implementation, but we don't have a RESTful cache implementation yet. <BR/><BR/>How would you handle etags and the like with the Jersey API?Staff Software Engineer at Googlehttps://www.blogger.com/profile/09846073811897244636noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-9149769166805485662009-01-28T15:02:00.000+00:002009-01-28T15:02:00.000+00:00A few comments:helping the application programmer ...A few comments:<BR/><BR/><I>helping the application programmer focus on returning DTOs</I><BR/><BR/>This would indeed be fine for simple CRUD screens but what if there is significant business logic. Doesn't this mean that you need to process JSON (or XML) and end up working in Javascript more?<BR/><BR/>Also in my experience, the typical UI involves stuff that can't be easily categorized as "server side logic" - for e.g. showing / hiding controls / sections of the page depending on data. This code has to go somewhere.<BR/><BR/>@Jon (comment # 4):<BR/><I>Take a look at the example hotel room booking application. Implementing something like that with any other framework (specifically the 'conversations' context) has never been done before quite like it.</I><BR/><BR/>I'm not so sure about that, please see this <BR/><A HREF="http://ptrthomas.wordpress.com/2009/01/14/seam-jsf-vs-wicket-performance-comparison/" REL="nofollow">implementation of the hotel booking example in Wicket.</A><BR/><BR/>That reminds me, the typical web-app does need to manage state and you need to handle this somehow if using REST. Don't get me wrong, I appreciate REST for e.g. data transfer (POX / JSON) but I do feel it may be more trouble than it is worth for rich web-applications. REST does makes sense if you really have the need to support multiple clients at the same time (Flex / PHP / etc).<BR/><BR/>Also I have to mention <A HREF="http://ptrthomas.wordpress.com/2008/09/04/wicket-and-gwt-compared-with-code/" REL="nofollow">some things to consider when choosing GWT.</A>Peter Thomashttps://www.blogger.com/profile/12601547950877794218noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-78328882669435605762009-01-28T11:03:00.000+00:002009-01-28T11:03:00.000+00:00Good post, and yes, JAX-RS seems pretty significan...Good post, and yes, JAX-RS seems pretty significant to anyone involved in web/REST development. We've included JAX-RS support in Kauri as well, though we also support Groovy-configured explicit routing, so that you're routing info (or URI endpoints) don't end up dispersed across your code. Here's an axample: http://www.kauriproject.org/trac/browser/trunk/samples/kauri-routing-sample/src/main/kauri/router.groovy-------https://www.blogger.com/profile/07335553271490957776noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-79279699304428758472009-01-28T01:01:00.000+00:002009-01-28T01:01:00.000+00:00You've actually beat me to this one. I agree that ...You've actually beat me to this one. I agree that JAX-RS shows all the hallmarks of the foundation of a clear, clean and simple web framework. Its just a question of 'completing' it now.Stephen Colebournehttps://www.blogger.com/profile/01454237967846880639noreply@blogger.comtag:blogger.com,1999:blog-637417304187784899.post-24810563026573020412009-01-27T22:33:00.000+00:002009-01-27T22:33:00.000+00:00Thanks sduskis, I spotted the proxy client API in ...Thanks sduskis, I spotted the proxy client API in RESTeasy the other day - I really like it. Am not sure how it works when doing things like if-modified checks with etags and the like - I guess the proxy implementation could deal with that?<BR/><BR/>I'd love to see something like the Jersey client API standardized; then maybe the approach of making a smart proxy on top of that using a custom interface with JAX-RS annotations could be adopted - either by the JAX-RS standard or just as a common implementation approach.James Strachanhttps://www.blogger.com/profile/12591119339035350067noreply@blogger.com