|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.purl.sword.client.Client
public class Client
This is an example Client implementation to demonstrate how to connect to a SWORD server. The client supports BASIC HTTP Authentication. This can be initialised by setting a username and password.
| Field Summary | |
|---|---|
static int |
DEFAULT_TIMEOUT
The default connection timeout. |
| Constructor Summary | |
|---|---|
Client()
Create a new Client. |
|
| Method Summary | |
|---|---|
void |
clearCredentials()
Clear any user credentials that have been set for this client. |
void |
clearProxy()
Clear the proxy setting. |
SwordValidationInfo |
getLastUnmarshallInfo()
|
ServiceDocument |
getServiceDocument(String url)
Retrieve the service document. |
ServiceDocument |
getServiceDocument(String url,
String onBehalfOf)
Retrieve the service document. |
Status |
getStatus()
Return the status information that was returned from the most recent request sent to the server. |
DepositResponse |
postFile(PostMessage message)
Post a file to the server. |
void |
setCredentials(String username,
String password)
Set the user credentials that will be used when making the access to the server. |
void |
setProxy(String host)
Set a proxy that should be used by the client when trying to access the server. |
void |
setProxy(String host,
int port)
Set a proxy that should be used by the client when trying to access the server. |
void |
setServer(String server,
int port)
Initialise the server that will be used to send the network access. |
void |
setSocketTimeout(int milliseconds)
Set the connection timeout for the socket. |
void |
setUserAgent(String userAgent)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_TIMEOUT
| Constructor Detail |
|---|
public Client()
| Method Detail |
|---|
public void setServer(String server,
int port)
setServer in interface SWORDClientserver - port -
public void setCredentials(String username,
String password)
setCredentials in interface SWORDClientusername - The username.password - The password.public void setProxy(String host)
host - The hostname.
public void setProxy(String host,
int port)
setProxy in interface SWORDClienthost - The name of the host.port - The port.public void clearProxy()
public void clearCredentials()
clearCredentials in interface SWORDClientpublic void setUserAgent(String userAgent)
public void setSocketTimeout(int milliseconds)
milliseconds - The time, expressed as a number of milliseconds.
public ServiceDocument getServiceDocument(String url)
throws SWORDClientException
getServiceDocument in interface SWORDClienturl - The location of the service document.
null if there was a
problem accessing the document. e.g. invalid access.
SWORDClientException - If there is an error accessing the resource.
public ServiceDocument getServiceDocument(String url,
String onBehalfOf)
throws SWORDClientException
getServiceDocument in interface SWORDClienturl - The location of the service document.onBehalfOf - The username for the onBehalfOf access.
null if there was a
problem accessing the document. e.g. invalid access.
SWORDClientException - If there is an error accessing the resource.public SwordValidationInfo getLastUnmarshallInfo()
public DepositResponse postFile(PostMessage message)
throws SWORDClientException
postFile in interface SWORDClientmessage - The message that contains the post information.
null should be returned.
SWORDClientException - if there is an error during the post operation.public Status getStatus()
getStatus in interface SWORDClient
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||