|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.impl.protocol.sip.xcap.BaseHttpXCapClient
public abstract class BaseHttpXCapClient
Base HTTP XCAP client implementation.
Compliant with rfc4825
| Field Summary | |
|---|---|
static String |
HEADER_CONTENT_TYPE
HTTP Content-Type header. |
static String |
HEADER_ETAG
HTTP ETag header. |
static String |
HEADER_IF_NONE_MATCH
HTTP If-None-Match header. |
protected URI |
uri
Current server uri. |
protected javax.sip.address.Address |
userAddress
Current user. |
static String |
XCAP_ERROR_CONTENT_TYPE
XCap-error content type. |
| Constructor Summary | |
|---|---|
BaseHttpXCapClient()
Creates an instance of this XCAP client. |
|
| Method Summary | |
|---|---|
protected void |
assertConnected()
Utility method throwing an exception if the user is not connected. |
void |
connect(URI uri,
javax.sip.address.Address userAddress,
String username,
String password)
Connects user to XCap server. |
XCapHttpResponse |
delete(XCapResourceId resourceId)
Deletes the resource from the server. |
void |
disconnect()
Disconnects user from the XCAP server. |
protected XCapHttpResponse |
get(URI uri)
Gets resource from the server. |
XCapHttpResponse |
get(XCapResourceId resourceId)
Gets the resource from the server. |
protected URI |
getResourceURI(XCapResourceId resourceId)
Gets resource uri from XCAP resource identifier. |
protected static String |
getSingleHeaderValue(org.apache.http.HttpResponse response,
String headerName)
Gets HTTP header value. |
int |
getTimeout()
Gets operation timeout.The deffault value is 10 seconds. |
URI |
getUri()
Gets server uri. |
String |
getUserName()
Gets user name. |
protected String |
getXCapErrorMessage(XCapHttpResponse response)
Analyzes the response and returns xcap error or null if response doesn't have it. |
boolean |
isConnected()
Checks if user is connected to the XCAP server. |
XCapHttpResponse |
put(XCapResource resource)
Puts the resource to the server. |
void |
setTimeout(int timeout)
Sets operation timeout. |
(package private) static void |
showError(Exception ex,
String title,
String message)
Shows an error and a short description. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String HEADER_CONTENT_TYPE
public static final String HEADER_ETAG
public static final String HEADER_IF_NONE_MATCH
public static final String XCAP_ERROR_CONTENT_TYPE
protected URI uri
protected javax.sip.address.Address userAddress
| Constructor Detail |
|---|
public BaseHttpXCapClient()
| Method Detail |
|---|
public void connect(URI uri,
javax.sip.address.Address userAddress,
String username,
String password)
throws XCapException
connect in interface HttpXCapClienturi - the server location.userAddress - the URI of the user used for requestsusername - the user name.password - the user password.
XCapException - if there is some error during operation.public boolean isConnected()
isConnected in interface HttpXCapClientpublic void disconnect()
disconnect in interface HttpXCapClient
public XCapHttpResponse get(XCapResourceId resourceId)
throws XCapException
get in interface HttpXCapClientresourceId - resource identifier.
IllegalStateException - if the user has not been connected.
XCapException - if there is some error during operation.
protected XCapHttpResponse get(URI uri)
throws XCapException
uri - the resource uri.
XCapException - if there is error during reading the resource's
content.
static void showError(Exception ex,
String title,
String message)
ex - the exception
public XCapHttpResponse put(XCapResource resource)
throws XCapException
put in interface HttpXCapClientresource - the resource to be saved on the server.
IllegalStateException - if the user has not been connected.
XCapException - if there is some error during operation.
public XCapHttpResponse delete(XCapResourceId resourceId)
throws XCapException
delete in interface HttpXCapClientresourceId - resource identifier.
IllegalStateException - if the user has not been connected.
XCapException - if there is some error during operation.public String getUserName()
getUserName in interface HttpXCapClientpublic URI getUri()
getUri in interface HttpXCapClientpublic int getTimeout()
getTimeout in interface HttpXCapClientpublic void setTimeout(int timeout)
setTimeout in interface HttpXCapClienttimeout - operation timeout.protected void assertConnected()
IllegalStateException - if the user is not connected.protected URI getResourceURI(XCapResourceId resourceId)
resourceId - the resource identifier.
protected static String getSingleHeaderValue(org.apache.http.HttpResponse response,
String headerName)
response - the HTTP response.headerName - the header name.
protected String getXCapErrorMessage(XCapHttpResponse response)
response - the server response.
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||