public class HttpConnection extends Object implements Connection
This class is the HTTP implementation of the connection contract. Refrain from using it directly, as backwards
compatibility isn’t guaranteed, use the ConnectionBuilder
class instead.
Constructor and Description |
---|
HttpConnection() |
Modifier and Type | Method and Description |
---|---|
String |
authenticate()
Return token which can be used for authentication instead of credentials.
|
void |
close() |
void |
close(boolean logout)
Releases the resources used by this connection.
|
<TYPE> TYPE |
followLink(TYPE object)
Follows the
href attribute of the given object, retrieves the target object and returns it. |
HttpClient |
getClient() |
String |
getSsoRevokeUrl() |
String |
getSsoTokenName() |
String |
getSsoUrl() |
String |
getUrl() |
boolean |
isLink(Object object)
Indicates if the given object is a link.
|
org.apache.http.HttpResponse |
send(org.apache.http.client.methods.HttpUriRequest request) |
void |
setClient(HttpClient client) |
void |
setKerberos(boolean kerberos) |
void |
setPassword(String password) |
void |
setSsoRevokeUrl(String ssoRevokeUrl) |
void |
setSsoToken(String ssoToken) |
void |
setSsoTokenName(String ssoTokenName) |
void |
setSsoUrl(String ssoUrl) |
void |
setUrl(String url) |
void |
setUser(String user) |
SystemService |
systemService()
Returns a reference to the root of the services tree.
|
public HttpClient getClient()
public void setClient(HttpClient client)
public String getUrl()
public void setUrl(String url)
public void setUser(String user)
public void setPassword(String password)
public String getSsoUrl()
public void setSsoUrl(String ssoUrl)
public String getSsoTokenName()
public void setSsoTokenName(String ssoTokenName)
public void setKerberos(boolean kerberos)
public String getSsoRevokeUrl()
public void setSsoRevokeUrl(String ssoRevokeUrl)
public void setSsoToken(String ssoToken)
public SystemService systemService()
Connection
Returns a reference to the root of the services tree.
systemService
in interface Connection
public boolean isLink(Object object)
Connection
Indicates if the given object is a link. An object is a link if it has an href
attribute.
isLink
in interface Connection
object
- the object to checktrue
iff the object is a linkpublic <TYPE> TYPE followLink(TYPE object)
Connection
Follows the href
attribute of the given object, retrieves the target object and returns it.
followLink
in interface Connection
TYPE
- the type of the target of the linkobject
- the object containing the href
attributehref
public void close() throws Exception
close
in interface AutoCloseable
Exception
public void close(boolean logout) throws Exception
Connection
Releases the resources used by this connection.
close
in interface Connection
logout
- A boolean, which specify if token should be revoked,
and so user should be logged out.Exception
public org.apache.http.HttpResponse send(org.apache.http.client.methods.HttpUriRequest request)
public String authenticate()
Connection
Return token which can be used for authentication instead of credentials.
It will be created, if it not exists, yet. By default the token will be
revoked when the connection is closed, unless the logout
parameter of
the close
method is false
.
authenticate
in interface Connection
Copyright © 2016. All rights reserved.