Monday Jun 29, 2009

Devoxx 2008 interview with Ted Neward

Hot on the heals of the my JAX-RS Devoxx 08 presentation on Parleys (2,094 views so far, that is my biggest audience yet :-) ) is the interview i did with Ted Neward. This was the first time i have done something like that, but i found Ted put me at ease and i enjoyed the discussion.

Monday Jun 08, 2009

Devoxx 2008 video presentation online

See here for the video presentation i did @ Devoxx 2008 on JAX-RS.

The Parleys interface is really slick, perhaps the best interface combination of slides/video i have seen.

Thursday Jun 04, 2009

JavaOne slides for JAX-RS and Jersey

Here are the slides for the JAX-RS technical session Marc and I presented on Wednesday.

Here are the slides for the Jersey BOF @ 7.30pm on Thursday.

Monday May 04, 2009

Jersey 1.1.0-ea is released

We have just released version 1.1.0-ea of Jersey, the open source, production quality, reference implementation of the draft JAX-RS 1.1 API. The JAX-RS 1.0 specification and the 1.1 change log is available at the JCP web site and also available in non-normative HTML here.

This is an early access (ea) release until Marc and I complete the maintenance process with the JCP (the review period completed on the 3rd March) and we have implemented all EE 6 related integration features. You can expect the same level of quality as for the previous releases, and JAX-RS 1.1 is binary backwards compatible with JAX-RS 1.0 so existing JAX-RS 1.0 applications should work without recompilation.

It will be available soon from the GlassFish v2 and v3 update centers.

To get started with Jersey read the getting started document. For an overview of JAX-RS features read the Jersey user guide. To understand more about what Jersey depends on read the dependencies document.

The following JavaDoc is available:

  • Client, Server, Grizzly, WADL, JSON APIs.
  • Spring integration API.
  • Guice integration API.
  • MIME Multipart API.
  • Client using Apache HTTP client API.
  • Atom with Apache Abdera API.
  • Simple HTTP server integration API.

Given the short time-frame between 1.0.3 and 1.1.0-ea there are not too many bug fixes and features (see change log here):

  • I implemented some fixes and improvements to the EJB integration. Resource classes can be singleton beans and Provider-based classes can be singleton or no-interface view stateless session beans.
  • Pavel has added a sample showing how to use Jersey with HTTPS and GlassFish.
  • James contributed the jersey-scala module. This module will contain classes and components that make it easier to build JAX-RS/Jersey-based applications in Scala. Currently it contains a message body writer to serialize XML nodes, so one can do this:

      @Path("markup")
      class MarkupResource {
        val name = "James"

        @Produces(Array("text/html"))
        @GET
        def get() = <html>
          <body>
          <h1>Hello {name}</h1>
          <p>Markup generated by Scala code at {new Date()}</p>
          </body>
        </html>
      }

The next release, 1.1.1-ea, is tentatively scheduled for the end of May 2009. However, it depends on how much progress we make with our JavaOne preparations.

For feedback send email to:

users@jersey.dev.java.net (archived here)

or log a bugs/features here.

Thursday Apr 16, 2009

Jersey 1.0.3 is released

We have just released version 1.0.3 of Jersey, the open source, production quality, reference implementation of the JAX-RS 1.0 API. The JAX-RS specification is available at the JCP web site and also available in non-normative HTML here.

It will be available soon from the Glassfish v2 and v3 update centers.

To get started with Jersey read the getting started document. For an overview of JAX-RS features read the Jersey user guide. To understand more about what Jersey depends on read the dependencies document.

The following JavaDoc is available:

  • Client, Server, Grizzly, WADL, JSON APIs.
  • Spring integration API.
  • Guice integration API.
  • MIME Multipart API.
  • Client using Apache HTTP client API.
  • Atom with Apache Abdera API.
  • Simple HTTP server integration API.

This release has many bug fixes, you can see the change log here, as well as the following improvements and features:

    • Guice 2.0 integration, leveraging the contribution by Gili Tzabari. Guice integration is on a par with Spring integration.
      The support depends on Guice 2.0 distributed in the GuiceyFruit maven repository. GuiceyFruit, developed by James Strachan, is a set of extensions to Guice 2.0, such as support for Java EE artifacts like @PostConstruct/@PreDestroy, @Resource and @PersistenceContext. Jersey combined with GuiceyFruit makes for a very interesting fruity combination.
    • Developer defined WADL-based resource classes, inspired by James Strachan's use of WADL and Jersey MVC.
      Injecting WadlApplicationContext enables access to the WADL JAXB representation for the application.
    • Multipart MIME improvements to the jersey-multipart module.
      The parsing of Multipart MIME now uses the MIMEPull API which provides efficient stream-based processing and the caching of large MIME body parts to disk. Thus very large Multipart MIME may be consumed without running out of memory (as was previously the case).
      The overloaded use of @FormParam with "multipart/form-data" body parts has now been deprecated as this caused much confusion and created an artificial and limited abstraction when processing form data. This has been replaced with @FormDataParam.
      Finally Imran M Yousuf provided a number of useful fixes, tests and improvements, such as client-side uploading files with FileDataBodyPart.
    • Niall Gallagher contributed container support for the Simple HTTP server. This was an excellent contribution, code, tests and documentation, very easy to integrate.
    • Enterprise session beans as resource classes.
      Ken and I worked on integration with the latest builds of Glassfish as described here.
    • Client API listeners when producing/consuming representations.
      Pavel added support via a filter to listen to the client sending and receiving representations, which is useful to present feedback when uploading or downloading files. See ConnectionListenerFilter.
    • Plug-in Java type support for @\*Param annotations.
      JAX-RS defines a set of rules (for example, see @QueryParam) but it is useful to support additional rules.
      The JAX-RS rules are implemented using StringReaderProvider and developers may implement the same provider interface to add their own rules. Jersey provides support for java.util.Date (using the standard HTTP supported date formats) and JAXB for XML-encoded documents.
    • Pavel has added a sample showing how to use Jersey with HTTPs, client certificates and Grizzly.
    • Jakub has created the maven infrastructure for a Jersey user guide (also available in PDF). Currently the user guide contains the JAX-RS overview (the same as presented on the Jersey wiki) and documentation on JSON support.
      Documentation is important (and as one person said to me, no documentation, no feature) but it takes time for us developers to write English prose, so the user guide will be developed iteratively. Contributions to this area are most welcome.
    • Naresh's Jersey test framework has been included and some samples are already using it. We plan to transition over the other samples and may make breaking changes to the test API as we improve support.

    The next release, 1.1.0-ea, is scheduled for the end of April 2009. This will be an early access implementation of the JAX-RS 1.1 maintenance release. We will be calling it "early access" because not all EE features will be ready until the full EE 6 implementation is available in the final release GlassFish v3. However, developers can still expect the same degree of quality as that for previous releases of Jersey.

    For feedback send email to:

    users@jersey.dev.java.net (archived here)

    or log a bugs/features here.

    Tuesday Apr 14, 2009

    Jersey and Spring enterprise tech tip

    An new enterprise tech tip explaining how to get started with Jersey and Spring is available.

    Additionally, see here for JavaDoc and here for a Spring sample.


    Friday Apr 03, 2009

    Jersey features and documentation

    There are a whole bunch of features that Jersey provides in addition to the JAX-RS API. Here are some of the main features:

    • WADL
      A WADL can be obtained from the running service for the known resources at deployment or for each resource using OPTIONS.
      Documentation can be connected with the WADL.
      The WADL runtime-model can be used in conjunction with the Model View Controller pattern.
    • Client API
      Ease of use API for making request to HTTP-based services. Leverages artifacts of JAX-RS for producing and consuming representations as Java types.
      Leverages existing HTTP client solutions like Http(S)UrlConnection or the Apache HTTP client.
    • Spring integration
      This is also provided by NetBeans 6.5, see the Web services example for RESTful Web services and Spring.
      Stay tuned for an enterprise tech-tip on Jersey & Spring.
    • Web application and resource-specific filtering
      Resource-specific is how the @RolesAllowed support is implemented.
    • Model view controller with supported provided for JSPs.
      A resource class is a controller, which can return a Viewable that references a view and a model. The view processed the model to render a representation such as an HTML page.
      Developers can plug in support for their own view technology, say for Freemarker or Velocity, by implementing a template processor.
    • JSON support integrated with JAXB
      Use one annotated JAXB class instances of which can be serialized to XML or JSON.
    • Multipart MIME ("multipart/\*")
      Makes it easier to consume "multipart/form" representations sent from browsers.
    • Atom support using Apache Abdera
      See also the three samples: server; client; and model.
    • Embedded container support for monster a.k.a Grizzly and the light wight HTTP server (The Simple container will be available for 1.0.3)
      See here for Grizzly.
      Grizzly makes it really easy to test clients and services.
    • Plug-in injection support
      Add your own stuff to be injected. See here and here.
    • Plug-in IoC-framework support
      This framework is used to integrate Spring, Guice and EJB support.
    • Numerous samples
      See here for a zip of all the samples.

    Most of these features, and many others, have corresponding documentation in the JavaDoc but we realize this is not sufficient for developers.

    With that in mind we have started work on a Jersey users guide, written in DocBook. Jakub has put some nice maven-based DocBook infrastructure in place and we can deploy the users guide to the maven repo.

    I have converted the JAX-RS overview, on the wiki, to be a chapter of the users guide. And, Jakub is currently working on some JSON documentation. For a preview see the PDF and the HTML zip. We will slowly build up the users guide over successive iterations/releases.

    Let is know what you think. And if you are interested in helping out in this documentation effort please email the Jersey users list: users@jersey.dev.java.net

    NetBeans 6.7 m3, maven and Jersey

    NetBeans 6.7 milestone 3 has support for maven web projects with RESTful Web services using Jersey:

    Thursday Apr 02, 2009

    Glassfish v3, EJB 3.1 and Jersey

    With Glassfish V3 promoted build 43 (or greater) and the latest Jersey 1.0.3-SNAPSHOT it is now possible to create no-interface-view session beans (or POJO session beans) deployed in the war and those beans may be either (root) resource or provider classes.

    A big thanks to Ken Saks who provided the hooks in the Glassfish EJB module so Jersey can dynamically plug-in if Glassfish EJB support is available.

    For example one could develop the following root resource class:

    @Stateless
    @Path("ssb")
    public class StatelessSessionRootResource {
    
        @Context private UriInfo ui; 
    
        @GET
        public String get() {
            return "GET: " + ui.getRequestUri().toASCIIString();
        }
    }

    Notice the annotated field, ui,  to obtain an instance of UriInfo. Jersey will defer to JNDI to obtain an instance of the session bean (using the EJB 3.1 portable naming mechanism) and the EJB module will inform Jersey when an instance of the session bean is constructed so that Jersey gets a chance to inject Jersey/JAX-RS artifacts.

    Session beans can also be used for sub-resources. For example one can add another resource class:

    @Stateless
    public class StatelessSessionResource {
    
        @Context private UriInfo ui;
    
        @GET
        public String get() {
            return "GET: " + ui.getRequestUri().toASCIIString();
        }
    }

    and then modify the StatelessSessionRootResource class to be as follows:

    @Stateless
    @Path("ssb")
    public class StatelessSessionRootResource {
    
        @Context private UriInfo ui;
    
        @GET
        public String get() {
            return "GET: " + ui.getRequestUri().toASCIIString();
        }
    
        @EJB StatelessSessionResource r; 
    
        @Path("sub")
        public StatelessSessionResource getSub() {
            return r;
        }
    }

    A reference to StatelessSessionResource is injected onto the root resource class and then the sub-resource locator method, getSub, returns that reference.

    Alternatively the same functionality can be achieved using the Jersey specific feature of returning the class:

    @Path("sub/class")
    public Class<StatelessSessionResource> getSubClass() {
        return StatelessSessionResource.class;
    }
    

    See here for a simple maven project, which contains the resource classes presented above, and can be built to create a war file to deploy to Glassfish V3. The following URIs will exercise the application:

    http://localhost:8080/ejb-1.0/rs/ssb

    http://localhost:8080/ejb-1.0/rs/ssb/sub

    http://localhost:8080/ejb-1.0/rs/ssb/sub/class

    Wednesday Apr 01, 2009

    JavaOne and CommunityOne sessions and BOFs

    Where will YOU be June 2?

    Thankfully JavaOne 2009 is a little later this year, 2nd to 5th of June. Which gives my co-speakers and I more time to prepare (or at least more time to leave things until something needs to be done!).

    Three talks have been accepted:

    • Technical session TS-4875.
      Developing RESTful Web Services with the Java™ API for RESTful Web Services (JAX-RS). Marc Hadley, Paul Sandoz.
    • BOF-4878.
      Developing RESTful Web Services with Jersey and Java™ API for RESTful Web Services (JAX-RS). Craig McClanahan, Jakub Podlesak, Paul Sandoz.
    • BOF-5009.
      Atmosphere: Comet for Everyone, Everywhere. Jean-François Arcand, Paul Sandoz.

    For BOF-4878 Craig will provide some interesting details on how Jersey is being utilized in Sun's Cloud offerings.

    Atmosphere, although a young project, is already starting to get some good adoption. Atmosphere provides portable ease of use APIs to support Comet-style interactions. BOF-5009 will introduce Atmosphere and we will demonstrate using Atmosphere combined with Jersey.

    If you plan to attend JavaOne and any of these sessions please contact me at Paul.Sandoz@Sun.Com and i can send you a special priority code you can utilize when registering.

    For CommunityOne West one session has been accepted:

    This session will be a combination of the JavaOne technical session TS-4875 and the BOF-4878.

    Thursday Feb 12, 2009

    Jersey 1.0.2 is released

    We have just released version 1.0.2 of Jersey, the open source, production quality, reference implementation of the JAX-RS 1.0 API. The JAX-RS specification is available at the JCP web site and also available in non-normative HTML here.

    This release will be available tomorrow (12th Feb, if all goes well) from the Glassfish v2 update center, which aligns with the release of the Glassfish Portfolio that includes the GlassFish v2.1 Enterprise Server.

    It will be available from the Glassfish v3 update center once we resolve some dependency issues.

    To get started with Jersey read the getting started document. For an overview of JAX-RS features visit the Jersey wiki and read the overview document. To understand more about what Jersey depends on read the dependencies document. The following JavaDoc is available:

    • Client, Server, WADL, JSON APIs.
    • Spring integration API.
    • MIME Multipart API.
    • Client using Apache HTTP client API.
    • Atom with Apache Abdera API.

    This release has many bug fixes, you can see the change log here, as well as the following improvements and features:

    • The JSON with JAXB "natural" convention.
      Jakub has worked closely with the JAXB team so that the producing/consuming of JAXB to/from JSON uses information from the JAXB model. This makes for JSON from JAXB that is more "natural", easier to consume, and requires less configuration on the part of the developer. As part of this work we replaced our own JSON parsing and writing functionality with Tatu's JSON library Jackson.
      For backwards compatibility we have retained the previous "mapped" convention as the default convention, but this is easy to change using the new JSON configuration, but i will leave such explanations for Jakub to blog about. In the next release we will probably deprecate the "mapped" convention.
    • JSON with padding provider.
      Jakub has included a JSON with Padding (JSONP) provider for those wishing to embed JSON within a JavaScript "callback" function. This provider will also work with JSON and XML media types. See the JSONP sample for more details.
    • Resource method specific filters.
      I finally got around to implementing resource specific filters. Request and response filters can now be associated with sub-resource locator and resource methods. For more details see the JavaDoc here. This functionality is used to implement support for @RolesAllowed using the RolesAllowedResourceFilterFactory.
    • Atom Abdera support.
      Craig McClanahan has added support for producing and consuming of Atom Entry and Feed Java types of the Apache Abdera project. An injectable helper class, ContentHelper, is supplied to support the getting and setting of the content part of an Atom entry reusing the registered message body readers and writers. Craig has also provided some really nice examples showing a simple client and server. The server reuses the @RolesAllowed support for some authorization logic based on the user principal and the URI. For more details refer to the AtomPub Contacts Client and Server samples.
    • Implicit produces.
      With James Strachan's prompting and great help (discussions, issues and patches) i have implemented support for @ImplicitProduces on resource classes. This allows one to use the implicit model view controller approach for JSPs producing HTML as presented in the bookstore sample while allowing explicit methods for other media types say XML or JSON. Unfortunately we could not resolve some issues in time for this release, associated with the maven unit test plugin and embedded Glassfish, to update the bookstore sample.
    • Servlet as a filter.
      As part of James's "JAX-RS as the one Java web framework to rule them all?" i have modified the Servlet support such that one can register the Servlet artifact as a Servlet or a Filter, see here and here for more details. The advantage of the latter is that it is much easier to support filters declared before the Jersey filter that redirect to say static content or redirect to other Web frameworks. James has already provided a patch to the Jersey filter to support the returning of static content, which will be integrated into the 1.0.3-SNAPSHOT next week.
    • Client using Apache HTTP client.
      Jorge Williams contributed support for using the Jersey Client API with the Apache HTTP client (as opposed to using HttpURLConnection). See here for more details.
    • Pavel Bucek has added support for SSL configuration of the Client API when using HttpURLConnection. See here for more details.

    For the next release, 1.0.3, scheduled for March/April 2009, we plan to include the following contributions (these were previously considered for 1.0.2 but were not stable enough):

    • Guice 2.0 integration.
      Gili Tzabar has contributed Guice support as a patch and we continue to refine this. The patch will go into the 1.0.3-SNAPSHOT next week. It is understood that the Guice 2.0 APIs are stable and i have found a maven repository where Guice 2.0 snapshot jars are available. This should give us enough time between now and the 1.0.3 release to refine the support.
    • Test framework.
      Naresh has been working hard on the jersey test framework in another branch. Unfortunately it was not quite ready for the 1.0.2 release and we need to depend on a stable API for embedded Glassfish, which is currently being designed. Once the framework is in place it will allow us to write tests that are capable of being deployed on different containers.

    For feedback send email to:

    users@jersey.dev.java.net (archived here)

    or log a bugs/features here.

    Friday Dec 19, 2008

    A Christmas present for Jersey ant users?

    !/bin/bash
    
    version=1.0.1
    
    function getJerseyModule {
        curl http://download.java.net/maven/2/com/sun/jersey/$1/${version}/{$1-${version}.jar} -o "#1"
    }
    
    for module in jersey-core jersey-server jersey-client; do
        getJerseyModule $module
    done
    
    curl http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.0/{jsr311-api-1.0.jar} -o "#1"
    curl http://repo1.maven.org/maven2/asm/asm/3.1/{asm-3.1.jar} -o "#1"
    

    I jest of course :-) but there is a serious point.

    Since we moved to maven we longer provide a zip of Jersey. This has advantages because we no longer have to get approval to bundle and then bundle third party jars, especially for samples that could depend on many things, making for a rather large download.

    But perhaps for ant users we can make it a little easier to obtain the core Jersey jars and dependencies. What do Jersey ant users prefer?

    1. download a script that when run downloads the core Jersey jars and dependencies; or
    2. download a zip containing the same jars as would be downloaded in 1).

    Monday Dec 15, 2008

    Devoxx slides and examples for the JAX-RS presentation

    A PDF of my Devoxx presentation can be found here.

    The simple example project i used to demonstrate some JAX-RS features can be found here. This is a maven project. It can be loaded into NetBeans 6.5 if using the maven plugin.

    The EJB example can be found here. This is a NetBeans 6.5 project using Jersey 1.0 as shipped with NetBeans 6.5. Note that this currently relies on Glassfish only specific behaviour and is intended as a demostration of where JAX-RS EE 6 functionality is heading.

    The simple Security example leveraging Web container security, that i had no time to present, can be found here. This is a NetBeans 6.5 project using Jersey 1.0 as shipped with NetBeans 6.5. I wish i had time to present this as it would have given me the opporunity to have a great rant at the limited support for HTTP authentication in browsers such as Firefox. The user could be so much more in control of authenticated sessions...

    Tuesday Dec 02, 2008

    Jersey, Glassfish, and EJBs as root resources

    Jersey supports EJB 3.0 beans as root resources as follows:

    1. Annotate a local or remote interface with @Path and annotate methods as appropriate; and
    2. Ensure that the local or remote interface in 1) is registered by file/directory or package scanning.

    The registration mechanism in 2) is no different for registering non-EJBs. The caveat: it currently only works with Glassfish, which supports JNDI lookup of an EJB reference using the fulling qualified class name of the local or remote interface.

    The JSR 311 expert group is currently considering approaches to integrate JAX-RS with EJB 3.1, which should present some nice improvements, namely EJBs bundled in the war and EJBs with no interfaces. I have high hopes we can retain the current ease of use registration aspects with JAX-RS as presented here and then it should be really simple to use EJBs as POJOs in the web tier directly serving HTTP requests.

    There are already some EJB 3.1 features ready in Glassfish Prelude, as highlighted by Ken, with update centre instructions from Mahesh. Now i need to find the time to experiment...

    Monday Dec 01, 2008

    Jersey 1.0.1 is released

    We have just released version 1.0.1 of Jersey, the open source, production quality, reference implementation of the JAX-RS 1.0 API. The JAX-RS specification is available at the JCP web site and also available in non-normative HTML here.

    This release will be available soon from the Glassfish v2 and v3 update centers.

    To get started with Jersey read the getting started document. For an overview of JAX-RS features visit the Jersey wiki and read the overview document. To understand more about what Jersey depends on read the dependencies document. For details of the Jersey API go to here.

    This release has many bug fixes, you can see the change log here, as well as the following improvements and features:

    • The IoC integration SPI was improved to provide a clearer and well-defined distinction between IoC-managed components and Jersey-managed components. Additionally, Jersey managed components now support @PostConstruct and @PreDestroy for all the supported Jersey-based life-cycles.
    • Spring integration was improved based on IoC integration improvements. Spring-registered beans (in the XML configuration or auto-wired) that are root resource or provider classes are automatically registered. See the JavaDoc here for more details on how to integrate with Spring.
    • Craig McClanahan has contributed a high-level MIME multipart API. This makes it easier to read and write MIME body parts using the same mechanisms as reading and writing entities of requests and responses. We expect to leverage this API for further ease of use improvements in future releases.
    • Jakub added two maven archetypes for quickly creating maven projects: a quick start Web application archetype using Glassfish and embedded Glassfish; and a quick start Grizzly application archetype. See Jakub's enterprise tech tip and Arun's blog entry for more details.
    • A Scala-based Web application sample and a very simple Groovy-based embedded Grizzly server sample are now included in the samples.

    For the next release, 1.0.2 scheduled for Jan/Feb 2009, we plan to include the following contributions:

    • Utilizing the Jersey Client API with the Apache HTTP client, contributed by Jorge Williams.
    • Integration with Guice, contributed by Gili Tzabari.

    For feedback send email to:

    users@jersey.dev.java.net (archived here)

    or log a bugs/features here.

    About

    sandoz

    Search

    Archives
    « April 2014
    SunMonTueWedThuFriSat
      
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
       
           
    Today