Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.collab.exchange.webdav
Interface IWebdavSession

All Superinterfaces:
  IExchangeSession, IGroupwareSession, ISession, java.io.Serializable

public interface IWebdavSession
extends IExchangeSession

Provides access to the WebDAV provider. This interface contains the information required to open a WebDAV session. WebDAV sessions can be opened using multiple authentication techniques. Each scheme has its own set of required and optional properties. The following table lists the WebDAV specific properties and whether they are always required, always optional, or dependent on other properties.

Property | Required | Additional Information
`PROP_WEBDAV_AUTH` | Yes | The authentication to use when connecting to an Exchange server. Supported authentication schemes are `WEBDAV_AUTH_PROTOCOL_BASIC`, `WEBDAV_AUTH_PROTOCOL_NTLM`, `WEBDAV_AUTH_PROTOCOL_FORMS_BASED`, and `WEBDAV_AUTH_PROTOCOL_TOKEN`. If no authentication is chosen, NTLM authentication is used. Forms-Based authentication requires SSL connections over `WEBDAV_PROTOCOL_HTTPS`
`PROP_WEBDAV_PROTOCOL` | No | The protocol to use when connecting to the port specified by `PROP_WEBDAV_PORT`. The two supported protocols are `WEBDAV_PROTOCOL_HTTP` and `WEBDAV_PROTOCOL_HTTPS`. If no protocol is chosen, HTTP will be used by default.
`PROP_WEBDAV_PORT` | No | The port of the Exchange server to connect to. If not specified, the default port of the chosen protocol is used.
`PROP_WEBDAV_EXCHANGE_ROOT` | No | The root context of the Exchange virtual server under IIS. The context is used when connecting to `http://server/context/user.mailbox`. If not specified, the default Exchange context is used.
`PROP_WEBDAV_AD_SERVER` | Dependant | The LDAP server that can be used to query Active Directory. This property is not required unless Global Address List functionality is required or the home server and/or the Exchange alias is not specified
`PROP_WEBDAV_AD_USER_USERNAME` | Dependant | The LDAP username that can be used to query Active Directory. See notes for `PROP_WEBDAV_AD_SERVER`.
`PROP_WEBDAV_AD_USER_PASSWORD` | Dependant | The LDAP user password that can be used to query Active Directory. See notes for `PROP_WEBDAV_AD_SERVER`.
`PROP_WEBDAV_AD_USER_DOMAIN` | Dependant | The LDAP user domain that can be used to query Active Directory. See notes for `PROP_WEBDAV_AD_SERVER`.
`PROP_WEBDAV_AD_VERSION` | Dependant | The LDAP version that can be used to query Active Directory. See notes for `PROP_WEBDAV_AD_SERVER`.
`PROP_WEBDAV_AD_REFERRAL` | Dependant | The LDAP referral policy that can be used to query Active Directory. Valid values are `follow`, `ignore` or `throw`. See notes for `PROP_WEBDAV_AD_SERVER`.

- Authentication Type `WEBDAV_AUTH_PROTOCOL_TOKEN`. When using this authentication type, the following properties are ignored. They can be set, however, if GAL functionality or Exchange server/alias lookup is required.
  - `IExchangeSession.PROP_USER_USERNAME`
  - `IExchangeSession.PROP_USER_PASSWORD`
  - `IExchangeSession.PROP_USER_DOMAIN`

- Authentication Types `WEBDAV_AUTH_PROTOCOL_NTLM`, `WEBDAV_AUTH_PROTOCOL_FORMS_BASED`, and `WEBDAV_AUTH_PROTOCOL_BASIC`. When using these authentication types the following properties are required.
  - `IExchangeSession.PROP_USER_USERNAME`
  - `IExchangeSession.PROP_USER_PASSWORD`
  - `IExchangeSession.PROP_USER_DOMAIN`

Additional provider properties can be specified using the following values:

- "`trust.store`": When using the `WEBDAV_PROTOCOL_HTTPS` protocol to connect to the Exchange server, this property will control how server certificates are trusted. By default, this value is not set, allowing any certificate that is not expired to be trusted by the client. The client can choose to set this property to the location of their trust store file. When the property is set, certificates must be manually trusted into the Java Virtual Machine's trust store in order for them to validate.
- "`trust.password`": When using the `trust.store` property to specify a custom trust store, this property is used to provide the password to the store in order to access the certificates. If there is no password on the store, then this property can be left unset.

The following code shows how to open a session in the Exchange WebDAV provider.

Sample code:

    /**
     * The <code>openSession</code> method demonstrates how to open a session with
     * the WebDAV provider.
     *
     * @return  a session that has been successfully opened with the supplied
     *          user credentials.
     * @throws  CollaborationException  if the session factory could not instantiate
     *          a session with the given parameters.
     */
    public  ISession    openSession
    (
    )
    throws  CollaborationException
        {
        IExchangeSession session = null;

        Properties p = new Properties();
        p.setProperty( ISession.PROP_PROVIDER, IWebdavSession.INTERNAL_NAME );
        p.setProperty( IWebdavSession.PROP_USER_DOMAIN, "domain" );
        p.setProperty( IWebdavSession.PROP_USER_USERNAME, "username" );
        p.setProperty( IWebdavSession.PROP_USER_PASSWORD, "password" );
        p.setProperty( IWebdavSession.PROP_EXCHANGE_SERVER, "server" );
        p.setProperty( IWebdavSession.PROP_EXCHANGE_MAILBOX, "mailbox" );

        // additionally the following properties can be specified in case you need
        // to customize the webdav session. For a complete list of properties,
        // consult the <code>IWebdavSession</code> javadoc.

        /*
        // sets the exchange server port
        p.setProperty( IWebdavSession.PROP_WEBDAV_PORT, "8080" );

        // sets the exchange server protocol
        p.setProperty(  IWebdavSession.PROP_WEBDAV_PROTOCOL,
                        IWebdavSession.WEBDAV_PROTOCOL_HTTPS );

        // sets the exchange server authentication type
        p.setProperty(  IWebdavSession.PROP_WEBDAV_AUTH,
                        IWebdavSession.WEBDAV_AUTH_PROTOCOL_FORMS_BASED );

        // sets the active directory ldap server (usually the domain controller)
        p.setProperty( IWebdavSession.PROP_WEBDAV_AD_SERVER, "domainController" );

        // sets the default exchange root on the server
        p.setProperty( IWebdavSession.PROP_WEBDAV_EXCHANGE_ROOT, "/exch/" );
        */

        session = (IExchangeSession)SessionFactory.createSession( p );
        try
            {
            session.open();
            session.login();

            // at this point the session is ready to be used.

            session.logout();
            session.close();
            }
        catch( CollaborationException ce )
            {
            ce.printStackTrace();
            }

        // return the session
        return session;
        }

The following code shows how to open a session using an authentication token in the Exchange WebDAV provider.

Sample code:

    /**
     * The <code>openSession</code> method demonstrates how to open a session with
     * the WebDAV provider using the authentication token schenme.
     *
     * @return  a session that has been successfully opened with the supplied
     *          user credentials.
     * @throws  CollaborationException  if the session factory could not instantiate
     *          a session with the given parameters.
     */
    public  void    openSessionWithToken
    (
    )
    throws  CollaborationException
        {
        IExchangeSession session = null;

        Properties p = new Properties();
        p.setProperty( ISession.PROP_PROVIDER, IWebdavSession.INTERNAL_NAME );
        p.setProperty( IWebdavSession.PROP_EXCHANGE_SERVER, "server.domain.company.com" );
        p.setProperty( IWebdavSession.PROP_EXCHANGE_MAILBOX, "mailbox" );
        p.setProperty( IWebdavSession.PROP_WEBDAV_AUTH, IWebdavSession.WEBDAV_AUTH_PROTOCOL_TOKEN );

        session = (IExchangeSession)SessionFactory.createSession( p );

        // set cookie
        session.setAuthorizationValue( "SMSESSION",
            "JfM6kqWXAYXIGGA8DxODDAkBP6Z6Ni4/gJ+QdyaBzCCUslKQ/DyXB0bnwR" );

        try
            {
            session.open();
            session.login();

            // at this point the session is ready to be used.

            // you can extract the last token received from the server
            String sLastToken = session.getAuthorizationValue( "SMSESSION" );

            session.logout();
            session.close();
            }
        catch( CollaborationException ce )
            {
            ce.printStackTrace();
            }
        }

The following code shows how to manipulate the trust store provider properties in order to specify a trust store for server-side SSL certificates.

Sample code:

    /**
     * The <code>setProviderProperties</code> method sets provider properties
     * on the WebDAV provider. Provider properties can be defined at runtime
     * via the <code>IProvider.setProviderProperty(String,String)</code> method,
     * or statically through the collab.xml file.
     *
     * @throws  CollaborationException  if the session could not be opened.
     */
    public  void    setProviderProperties
    (
    )
    throws  CollaborationException
        {
        IExchangeSession session = null;

        // setup the session properties
        Properties p = new Properties();
        p.setProperty( ISession.PROP_PROVIDER, IWebdavSession.INTERNAL_NAME );
        p.setProperty( IWebdavSession.PROP_USER_DOMAIN, "domain" );
        p.setProperty( IWebdavSession.PROP_USER_USERNAME, "username" );
        p.setProperty( IWebdavSession.PROP_USER_PASSWORD, "password" );
        p.setProperty( IWebdavSession.PROP_EXCHANGE_SERVER, "server" );
        p.setProperty( IWebdavSession.PROP_EXCHANGE_MAILBOX, "mailbox" );
        p.setProperty( IWebdavSession.PROP_WEBDAV_PROTOCOL, IWebdavSession.WEBDAV_PROTOCOL_HTTPS );
        p.setProperty( IWebdavSession.PROP_WEBDAV_PORT, "443" );

        // create the session
        session = (IExchangeSession)SessionFactory.createSession( p );
        IProvider provider = session.getProvider();

        // the provider properties
        String sStore = "c:\\java\\jdk1.3.1\\jre\\lib\\security\\cacerts";
        String sPassword = "changeit";

        // set the provider properties on the provider
        provider.setProviderProperty( "trust.store", sStore );
        provider.setProviderProperty( "trust.password", sPassword );

        session.open();
        session.login();

        // at this point the session is ready to be used.

        session.logout();
        session.close();
        }

Field Summary
`static java.lang.String` | `INTERNAL_NAME` This constant may be used to open a session as the value for the `ISession.PROP_PROVIDER` property.
`static java.lang.String` | `PROP_WEBDAV_AD_PORT` Property that indicates the LDAP port to use when querying Active Directory
`static java.lang.String` | `PROP_WEBDAV_AD_REFERRAL` Property that indicates the LDAP version to use when querying Active Directory
`static java.lang.String` | `PROP_WEBDAV_AD_SERVER` Property that indicates the LDAP server to use when querying Active Directory
`static java.lang.String` | `PROP_WEBDAV_AD_USER_DOMAIN` Property that indicates the LDAP username to use when querying Active Directory
`static java.lang.String` | `PROP_WEBDAV_AD_USER_PASSWORD` Property that indicates the LDAP username to use when querying Active Directory
`static java.lang.String` | `PROP_WEBDAV_AD_USER_USERNAME` Property that indicates the LDAP username to use when querying Active Directory
`static java.lang.String` | `PROP_WEBDAV_AD_VERSION` Property that indicates the LDAP version to use when querying Active Directory
`static java.lang.String` | `PROP_WEBDAV_AUTH` Property that indicates the authorization protocol for the server running WebDAV.
`static java.lang.String` | `PROP_WEBDAV_EXCHANGE_ROOT` Property that indicates the root directory used for exchange (default `exchange`).
`static java.lang.String` | `PROP_WEBDAV_PORT` Property that indicates the port of the server running WebDAV.
`static java.lang.String` | `PROP_WEBDAV_PROTOCOL` Property that indicates the protocol to use when using WebDAV ("http" or "https").
`static java.lang.String` | `WEBDAV_AUTH_PROTOCOL_BASIC` Property value for Basic authentication ("basic").
`static java.lang.String` | `WEBDAV_AUTH_PROTOCOL_FORMS_BASED` Property value for Forms-Based authentication ("forms_based")
`static java.lang.String` | `WEBDAV_AUTH_PROTOCOL_NTLM` Property value for NTLM authentication ("ntlm")
`static java.lang.String` | `WEBDAV_AUTH_PROTOCOL_TOKEN` Property value for session cookie authentication ("token").
`static java.lang.String` | `WEBDAV_DEFAULT_PORT` Property value for the default http port ("80").
`static java.lang.String` | `WEBDAV_DEFAULT_SSL_PORT` Property value for the default ssl port ("443").
`static java.lang.String` | `WEBDAV_PROTOCOL_HTTP` Property value for http protocol ("http").
`static java.lang.String` | `WEBDAV_PROTOCOL_HTTPS` Property value for https protocol ("https").

Fields inherited from interface com.compoze.collab.exchange.IExchangeSession
`PROP_EXCHANGE_MAILBOX, PROP_EXCHANGE_SERVER, PROP_PROXY_HOST, PROP_PROXY_PASSWORD, PROP_PROXY_PORT, PROP_PROXY_PROTOCOL, PROP_PROXY_USER, PROP_USER_DOMAIN, PROP_USER_PASSWORD, PROP_USER_USERNAME`

Fields inherited from interface com.compoze.collab.ISession
`PROP_ADMIN_LOCALE, PROP_AUTO_FETCH, PROP_CACHE_DEPENDENCY_CHECK_MILLIS, PROP_CACHE_ENABLED, PROP_CACHE_QUERY_MAX, PROP_CACHE_UPDATE_MILLIS, PROP_CACHE_USE_SOFT_REFERENCES, PROP_LOCALE, PROP_LOG_LEVEL, PROP_PROGRAMMER_LOCALE, PROP_PROVIDER, PROP_SCHEMA, PROPVALUE_REMOVE, STATE_AUTHENTICATED, STATE_INITIALIZED, STATE_OPEN, STATE_UNINITIALIZED`

Methods inherited from interface com.compoze.collab.exchange.IExchangeSession
`getAddressEntry, getAddressEntry, getAuthorizationValue, getDefaultContainer, publishFreeBusy, setAuthorizationValue`

Methods inherited from interface com.compoze.collab.groupware.IGroupwareSession
`getCalendar, getDefaultContainer, getDefaultContainer, getRootContainer, getRootContainer, getTimeZone, getTimeZone, setTimeZone`

Methods inherited from interface com.compoze.collab.ISession
`addLogListener, close, endProfile, endTimer, endTimer, getAdminLocale, getAttribute, getDefaultRootContainer, getDefaultRootContainer, getLocale, getLogLevel, getOption, getOptions, getProgrammerLocale, getProperty, getProvider, getState, invalidateCache, isCapabilitySupported, log, login, login, logout, open, open, removeAttribute, setAdminLocale, setAttribute, setLocale, setLogLevel, setOption, setOptions, setProgrammerLocale, startProfile, startProfile, startTimer, startTimer`

Field Detail

### INTERNAL_NAME

    public static final java.lang.String INTERNAL_NAME

  This constant may be used to open a session as the value for the `ISession.PROP_PROVIDER` property.

### PROP_WEBDAV_PORT

    public static final java.lang.String PROP_WEBDAV_PORT

  Property that indicates the port of the server running WebDAV.
  See Also:
    `WEBDAV_DEFAULT_PORT`, `WEBDAV_DEFAULT_SSL_PORT`

### PROP_WEBDAV_PROTOCOL

    public static final java.lang.String PROP_WEBDAV_PROTOCOL

  Property that indicates the protocol to use when using WebDAV ("http" or "https").
  See Also:
    `WEBDAV_PROTOCOL_HTTP`, `WEBDAV_PROTOCOL_HTTPS`

### PROP_WEBDAV_AUTH

    public static final java.lang.String PROP_WEBDAV_AUTH

  Property that indicates the authorization protocol for the server running WebDAV.
  See Also:
    `WEBDAV_AUTH_PROTOCOL_BASIC`, `WEBDAV_AUTH_PROTOCOL_NTLM`

### PROP_WEBDAV_EXCHANGE_ROOT

    public static final java.lang.String PROP_WEBDAV_EXCHANGE_ROOT

  Property that indicates the root directory used for exchange (default `exchange`).

### PROP_WEBDAV_AD_SERVER

    public static final java.lang.String PROP_WEBDAV_AD_SERVER

  Property that indicates the LDAP server to use when querying Active Directory

### PROP_WEBDAV_AD_PORT

    public static final java.lang.String PROP_WEBDAV_AD_PORT

  Property that indicates the LDAP port to use when querying Active Directory

### PROP_WEBDAV_AD_USER_USERNAME

    public static final java.lang.String PROP_WEBDAV_AD_USER_USERNAME

  Property that indicates the LDAP username to use when querying Active Directory

### PROP_WEBDAV_AD_USER_PASSWORD

    public static final java.lang.String PROP_WEBDAV_AD_USER_PASSWORD

  Property that indicates the LDAP username to use when querying Active Directory

### PROP_WEBDAV_AD_USER_DOMAIN

    public static final java.lang.String PROP_WEBDAV_AD_USER_DOMAIN

  Property that indicates the LDAP username to use when querying Active Directory

### PROP_WEBDAV_AD_VERSION

    public static final java.lang.String PROP_WEBDAV_AD_VERSION

  Property that indicates the LDAP version to use when querying Active Directory

### PROP_WEBDAV_AD_REFERRAL

    public static final java.lang.String PROP_WEBDAV_AD_REFERRAL

  Property that indicates the LDAP version to use when querying Active Directory

### WEBDAV_PROTOCOL_HTTP

    public static final java.lang.String WEBDAV_PROTOCOL_HTTP

  Property value for http protocol ("http").

### WEBDAV_PROTOCOL_HTTPS

    public static final java.lang.String WEBDAV_PROTOCOL_HTTPS

  Property value for https protocol ("https").

### WEBDAV_AUTH_PROTOCOL_BASIC

    public static final java.lang.String WEBDAV_AUTH_PROTOCOL_BASIC

  Property value for Basic authentication ("basic").
  See Also:
    `PROP_WEBDAV_AUTH`

### WEBDAV_AUTH_PROTOCOL_NTLM

    public static final java.lang.String WEBDAV_AUTH_PROTOCOL_NTLM

  Property value for NTLM authentication ("ntlm")
  See Also:
    `PROP_WEBDAV_AUTH`

### WEBDAV_AUTH_PROTOCOL_FORMS_BASED

    public static final java.lang.String WEBDAV_AUTH_PROTOCOL_FORMS_BASED

  Property value for Forms-Based authentication ("forms_based")
  See Also:
    `PROP_WEBDAV_AUTH`, `PROP_WEBDAV_PROTOCOL`, `WEBDAV_PROTOCOL_HTTPS`

### WEBDAV_AUTH_PROTOCOL_TOKEN

    public static final java.lang.String WEBDAV_AUTH_PROTOCOL_TOKEN

  Property value for session cookie authentication ("token").
  See Also:
    `PROP_WEBDAV_AUTH`

### WEBDAV_DEFAULT_PORT

    public static final java.lang.String WEBDAV_DEFAULT_PORT

  Property value for the default http port ("80").

### WEBDAV_DEFAULT_SSL_PORT

    public static final java.lang.String WEBDAV_DEFAULT_SSL_PORT

  Property value for the default ssl port ("443").

Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ©1999-2005 Compoze Software, Inc. All rights reserved.