org.apache.cayenne.remote.hessian

## Class HessianConnection

- java.lang.Object
- - org.apache.cayenne.remote.BaseConnection
  - - org.apache.cayenne.remote.hessian.HessianConnection

- All Implemented Interfaces:
    ClientConnection

      public class HessianConnection
      extends BaseConnection

  An ClientConnection that passes messages to a remotely deployed HessianService. It supports HTTP BASIC authentication. HessianConnection serializes messages using Hessian binary web service protocol over HTTP. For more info on Hessian see Caucho site at http://www.caucho.com/resin-3.0/protocols/hessian.xtp. HessianConnection supports logging of message traffic via Jakarta commons-logging API.
  Since:
    1.2

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String[]` | `CLIENT_SERIALIZER_FACTORIES`
    `protected String` | `password`
    `protected com.caucho.hessian.io.SerializerFactory` | `serializerFactory`
    `protected RemoteService` | `service`
    `protected RemoteSession` | `session`
    `protected String` | `sharedSessionName`
    `protected String` | `url`
    `protected String` | `userName`

    - ### Fields inherited from class org.apache.cayenne.remote.BaseConnection

      `messageId, readTimeout`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HessianConnection(String url)` Creates HessianConnection that will establish dedicated session and will not use HTTP basic authentication.
    `HessianConnection(String url, String userName, String password, String sharedSessionName)` Creates a HessianConnection.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `beforeSendMessage(ClientMessage message)` Establishes server session if needed.
    `protected void` | `connect()` Establishes a session with remote service.
    `protected Object` | `doSendMessage(ClientMessage message)` Sends a message to remote Cayenne Hessian service.
    `String` | `getPassword()` Returns password that is used for basic authentication when connecting to the cayenne server.
    `com.caucho.hessian.io.SerializerFactory` | `getSerializerFactory()`
    `EventBridge` | `getServerEventBridge()` Returns an EventBridge that receives remote server events.
    `RemoteSession` | `getSession()` Returns internal RemoteSession instance.
    `String` | `getSharedSessionName()`
    `String` | `getUrl()` Returns a URL of Cayenne service used by this connector.
    `String` | `getUserName()` Returns user name that is used for basic authentication when connecting to the cayenne server.

    - ### Methods inherited from class org.apache.cayenne.remote.BaseConnection

      `getProcessedMessagesCount, getReadTimeout, sendMessage, setReadTimeout`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CLIENT_SERIALIZER_FACTORIES

          public static final String[] CLIENT_SERIALIZER_FACTORIES

    - #### url

          protected String url

    - #### userName

          protected String userName

    - #### password

          protected String password

    - #### sharedSessionName

          protected String sharedSessionName

    - #### session

          protected RemoteSession session

    - #### service

          protected RemoteService service

    - #### serializerFactory

          protected com.caucho.hessian.io.SerializerFactory serializerFactory

  - ### Constructor Detail

    - #### HessianConnection

          public HessianConnection(String url)

      Creates HessianConnection that will establish dedicated session and will not use HTTP basic authentication.

    - #### HessianConnection

          public HessianConnection(String url,
                           String userName,
                           String password,
                           String sharedSessionName)

      Creates a HessianConnection. This constructor can optionally setup basic authentication credentials and configure shared session. `url` is the only required parameter.

  - ### Method Detail

    - #### getUrl

          public String getUrl()

      Returns a URL of Cayenne service used by this connector.

    - #### getUserName

          public String getUserName()

      Returns user name that is used for basic authentication when connecting to the cayenne server.

    - #### getPassword

          public String getPassword()

      Returns password that is used for basic authentication when connecting to the cayenne server.

    - #### getSharedSessionName

          public String getSharedSessionName()

    - #### getServerEventBridge

          public EventBridge getServerEventBridge()
                                           throws CayenneRuntimeException

      Description copied from interface: `ClientConnection`
      Returns an EventBridge that receives remote server events. Caller would normally register returned bridge with a local EventManager, thus allowing local listeners to receive server events.
      Returns:
        An EventBridge or null if server events are not supported.
      Throws:
        `CayenneRuntimeException`

    - #### getSession

          public RemoteSession getSession()

      Returns internal RemoteSession instance.

    - #### beforeSendMessage

          protected void beforeSendMessage(ClientMessage message)
                                    throws CayenneRuntimeException

      Establishes server session if needed.
      Specified by:
        `beforeSendMessage` in class `BaseConnection`
      Throws:
        `CayenneRuntimeException`

    - #### doSendMessage

          protected Object doSendMessage(ClientMessage message)
                                  throws CayenneRuntimeException

      Sends a message to remote Cayenne Hessian service.
      Specified by:
        `doSendMessage` in class `BaseConnection`
      Throws:
        `CayenneRuntimeException`

    - #### connect

          protected void connect()
                          throws CayenneRuntimeException

      Establishes a session with remote service.
      Throws:
        `CayenneRuntimeException`

    - #### getSerializerFactory

          public com.caucho.hessian.io.SerializerFactory getSerializerFactory()

Copyright © 2001–2014 Apache Cayenne. All rights reserved.