Esri Geoportal Server
1.0

com.esri.gpt.server.csw.client
Class CswClient

java.lang.Object
  extended by com.esri.gpt.server.csw.client.CswClient

public class CswClient
extends Object

CswClient class is used to submit CSW search request. CswClient is a wrapper class of .NET HttpWebRequest and HttpWebResponse. It basically submits a HTTP request then return a text response.


Field Summary
static int DEFAULT_REQUEST_TIMEOUT
          The REQUES Timeout parameter.
 
Constructor Summary
CswClient()
          Constructor
 
Method Summary
 String encodePostbody(String postbody)
          Encode PostBody Encode special characters (such as %, space, <, >, \, and &) to percent values.
 int getConnectTimeout()
          Gets the timeout.
 int getReadTimeout()
          Gets the timeout.
static String replaceSubString(String source, String pattern, String replace)
          Replace sub string.
 void setConnectTimeout(int timeout)
          Sets the timeout.
 void setReadTimeout(int timeout)
          Sets the timeout.
 InputStream submitHttpRequest(String method, String url, String postdata)
          Submit HTTP Request
 InputStream submitHttpRequest(String method, String urlString, String postdata, String usr, String pwd)
          Submit HTTP Request (Both GET and POST).
 Element submitHttpRequestAndGetDom(String method, String urlString, String postdata, String usr, String pwd)
          submit HTTP Request (Both GET and POST).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_REQUEST_TIMEOUT

public static int DEFAULT_REQUEST_TIMEOUT
The REQUES Timeout parameter.

Constructor Detail

CswClient

public CswClient()
Constructor

Method Detail

getConnectTimeout

public int getConnectTimeout()
Gets the timeout.

Returns:
the timeout

setConnectTimeout

public void setConnectTimeout(int timeout)
Sets the timeout.

Parameters:
timeout - the new timeout

getReadTimeout

public int getReadTimeout()
Gets the timeout.

Returns:
the timeout

setReadTimeout

public void setReadTimeout(int timeout)
Sets the timeout.

Parameters:
timeout - the new timeout

encodePostbody

public String encodePostbody(String postbody)
Encode PostBody Encode special characters (such as %, space, <, >, \, and &) to percent values.

Parameters:
postbody - Text to be encoded
Returns:
Encoded text.

replaceSubString

public static String replaceSubString(String source,
                                      String pattern,
                                      String replace)
Replace sub string.

Parameters:
source - the source
pattern - the pattern
replace - the replace
Returns:
the replaced string

submitHttpRequest

public InputStream submitHttpRequest(String method,
                                     String url,
                                     String postdata)
                              throws IOException
Submit HTTP Request

Parameters:
method - HTTP Method. for example "POST", "GET"
url - URL to send HTTP Request to
postdata - Data to be posted
Returns:
Response in plain text
Throws:
IOException

submitHttpRequest

public InputStream submitHttpRequest(String method,
                                     String urlString,
                                     String postdata,
                                     String usr,
                                     String pwd)
                              throws IOException
Submit HTTP Request (Both GET and POST). Return InputStream object from the response Submit an HTTP request.

Parameters:
method - HTTP Method. for example "POST", "GET"
urlString - URL to send HTTP Request to
postdata - Data to be posted
usr - Username
pwd - Password
Returns:
Response in plain text.
Throws:
IOException - in IOException
SocketTimeoutException - if connect or read timeout

submitHttpRequestAndGetDom

public Element submitHttpRequestAndGetDom(String method,
                                          String urlString,
                                          String postdata,
                                          String usr,
                                          String pwd)
                                   throws IOException,
                                          ParserConfigurationException,
                                          SAXException
submit HTTP Request (Both GET and POST). Parse the response into an xml document element.

Parameters:
method -
urlString -
postdata -
usr -
pwd -
Returns:
response
Throws:
IOException
ParserConfigurationException
SAXException

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.