Saturday, February 21, 2015

RESTful Charts with JAX-RS and PrimeFaces

Oftentimes, it is useful to utilize a chart for providing a visual representation of your data. PrimeFaces supplies charting solutions that make it easy to add visual representations of your data into web and mobile applications. If we couple the use of PrimeFaces charting components with RESTful web service data, we can create custom charts that scale well for both desktop and mobile devices.

In this post, I will update the Java EE 7 Hands On Lab MoviePlex application to provide a dashboard into which we can integrate PrimeFaces chart components. We'll create one chart in this example, but you can utilize this post to help you build even more charts in a similar manner. Specifically, we will utilize a RESTful web service to glean movie theater capacity information, and we'll display each of the theater capacities using a PrimeFaces Bar Chart.

To begin, download the Java EE 7 Hands On Lab application solution archive, if you have not already done so.  From there, open it up within NetBeans IDE. To create this post, I am using NetBeans 8.0.2. Once the project has been imported into NetBeans, deploy it to your application server (GlassFish 4.1 in my case) by right-clicking on the project and choosing Run.  Once deployment is complete, open the theater web service within a browser by opening the following URL: http://localhost:8080/ExploringJavaEE7/webresources/theater/.  The web service should produce a listing that looks similar to that in Figure 1.
Figure 1:  Theater Web Service XML


We will utilize the data from this web service to feed our dashboard widget.  Let's first create the backend code, and then we will tackle the UI.  First, create a new package named org.glassfish.movieplex7.jsf, by right-clicking on Source Packages, and selecting "New..."-> "Java Packages".  Next, create a JSF Managed Bean controller by right-clicking on that package, and selecting "New..."-> "JSF Managed Bean", and name it DashboardController.   Let's annotate the controller as @SessionScoped, and then implement java.io.Serializable.  In this controller, we will obtain the data, and construct the model for the dashboard.  We will first query the web service utilizing a JAX-RS client, and we will utilize the data to populate list of Theater objects.  Therefore, we need to define the following four fields to begin:

Client jaxRsClient;
// Typically not hard coded...store in a properties file or database
String baseUri = "http://localhost:8080/ExploringJavaEE7/webresources/theater/";
    
private List<Theater> theaterList;
private BarChartModel theaterCapacityModel;

The Client is of type javax.ws.rs.client.Client, and we will initialize the field within the class constructor by calling upon the javax.ws.rs.client.ClientBuilder, as follows:

public DashboardController() {
    jaxRsClient = ClientBuilder.newClient();
}

Next up, we need to create a method to load the data, create, and configure the model.  In our controller, the init() method basically contains an implementation of delegating tasks to other methods. The init() method implementation invokes two methods: loadData(), and createTheaterCapacityModel().

public void init() {
    loadData();
  
    createTheaterCapacityModel();
}

The code is written such that it will be easy to add more widgets to our dashboard at a later date, if desired. The loadData() method provides the implementation for loading the data from our web service into our local list.


private void loadData() {
       
    theaterList = jaxRsClient.target(baseUri)
            .request("application/xml")
            .get(new GenericType>() {
            }
            );
      
}

If we had more widgets, then we would add the data loading code for those data models into this method as well. Next, we need to initialize the org.primefaces.model.chart.BarChartModel that we had defined, and load it with the data from the web service. The initTheaterCapacityModel() method contains the implementation for creating the BarChartModel, and populating it with one or more ChartSeries objects to build the data.

public BarChartModel initTheaterCapacityModel() {

    BarChartModel model = new BarChartModel();

    ChartSeries theaterCapacity = new ChartSeries();
    theaterCapacity.setLabel("Capacities");


    for (Theater theater : theaterList) {

        theaterCapacity.set(theater.getId(), theater.getCapacity());

    }
    model.addSeries(theaterCapacity);

    return model;
}

As you can see, this model consists of a single org.primefaces.model.chart.ChartSeries object.  Actually, the model can contain more than a single ChartSeries object, and different colored bars will be used to display that data within the chart.  In this case, we simply add the theater ID and the capacity for each Theater object to the ChartSeries object, and then we add that to the BarChartModel.


The createTheaterCapacityModel() method  is invoked within our init() method, and in it we call upon the initTheaterCapacityModel() method for creation of the org.primefaces.model.chart.BarChartModel, and then configure it accordingly.

private void createTheaterCapacityModel() {
    theaterCapacityModel = initTheaterCapacityModel();

    theaterCapacityModel.setTitle("Theater Capacity");
    theaterCapacityModel.setLegendPosition("ne");
    theaterCapacityModel.setBarPadding(3);
    theaterCapacityModel.setShadow(false);

    Axis xAxis = theaterCapacityModel.getAxis(AxisType.X);
    xAxis.setLabel("Theater");

    Axis yAxis = theaterCapacityModel.getAxis(AxisType.Y);
    yAxis.setLabel("Capacity");
    yAxis.setMin(0);
    yAxis.setMax(200);

}

As you can see, inside of the method, we initialize the model by calling upon initTheaterCapacityModel(), and then we configure it via a series of "set" methods. Specifically, we set the title, position, and provide some visual configurations. Next, set up the axis by calling upon the model's getAxis() method, and passing the X and Y axis constants. We then configure each axis to our liking by setting a label and min/max values for the Y axis.  See the full sources for the class at the end of this post.

That does it for the server-side code, now let's take a look at the UI code that is used to display the chart component. Begin by generating a new XHTML file at the root of the Web Pages folder in your project by right-clicking and choosing "New..."-> "XHTML...", and name the file dashboard.xhtml. The sources for dashboard.xhtml should contain the following:

<html xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns="http://www.w3.org/1999/xhtml">
    <h:head>
     
     
        <title>Theater Dashboard</title>

    </h:head>

    <h:body>
        <f:event listener="#{dashboardController.initView}" type="preRenderView"/>
        <h:form id="theaterDash" prependid="false">
            <p:growl id="growl" showdetail="true"/>
            <p:layout fullpage="true">
                <p:layoutUnit position="center">
                   
                            <p:panel header="Capacity for Theaters" id="theater_capacity" style="border: 0px;">
                                <p:chart model="#{dashboardController.theaterCapacityModel}" style="border: 0px; height: 200px; width: 500px;" type="bar">
                            </p:chart></p:panel>
                         
                 
                </p:layoutUnit>
            </p:layout>

            <p:poll interval="60" listener="#{dashboardController.pollData}"/>


        </h:form>


    </h:body>

</html>



Fairly simplistic, the JSF view contains a PrimeFaces layout, including a panel and a chart.  Near the top of the view, an f:event tag is used to invoke the listener method which is implemented within the DashboardController class, identified by initView().  For the purposes of this example, the p:chart tag is where the magic happens. The chart type in this case is set to "bar", although other options are available (visit http://www.primefaces.org/showcase). The model is set to                         #{dashboardController.theaterCapacityModel}, which we defined, populated, and configured within the controller class. We then provide a width and a height to make the chart display nicely.  In case the data changes (I know theaters do not increase or decrease in size often, but go with me here), we added a PrimeFaces poll component invoke the pollData() method, which refreshes the data periodically.  In this case, the data will be refreshed every 60 seconds.

When complete, the chart should look like that in Figure 2.


Figure 2:  The PrimeFaces Bar Chart

The chart is interactive, and if you click on the label, the bars will become hidden.  This is handy if you have more than one category (via the ChartSeries).  You can even include a p:ajax tag within the chart component, and invoke an action when the chart is clicked on...perhaps a dialog will pop up to display some additional data on the item which is clicked.

That does it...now you can create even more charts utilizing PrimeFaces and RESTful web services.  I suggest building upon the MoviePlex application to see what other possibilities can be had.

Full Sources for the DashboardController class:

package org.glassfish.movieplex7.jsf;

import java.util.List;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.GenericType;
import org.glassfish.movieplex7.entities.Theater;

import org.primefaces.model.chart.Axis;
import org.primefaces.model.chart.AxisType;
import org.primefaces.model.chart.BarChartModel;
import org.primefaces.model.chart.ChartSeries;

/**
 *
 * @author Juneau
 */
@Named(value = "dashboardController")
@SessionScoped
public class DashboardController implements java.io.Serializable {
    
    Client jaxRsClient;
    // Typically not hard coded...store in a properties file or database
    String baseUri = "http://localhost:8080/ExploringJavaEE7/webresources/theater/";
    
    private List theaterList;
  
    private BarChartModel theaterCapacityModel;


    /**
     * Creates a new instance of FamisEquipPmChartController
     */
    public DashboardController() {
        jaxRsClient = ClientBuilder.newClient();
    }
    
    public void init() {
        loadData();

        createTheaterCapacityModel();
    }
    
    /**
     * Initializes the view on page render...if we wish to grab a reference
     * to a panel, etc.
     */
    public void initView(){
        UIViewRoot viewRoot =  FacesContext.getCurrentInstance().getViewRoot();
        // Do something
    }

    public void pollData() {
        System.out.println("polling data...");
        loadData();
    }

    /**
     * JAX-RS client to poll the data
     */
    private void loadData() {
       
        theaterList = jaxRsClient.target(baseUri)
                .request("application/xml")
                .get(new GenericType>() {
                }
                );
      
    }

    

    /**
     * Initialize the Bar Chart Model for Displaying PM Estimated Hours by Month
     *
     * @return
     */
    public BarChartModel initTheaterCapacityModel() {

        BarChartModel model = new BarChartModel();

        ChartSeries theaterCapacity = new ChartSeries();
        theaterCapacity.setLabel("Capacities");


        for (Theater theater : theaterList) {

            theaterCapacity.set(theater.getId(), theater.getCapacity());

        }
        model.addSeries(theaterCapacity);

        return model;
    }

   

 
    
    private void createTheaterCapacityModel() {
        theaterCapacityModel = initTheaterCapacityModel();

        theaterCapacityModel.setTitle("Theater Capacity");
        theaterCapacityModel.setLegendPosition("ne");
        theaterCapacityModel.setBarPadding(3);
        theaterCapacityModel.setShadow(false);

        Axis xAxis = theaterCapacityModel.getAxis(AxisType.X);
        xAxis.setLabel("Theater");

        Axis yAxis = theaterCapacityModel.getAxis(AxisType.Y);
        yAxis.setLabel("Capacity");
        yAxis.setMin(0);
        yAxis.setMax(200);

    }

    /**
     * @return the theaterCapacityModel
     */
    public BarChartModel getTheaterCapacityModel() {
        return theaterCapacityModel;
    }

    /**
     * @param theaterCapacityModel the theaterCapacityModel to set
     */
   public void setTheaterCapacityModel(BarChartModel theaterCapacityModel) {
        this.theaterCapacityModel = theaterCapacityModel;
    }
    
   
}

Wednesday, February 11, 2015

JSF Tip: Utilizing Expression Language to Create Cross Platform File Links

Does your organization contain a multi-platform environment?  If so, then you may have the requirement to add links to file shares within your Java EE application, and those links may require use of a different protocol depending upon platform of the user's machine.  For instance, in an organization that contains both Windows and OS X, a network file share may require use of NFS (file://) prefix from a Windows machine, and use of SMB (smb://) prefix from an OS X machine. How can you easily distinguish which link to provide to your users within a web application?

There are many solutions to this problem.  Some solutions involve use of a servlet to determine the user's operating system, or some other solution that requires use of server-side code.  In this tip, I'll show you how to determine the user's operating system via the request object from Expression Language.

To determine whether a user requires the use of NFS or SMB for accessing a file share, simply use expression language to obtain the user-agent from the request object as such:

#{header['user-agent'].contains('Windows')?'file://':'smb://'}rest/of/url/here

In the EL above, if the user-agent contains "Windows", then the
file://
prefix is used, otherwise
smb://
will be utilized for the link. This solution can be implemented directly within the views, relieving the requirement to recompile code.

Friday, January 23, 2015

Adopt-a-JSR for Java EE - CJUG Meetup Recap

This fall, the Chicago Java User Group (CJUG) adopted JSR-366, the Java Platform, Enterprise Edition (Java EE 8) Specification.  To that end, the CJUG will be hosting periodic meetups to work on contributing towards Java EE 8.  Our first meet with regards to this agenda was held on January 15, and we covered JSF 2.3 (JSR-372)...for beginners and advanced users.  This meetup was geared towards anyone who wanted to contribute to Java EE 8 in some way, and we hosted two tracks during the meetup:  "I Want to Learn JSF", and "I Want to Hack JSF"...beginner and advanced, respectively.  Both of the tracks were well received.

I Want to Learn JSF Recap:  

Bob Paulin, CJUG President, led the group through a tutorial that focused on building a simple JSF application using the NetBeans 8 IDE.  Specifically, this tutorial led the group to building entity classes against some of the sample database tables, creating EJBs, and finally, generating JSF views to work with the data.  The tutorial can be found here if you are interested in taking a look.  The sources for the basic tutorial are in GitHub.

I Want to Hack JSF Recap:

I led the more advanced JSF track through a series of advanced tasks...digging into the Mojarra code a bit.  First, we covered the basic steps to checkout the Mojarra 2.3 Milestone and trunk.  We then covered the build process, and how to pull the sources into an IDE, such as NetBeans.  Finally, we decided to dig into the code a bit and try to debug an existing JIRA issue, JAVASERVERFACES-3429.  The team worked the issue, loading the test project into NetBeans and using the debugger to step through the code.  We were able to reproduce the issue and pinpoint the cause of the problem to a specific method within the Mojarra sources.  We were unable to determine the exact cause of the issue due to time constraints, but the group gained useful experience digging through the Mojarra sources.

The evening was a success, as we were able to spread information on how anyone can contribute to Java EE, even those who are new to the platform.  We also sparked new interest in JSF, and presented some of the upcoming JSF 2.3 features.

Contributing

What are some of the ways you can contribute?  How about the following, just to list a few:

  1)  Read through the documentation/specification and provide feedback.

  2)  Provide documentation for a specific JSR...perhaps work on the release notes for a particular milestone, write examples, or do a presentation.

  3)  Test against the milestone releases, and submit issues if any are found.

Again, this is just a short list of how anyone can get started contributing.  I am looking forward to the next Adopt-a-JSR meetup for CJUG, and I look forward to hearing about your JUG's contribution towards making Java EE 8 great!

Wednesday, December 10, 2014

Honored to be Part of the NetBeans Dream Team


I have recently been honored via invitation to join the NetBeans Dream Team.  I've been using NetBeans IDE since its infancy, and I've watched it evolve into one of the top IDEs for developing Java applications, amongst other things.  I am honored and privileged to have the opportunity to help promote NetBeans, and collaborate with the other NetBeans Dream Team experts to help make the NetBeans IDE even better.

There were 16 new members that were invited to join, and Geertjan Wielenga has written a post about the new members here:  http://netbeans.dzone.com/articles/16-new-netbeans-dream-team.   I want to thank all of the members for having me as a NetBeans Dream Team member...I am looking forward to working with you.

To kick off my membership to the NetBeans Dream Team, I wanted to write a post that promoted some of my favorite, but perhaps most overlooked NetBeans features.  I will list three such features in this post, as I must keep my writings short...and I could go on writing about my favorite features for quite some time.  All that said...here are my favorite NetBeans IDE features that are oftentimes overlooked:

#1:  Built-in Terminal:  Did you know that NetBeans has a built in terminal at your disposal?  Sure, it is acceptable to have a terminal window or command line open outside of NetBeans, but maintaining one or more of them inside of the IDE makes it even easier to focus on your tasks at hand...without the need to move outside of the IDE.  (Speaking of which, did you know there is a task list in NetBeans...sorry, I digress).  The NetBeans built-in terminal provides you with the ability to open one or more terminal sessions right within the IDE, and you can even open up an SSH connection to a remote server.  This provides a unified development environment at its best!  To open up a terminal, simply go to the "Window" menu, then select "IDE Tools" -> "Terminal".



#2:  Version Control Made Easy:  No matter which version control you use, NetBeans makes it simple, providing convenient integration points for version control with your NetBeans projects.  I've used Mercurial, Subversion, and Git within NetBeans, and each of them is easy to use...with an intuitive interface, and even some additional plugins to make use easier.  One of my favorite plugins is the Git Toolbar, which provides easy buttons for showing history, committing changes, etc.

#3:  Debugger:  When I am having an issue with one of my applications, the NetBeans debugger can be an invaluable utility.  Perhaps my favorite feature of the NetBeans debugger is the ability to see the values of variables as the application is running.  


The debugger provides the ability to set breakpoints (conditional if you'd like), so that one can evaluate the current status of the code when breakpoints are reached.  If you are having an issue in one of your classes, the debugger allows you to see the current variable values, and step through the code to find the offending line.  It also provides you with numerous other capabilities, such as the ability to set expression watches, easily see the call stack, the ability to see which classes are currently loaded, sessions, current threads, and more.  The debugger has become one of those features that I cannot live without, and it deserves a book of its own.

That does it for this short post.  Once again, I want to thank Geertjan and all of the members of the NetBeans Dream Team for having me...I am very glad to be a part of the team!





Friday, November 28, 2014

Book Review: RESTful Java Patterns and Best Practices

I had the privilege to review the book RESTful Java Patterns and Best Practices, authored by Bhakti Mehta for Packt Publishing.  In short, this book hits the sweet spot when it comes to learning utilization of RESTful web services.  As the book provides a solid foundation for the creation, testing, and utilization of RESTful web services with JAX-RS 2.0, it also provides information on essential topics, such as authentication, security, and performance.  There is even coverage of advanced topics, such as rate-limiting, polling, and micro services.  




The book begins by providing a general understanding RESTful web services, design principals, and the differences between the various HTTP verbs.  This discussion is provided at a high level, such that it is generalized enough to cover various RESTful web service implementations.  The first chapter then goes into the Java API for RESTful Web Services.  This section of the first chapter is brief, and to the point.  It clearly explains how to create services and then test/access them via the Client API, cURL, and other utilities.  As mentioned at the top of this post, Chapter 1 provides a solid foundation...and it is a quick read also, which enables developers to get up and running quickly with the JAX-RS API.

Chapter 2 covers fundamentals, such as returning various content types (JSON, XML, etc.), and designing meaningful URL patterns to obtain the desired media type.  This chapter delves into streaming and chunked content, parsing JSON, and versioning support.  Chapter 2 builds upon Chapter 1 very nicely, further explaining the fundamental concepts of RESTful services.

The third chapter covers security, validation, and logging of RESTful web services.  This is a chapter for intermediate users, as it goes beyond the basics and covers the use of filters for logging, and constraint annotations for validation.  It then provides a brief example of building an exception class.  Lastly, this chapter goes into authentication practices using SAML (Security Assertion Markup Language), OAuth, and tokens.  While this chapter sets a good stage for discussing the various types of authentication, it does not go into detail on these topics.

Chapter 4 covers performance via caching, asynchronous and long-running jobs, and partial updates.  The chapter clearly explains how to utilize the Cache-Control header and ETags.  It then explains how to design asynchronous web services, and some best practices.  The last topic in the chapter is partial updates...a topic that is briefly explained, but leaves room for further exploration.

The next chapter goes into advanced topics for RESTful web services...including rate-limiting, response pagination, internationalization and localization, and pluggability and extensibility.  I really liked the way that this chapter covered rate-limiting in detail, and explained why this is an important topic.  It then provides a detailed explanation for response pagination, along with a good example.  The internationalization and localization section is brief, but provides a good enough explanation for getting started with internationalization.  Lastly, the chapter provides a brief overview HATEOAS (Hypermedia as the Engine of Application State), testing, and extensibility.

The final chapter does a good job of wrapping up the many topics of RESTful web services, discussing the future of REST and emerging standards.  It is a chapter that explains polling and the importance of providing real-time APIs for avoiding inefficiencies.  Along the way, it touches upon various topics, such as WebHooks, SSEs (Server Sent Events), and WebSockets, and how they relate to RESTful services.

The book contains a helpful Appendix which covers various APIs from GitHub, Facebook, and Twitter.  It is a nice closeout to the book, providing an overview of how to glean information from these important social media networks.

Overall, this book is a great read for getting started with RESTful web service creation and utilization with JAX-RS.  I enjoyed the fact that the book was authored by Bhakti, who is very experienced with the topic, as she is a founding member of the GlassFish Application Server.  I recommend this read for anyone who wants to get up and running quickly with REST, and also learn about various other RESTful concepts along the way.  While this book does not delve into fine-grained details of topics such as authentication and partial updates, it provides a good foundation for learning more on such topics.  Readers will go away from this book with a solid understanding of how to develop RESTful web services, and they will be able to start developing services after reading through the book.  Those who wish to delve into more advanced topics will be provided with a good overview after reading this book, and they'll be pointed into the right direction for learning more on such topics.

Sunday, November 23, 2014

NetBeans Tip: Working with JPQL

Have you heard of the NetBeans JPQL tool?  This is an often overlooked feature of NetBeans IDE that can save developers a lot of time.

If you are a Java EE developer, then you've likely encountered moments when you would like to see the results of a Java Persistence Query Language (JPQL) query before you've written your session bean method.  Being that I come from a database administrator background, I am oftentimes finding myself at the SQL command-line (or NetBeans SQL Editor) writing queries, and then translating the SQL into JPQL.  NetBeans IDE contains a JPQL tool (since NetBeans 7.3), which makes it easy to write JPQL queries and retrieve results immediately.  Let's see how:

The JPQL tool can be invoked within the context of a NetBeans project.  The project must have a valid Persistence Context, meaning that it is wired up for database access.  Once this is in-place, simply right click on the persistence.xml file, and click on the "Run JPQL Query" to open the tool.





















The tool provides a nice editor that provides a top pane for entering a query, and a bottom pane for showing the SQL or the results of the query execution.  If you have more than one Persistence Context within your persistence.xml, then you will have the option to select which context you would like to utilize for the query.












To execute the JPQL, simply click on the button next to the Persistence Context pull-down, or right click in the query editor and choose "Run JPQL".

The tool comes in super handy when you are executing queries that involve more than one entity.













Another handy reference for the tool, Geertjan's blog post:
https://blogs.oracle.com/geertjan/entry/test_jpql_with_netbeans_ide

Note:  Be sure to "Build" your project successfully before trying to use the JPQL tool.  If you do not have a successful build, you will likely encounter an error stating that the abstract schema type cannot be found:

Tuesday, November 04, 2014

Building and Testing JSF.next

The JSF 2.3 Expert Group is hard at work determining which features will be part of the upcoming release.  The JSF Team been working hard improving CDI alignment, among other things.  There are already a number of new features in the JSF 2.3 codebase that you can begin to test.  I will attempt to keep this post updated with the latest features that have been added.  For the most up-to-date reference, please see Manfred's blog.  To reference the information from Manfred's blog, take a look here.

JSF 2.3 Features

**Updated 04/2015:

 - PostRenderViewEvent added, which is published immediately after a view is rendered

    <f:event type="postRenderView" listener="#{managedBean.doPostProcessing}" />

 - Support java.lang.Iterable in UIData and UIRepeat
 - Support for java.util.Map in UIData and UIRepeat
 - Facelets hot reload will be off by default.
   In JSF 2.2 and prior, Facelets were set to refresh the cache periodically by default.
 - Injection into the following artifacts:
  •     javax.faces.convert.Converter
  •     javax.faces.validator.Validator
  •     javax.faces.component.behavior.Behavior
Arjan Tijms explains the enhancements for CDI injection and resolving of EL artifacts very well in his post on JSF 2.3.  
Below, I list the default producers that are part of JSF 2.3.  
(As per Arjan Tijms post:  What's New in JSF 2.3?)

In order to facilitate CDI injection, there will be default producers for the following:
  •  ViewRoot
  •  ViewMap (@ViewMap)
  •  RequestCookieMap (@RequestCookieMap)
  •  SessionMap (@SessionMap)
  •  ApplicationMap (@ApplicationMap)
  •  FacesContext
  •  ExternalContext
- CDI managed validator:
  @FacesValidator(value = "myValidator", managed = true)
  public class MyValidator implements Validator {
     @Inject
     MyModel model;
    ..
  }
- CDI managed converter:
  @FacesConverter(value = "myConverter", managed = true)
  public class MyConverter implements Converter {
    ..
  }
The features that have been added as of 11/4/2014 are as follows: - Inject @ViewMap
@ViewMap
@Inject
Map viewMap;
- #1333 - Support @Inject for UIViewRoot

@Inject
UIViewRoot viewRoot;
- #1332 - Let CDI handle #{view}
- #1331 - Let CDI handle #{application}
- #1254 - contracts attribute too restrictive.
- #1328 - Let CDI handle #{session} EL resolving
- #1325 - Let CDI handle #{applicationScope}
- #1311 - Let CDI handle #{facesContext} EL resolving
- #1323 - Support @Inject for the applicationMap

@ApplicationMap
@Inject
Map applicationMap;
- #1322 - Simplify #{externalContext} to use ExternalContextProducer
- #1309 - Support @Inject for ExternalContext

@Inject ExternalContext externalContext;
- #527 - Support @Inject for FacesContext

 @Inject FacesContext facesContext;
Please reference the JavaServer Faces JIRA for more information.

  * Be sure to test against one of the milestone releases before placing JIRA issues.

  Taking JSF 2.3 for a Test Spin

 If you would like to start testing out these new features today, the easiest way to get started is to simply download the 2.3 SNAPSHOT and then replace the javax.faces.jar file within your GlassFish/glassfish/modules directory with the snapshot. You will need to be sure to reference version 2.3 in your faces-config.xml. as follows:
<faces-config  version="2.3"
              xmlns="http://xmlns.jcp.org/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd">

</faces-config>
If you are adventurous and you would like to build JSF from source, that is also fairly simple.  To do so, follow these steps:
 1)  Check out the trunk using SVN: svn checkout --username yourname --password x https://svn.java.net/svn/mojarra~svn/trunk
 2)  Copy the build.properties.glassfish file to build.properties
 3)  Edit the build.properties file and set jsf.build.home to your source home.
 4)  From the source home, run ant clean main The jsf-api.jar will be in SOURCE_HOME/jsf-api/build/lib and jsf-impl.jar will be in SOURCE_HOME/jsf-ri/build/lib

For more information on building the sources (and even contributing), please see the following reference: https://wikis.oracle.com/display/GlassFish/JavaServerFacesRI#JavaServerFacesRI-HowcanIcontribute%3F

Note that there is also a repository on GitHub that is a mirror of the official SVN repository:  https://github.com/javaeekickoff/mojarra courtesy of the folks at OmniFaces.