DirectJNgine 1.2 final is out

Today I am releasing DirectJNgine 1.2 final. You can download it from http://code.google.com/p/directjngine/.

For detailed info, check the User’s Guide, which has been updated and has additional chapters devoted to the new functionality.

New in DJN 1.2: Support for stateful actions
It is possible to have session and application scoped actions, that will remember their state between requests.

To make an action stateful, use the @ActionScope annotation.

Take a look at the new chapter in the User’s Guide to get more information about stateful actions.

Sample code:


@ActionScope(scope=Scope.SESSION)
public class SessionStatefulActionTest {
  int count;
  String value;
  // ...
}

Once the SessionStatefulActionTest action is declared to be session scoped, it will be stored in the user session: this means that its count and value fields will be remembered across request belonging to the same user session.

New in DJN 1.2: Support for accessing the current session, etc. from within action methods
Now it is possible to get access to the current session, servlet context, servlet configuration, etc., from within action methods.
To do that, just use the new WebContext and WebContextManager classes.

Take a look at the new chapter in the User’s Guide to get more information about WebContext.

Sample code:


@DirectMethod
public WebContextInfo test_webContext() {
  WebContext context = WebContextManager.get();
  HttpSession session = context.getSession();
  ServletContext application = context.getServletContext();
    
  // Keep a counter of how many times we have called this method
  // in this session
  Integer callsInSession=(Integer)session.getAttribute("callsInSession");
  if( callsInSession == null ) {
    callsInSession = new Integer(0);
  }
  callsInSession = new Integer(callsInSession.intValue() + 1);
  session.setAttribute("callsInSession", callsInSession);

  // ...
}

You will probably find that using session/application scoped actions might be an easier way to accomplish your goals, though.

New in DJN 1.2: Support for multiple action instances
Now that actions can be stateful, it makes sense to have more than one action instance for a given Java class, each instance manging its own state.

Other additions/improvements

· All bugs reported against DJN 1.1 have been fixed.· We have added more tests, including those needed to ensure bug fixes work: we have crossed the one hundred automated tests barrier!

· We have moved to ExtJs 3.1.1 for testing to ensure that we remain up to date. While 3.1 and 3.0 should work fine, the “officially” supported version will be 3.1.1.

· Licensing has been “fixed”: we are LGPL v3 -the way it was intended to be from the beginning.

Code breaking changes
· The programmatic API has been modified so that poll methods belong to actions, instead of being global. This was a must to support stateful actions.

· The suggested workaround for handling “\n” and “\r” characters in DJN 1.1 does not work anymore: instead you should pass them “as-is”.

Tested browsers
· Internet Explorer 8 (8.0.6001.18702)

· Firefox 3.5.6 (Gecko 20100115)

· Safari 4.0.4 (531.21.10)

· Google Chrome 4.0.249.89

To all, thank you for your encouragement and criticism: I hope this new release of DJN helps you make bettter software.

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s