com.esri.wms.client
Class ServerConnection

java.lang.Object
  extended by com.esri.wms.client.ServerConnection
All Implemented Interfaces:
Serializable

public class ServerConnection
extends Object
implements Serializable

ServerConnection is an entry point of the client API. You need to instantiate ServerConnection to get WMS server capabilities information.

 ServerConnection server = new ServerConnection("http://host:8399/arcgis/services/usa_n/MapServer/WMSServer",
     ServerConnection.SPEC_VER_1_1_1);
 
For an unknow server, the ServerConnect will look up for the highest version server supporting.
 ServerConnection server = new ServerConnection("http://host:8399/arcgis/services/usa_n/MapServer/WMSServer");
 System.out.println(server.getServerVersion());
 

See Also:
Serialized Form

Field Summary
static SpatialReference DEFAULT_REF
          The default spatial reference if not specified in the server.
protected  SpatialReference defaultMapRef
          The default spatial reference of the maps associated with this server.
static String ENCODER_CHAR
          The name of the default character encoding of the URLEncoder.
static String SPEC_VER_1_0_0
          WMS version 1.0.0
static String SPEC_VER_1_1_0
          WMS version 1.1.0
static String SPEC_VER_1_1_1
          WMS version 1.1.1
static String SPEC_VER_1_3_0
          WMS version 1.3.0
static String[] supportedVersion
          All supported versions.
 
Constructor Summary
ServerConnection()
          Instantiates an empty ServerConnection.
ServerConnection(String serverURL)
          Instantiates an object of ServerConnection.
ServerConnection(String serverURL, String version)
          Instantiates an object of ServerConnection with the given version.
ServerConnection(String serverURL, String version, RequestHandler handler)
          Instantiates an object of ServerConnection with a given RequestHandler.
 
Method Summary
 void connect(String serverURL, String version)
          Connects this server to the given URL.
 List<String> getCapabilitiesFormats()
          Gets the response formats of the GetCapabilities operation supported by the server.
 String getCapabilitiesServiceURL()
          Gets the URL of the GetCapabilities service.
 String getExceptionFormat()
          Gets the format of exceptions for the communication.
 List<String> getExceptionFormats()
          Gets the all formats of exceptions supported by the server.
 List<String> getFeatureInfoFormats()
          Gets the response formats of the GetFeatureInfo operation supported by the server.
 String getFeatureInfoServiceURL()
          Gets the URL of the GetFeatureInfo service.
 String getHttpReferrer()
          Returns the HTTP Referrer URL.
static Level getLoggerLevel()
          Gets the logger level of the API.
 List<String> getMapFormats()
          Gets the response formats of the GetMap operation supported by the server.
 String getMapServiceURL()
          Gets the URL of the GetMap service.
 String getPassword()
          Returns the password used for the connection.
 RequestHandler getRequestHandler()
          Gets the request handler associated with the ServerConnection.
 String getServerAbstract()
          Gets the abstract of the server.
 String getServerName()
          Gets the server name.
 String getServerTitle()
          Gets the title of the server.
 String getServerURL()
          Gets the URL of the WMS Server.
 String getServerVersion()
          Gets the highest version the server supported.
 String getUserName()
          Returns the userName used for the connection.
 String getVersion()
          Gets the version of the server.
 void setExceptionFormat(String exceptionFormat)
          Sets the format of exception for the communication.
 void setHttpReferrer(String httpReferrer)
          Sets the HTTP Referrer URL used while connecting WMS Service.
static void setLoggerLevel(Level newLevel)
          Sets the logger level of the API.
 void setPassword(String password)
          Sets password while connecting WMS Service.
 void setRequestHandler(RequestHandler requestHandler)
          Overrides the default RequestHandler with the given one.
protected  void setServerVersion(String serverVersion)
          Sets the version to which the instance connect.
 void setUserName(String userName)
          Sets username while connecting WMS Service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPEC_VER_1_0_0

public static final String SPEC_VER_1_0_0
WMS version 1.0.0

See Also:
Constant Field Values

SPEC_VER_1_1_0

public static final String SPEC_VER_1_1_0
WMS version 1.1.0

See Also:
Constant Field Values

SPEC_VER_1_1_1

public static final String SPEC_VER_1_1_1
WMS version 1.1.1

See Also:
Constant Field Values

SPEC_VER_1_3_0

public static final String SPEC_VER_1_3_0
WMS version 1.3.0

See Also:
Constant Field Values

supportedVersion

public static String[] supportedVersion
All supported versions.


ENCODER_CHAR

public static String ENCODER_CHAR
The name of the default character encoding of the URLEncoder. The default is "UTF-8".


DEFAULT_REF

public static SpatialReference DEFAULT_REF
The default spatial reference if not specified in the server.


defaultMapRef

protected SpatialReference defaultMapRef
The default spatial reference of the maps associated with this server. It is specified by the server.

Constructor Detail

ServerConnection

public ServerConnection()
Instantiates an empty ServerConnection.


ServerConnection

public ServerConnection(String serverURL)
                 throws ServiceException,
                        IOException
Instantiates an object of ServerConnection. The server connection will look up the highest version the server supported.

Parameters:
serverURL - the server URL, e.g. "http://host:port/wmsserver".
Throws:
ServiceException
IOException

ServerConnection

public ServerConnection(String serverURL,
                        String version)
                 throws ServiceException,
                        IOException
Instantiates an object of ServerConnection with the given version.

Parameters:
serverURL - the server URL, e.g. "http://host:port/wmsserver/".
version - the version string, e.g. ServerConnection.SPEC_VER_1_3_0.
Throws:
ServiceException
IOException

ServerConnection

public ServerConnection(String serverURL,
                        String version,
                        RequestHandler handler)
                 throws ServiceException,
                        IOException
Instantiates an object of ServerConnection with a given RequestHandler.
 RequestHandler handler = RequestHandler.getDefaultInstance();
 RequestListener l = new RequestListener() {
     public String createRequest(Service service, String request) {
        ....
        return request;
     }
 };
 handler.setRequestListener(l);
 
 ServerConnection server = new ServerConnection("http://host/service",null,handler);
 

Parameters:
serverURL - the server URL, e.g. "http://host:port/wmsserver/".
version - the version string, e.g. ServerConnection.SPEC_VER_1_3_0.
handler - the handler to override the default one.
Throws:
ServiceException
IOException
Method Detail

connect

public void connect(String serverURL,
                    String version)
             throws IOException
Connects this server to the given URL.

Parameters:
serverURL - the server URL, e.g. "http://host:port/wmsserver/".
version - the version string, e.g. ServerConnection.SPEC_VER_1_3_0.
Throws:
IOException

getServerURL

public String getServerURL()
Gets the URL of the WMS Server.


getVersion

public String getVersion()
Gets the version of the server.


getRequestHandler

public RequestHandler getRequestHandler()
Gets the request handler associated with the ServerConnection.


setRequestHandler

public void setRequestHandler(RequestHandler requestHandler)
Overrides the default RequestHandler with the given one.


getCapabilitiesFormats

public List<String> getCapabilitiesFormats()
Gets the response formats of the GetCapabilities operation supported by the server.


getFeatureInfoFormats

public List<String> getFeatureInfoFormats()
Gets the response formats of the GetFeatureInfo operation supported by the server.


getMapFormats

public List<String> getMapFormats()
Gets the response formats of the GetMap operation supported by the server.


getServerAbstract

public String getServerAbstract()
Gets the abstract of the server.


getServerName

public String getServerName()
Gets the server name.


getServerTitle

public String getServerTitle()
Gets the title of the server.


getServerVersion

public String getServerVersion()
Gets the highest version the server supported.


getExceptionFormat

public String getExceptionFormat()
Gets the format of exceptions for the communication.


setExceptionFormat

public void setExceptionFormat(String exceptionFormat)
Sets the format of exception for the communication. By default it is null.


getExceptionFormats

public List<String> getExceptionFormats()
Gets the all formats of exceptions supported by the server.


getFeatureInfoServiceURL

public String getFeatureInfoServiceURL()
Gets the URL of the GetFeatureInfo service.


getMapServiceURL

public String getMapServiceURL()
Gets the URL of the GetMap service.


getCapabilitiesServiceURL

public String getCapabilitiesServiceURL()
Gets the URL of the GetCapabilities service.


setServerVersion

protected void setServerVersion(String serverVersion)
Sets the version to which the instance connect.


setHttpReferrer

public void setHttpReferrer(String httpReferrer)
Sets the HTTP Referrer URL used while connecting WMS Service. By default it is null.

Parameters:
httpReferrer - the HTTP Referrer URL

getHttpReferrer

public String getHttpReferrer()
Returns the HTTP Referrer URL.

Returns:
the HTTP Referrer URL.

getLoggerLevel

public static Level getLoggerLevel()
Gets the logger level of the API.


setLoggerLevel

public static void setLoggerLevel(Level newLevel)
Sets the logger level of the API.


getUserName

public String getUserName()
Returns the userName used for the connection.

Returns:
the userName.

setUserName

public void setUserName(String userName)
Sets username while connecting WMS Service. This is only supported when using HttpClientConnectionChannelImpl You can change the connection.properties file and have it in the classpath or classes folder of the web application to override the http connection channel.

Parameters:
userName - userName for connecting to the resource.

getPassword

public String getPassword()
Returns the password used for the connection.

Returns:
the password.

setPassword

public void setPassword(String password)
Sets password while connecting WMS Service. This is only supported when using HttpClientConnectionChannelImpl You can change the connection.properties file and have it in the classpath or classes folder of the web application to override the HTTP connection channel.

Parameters:
password - password for connecting to the resource.