Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.directwebremoting.hibernate
Class H3SessionAjaxFilter

    java.lang.Object
      org.directwebremoting.hibernate.H3SessionAjaxFilter

All Implemented Interfaces:
  AjaxFilter

    public class H3SessionAjaxFilter

extends java.lang.Object
implements AjaxFilter

An `AjaxFilter` that uses DWR Hibernate support classes to do a `Session.beginTransaction()` before passing the control on to the chain and a `Transaction.commit()` after.

Author:
  Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
`H3SessionAjaxFilter()`

Method Summary
`java.lang.Object` | `doFilter(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object[] params, AjaxFilterChain chain)` The `doFilter` method of the AjaxFilter is called by DWR each time an Ajax request is made on a method that this filter is configured against.
`static org.hibernate.Session` | `getCurrentSession(javax.servlet.ServletContext context)` Get access to a Session, given the `SessionFactory` linked in `setSessionFactory(ServletContext, SessionFactory)`
`static void` | `setSessionFactory(javax.servlet.ServletContext context, org.hibernate.SessionFactory sessionFactory)` Assigns a `SessionFactory` to a `ServletContext` so DWR knows how to get hold of a `Session`.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### H3SessionAjaxFilter

    public H3SessionAjaxFilter()

Method Detail

### doFilter

    public java.lang.Object doFilter(java.lang.Object object,
                                     java.lang.reflect.Method method,
                                     java.lang.Object[] params,
                                     AjaxFilterChain chain)
                              throws java.lang.Exception

  Description copied from interface: `AjaxFilter`
  The `doFilter` method of the AjaxFilter is called by DWR each time an Ajax request is made on a method that this filter is configured against. The `AjaxFilterChain`passed in to this method allows the filter to pass on method details to next entity in the chain.

  Typically the method would do the following:

  1. Examine the request
  2. Optionally alter the method, object or parameters
  3. Either invoke the next entity in the chain using the AjaxFilterChain or decide to take some other action instead.
  4. Optionally modify the value returned to the user
  5. Take some other action (e.g. logging)

  ``
  Specified by:
    `doFilter` in interface `AjaxFilter`
  Parameters:
    `object` - The object to execute the method on (i.e. 'this')
    `method` - The method to execute
    `params` - The parameters to the method call
    `chain` - Allow the request to be passed on
  Returns:
    The results of the method execution
  Throws:
    `java.io.IOException` - When some I/O error occurs
    `java.lang.Exception` - When some processing goes wrong

### setSessionFactory

    public static void setSessionFactory(javax.servlet.ServletContext context,
                                         org.hibernate.SessionFactory sessionFactory)

  Assigns a `SessionFactory` to a `ServletContext` so DWR knows how to get hold of a `Session`.

  Parameters:
    `context` - The Servlet environment to store the ServletContext in
    `sessionFactory` - The Hibernate session factory to register

### getCurrentSession

    public static org.hibernate.Session getCurrentSession(javax.servlet.ServletContext context)

  Get access to a Session, given the `SessionFactory` linked in `setSessionFactory(ServletContext, SessionFactory)`

  Parameters:
    `context` - The webapp to link the calls together
  Returns:
    A Session from the `SessionFactory` or null if `setSessionFactory(ServletContext, SessionFactory)` has not been called for this `ServletContext`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¬ 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD