|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnesstar.api.Protocol
public class Protocol
Client/Server protocol.
This class contains the static methods used to initialise and change the settings of the client/server protocol. The Protocol object encapsulate all the information associated with the accesses to one or more remote Server on behalf of a certain user identity, in particular:newProtocol()
.
An application can associate the same Protocol to additional threads calling setAsCurrent()
.
Web clients need to associate protocols with corresponding user sessions. They can do so using
ServletUtils.setProtocol(javax.servlet.http.HttpSession)
.
API operations can return access control challenges that need to be displayed to the user.
Clients such as the web clients that communicate with the user using more than one channel need a way of addressing
these challenges correctly.
They can do so by associating a different ExecutorLog with every thread using
setExecutorLog(BasicExecutorLog)
.
Field Summary | |
---|---|
static String |
ACCEPTEDLANGUAGE
|
Method Summary | |
---|---|
void |
finalize()
|
static String |
getAcceptedLanguage()
|
static Protocol |
getCurrent()
|
static NetDB |
getDB()
|
static BasicExecutorLog |
getExecutorLog()
|
static BasicExecutorLog |
getExecutorLog(Bookmark bookmark,
BasicExecutorLog executor)
|
static String |
getHeader(String header)
|
static Vector |
getHeaders()
|
static org.apache.commons.httpclient.HttpClient |
getHttpClient()
|
static int |
getHTTPTimeoutInSecs()
|
static int |
getHTTPTimeoutInSecs(int timeoutInSecs)
|
static String |
getLocalDBContents()
|
static RDFDB |
getOpsDB()
|
static void |
init()
Default init. |
static void |
init(String saxParser,
String httpProxyHost,
int httpProxyPort,
String socksProxyHost,
int socksProxyPort,
Class htmlViewerClass)
Initialise protocol, this method should be called at the beginning of the program. |
static void |
init(String saxParser,
String httpProxyHost,
int httpProxyPort,
String socksProxyHost,
int socksProxyPort,
Class htmlViewerClass,
String localObjsProxy)
Initialise protocol, this method should be called at the beginning of the program. |
static Protocol |
newProtocol()
Create a new Protocol object and associate it with the current thread. |
static Protocol |
newProtocol(String id)
Create a new Protocol object and associate it with the current thread. |
static void |
setAcceptedLanguage(String languages)
|
void |
setAsCurrent()
Set this protocol as the current one |
static void |
setCredentials(String realm,
String host,
String username,
String password)
Sets the credentials for the current protocol. |
static void |
setExecutorLog(BasicExecutorLog executor)
Set the executor log to use for API calls that will take place in the current context for the current thread. |
static void |
setFallBackLanguage(String locale)
|
static void |
setHeader(String header,
String value)
|
static void |
setHTMLViewerClass(Class htmlViewerClass)
Set the class that implements the nesstar.api.HTMLViewer interface. |
static void |
setHTTPTimeoutInSecs(int timeoutInSecs)
Set the timeout in seconds for HTTP connections for the current protocol. |
static void |
setProxies(String httpProxyHost,
int httpProxyPort,
String socksProxyHost,
int socksProxyPort)
Sets the proxies attribute for the current protocol. |
static void |
setProxyCredentials(String realm,
String proxyHost,
String username,
String password)
Sets the proxy credentials for the current protocol. |
static void |
setTimeoutInSecs(long timeoutInSecs)
Set the timeout in seconds for the proxy objects to expire from the cache. |
String |
toString()
|
static void |
unbind()
Unbind the current protocol and executor log from the current thread. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ACCEPTEDLANGUAGE
Method Detail |
---|
public static void setProxies(String httpProxyHost, int httpProxyPort, String socksProxyHost, int socksProxyPort)
httpProxyHost
- the Http Proxy Host, if set to null no Http proxy will be used.httpProxyPort
- the Http Proxy Port, e.g. 8080.socksProxyHost
- the Socks Proxy Host, if set to null no Socks proxy will be used.socksProxyPort
- the Socks Proxy Port.
this should be done only once for all protocols. |
public static void setCredentials(String realm, String host, String username, String password)
realm
- host
- username
- password
- public static void setProxyCredentials(String realm, String proxyHost, String username, String password)
realm
- proxyHost
- username
- password
- public static void setHTMLViewerClass(Class htmlViewerClass)
htmlViewerClass
- a classpublic static RDFDB getOpsDB()
public static NetDB getDB()
public static void init(String saxParser, String httpProxyHost, int httpProxyPort, String socksProxyHost, int socksProxyPort, Class htmlViewerClass, String localObjsProxy) throws Exception
saxParser
- the name of the class that implements the sax parser, ex: "com.sun.xml.parser.Parser"httpProxyHost
- the http proxy server host name, ex: "wwwcache.essex.ac.uk", if it's equal to null no proxy
is usedhttpProxyPort
- the http proxy server port number, ex: 8080socksProxyHost
- the SOCKS proxy server host name, ex: "socks.mydomain.com", if it's equal to null no proxy
is usedsocksProxyPort
- the SOCKS proxy server port number, ex: 1080htmlViewerClass
- a class that implements the nesstar.api.HTMLViewer interface that will be used to display
the results of accessing non-nesstar URLslocalObjsProxy
- the URL of the proxy that will redirect calls to the local client obj
Exception
this doesn't set up the proxies. |
public static void init(String saxParser, String httpProxyHost, int httpProxyPort, String socksProxyHost, int socksProxyPort, Class htmlViewerClass) throws Exception
saxParser
- the name of the class that implements the sax parser, ex: "com.sun.xml.parser.Parser"httpProxyHost
- the http proxy server host name, ex: "wwwcache.essex.ac.uk", if it's equal to null no proxy
is usedhttpProxyPort
- the http proxy server port number, ex: 8080socksProxyHost
- the SOCKS proxy server host name, ex: "socks.mydomain.com", if it's equal to null no proxy
is usedsocksProxyPort
- the SOCKS proxy server port number, ex: 1080htmlViewerClass
- a class that implements the nesstar.api.HTMLViewer interface that will be used to display
the results of accessing non-nesstar URLs
Exception
public static void init() throws Exception
Exception
public static void setTimeoutInSecs(long timeoutInSecs)
the
- new timeout in secondspublic static void setHTTPTimeoutInSecs(int timeoutInSecs)
the
- new timeout in secondspublic static int getHTTPTimeoutInSecs()
public static int getHTTPTimeoutInSecs(int timeoutInSecs)
public static void setExecutorLog(BasicExecutorLog executor) throws Exception
executor
- the executor to use
Exception
public static BasicExecutorLog getExecutorLog()
public static BasicExecutorLog getExecutorLog(Bookmark bookmark, BasicExecutorLog executor) throws Exception
Exception
public static Protocol newProtocol() throws Exception
Exception
public static Protocol newProtocol(String id) throws Exception
id
- a (not necessarily unique) id associated to this protocol, used for logging purposes.
Exception
public static void setHeader(String header, String value)
public static void setAcceptedLanguage(String languages)
public static void setFallBackLanguage(String locale)
public static Vector getHeaders()
public static String getHeader(String header)
public static String getAcceptedLanguage()
public void setAsCurrent()
public static void unbind()
public static Protocol getCurrent()
public static org.apache.commons.httpclient.HttpClient getHttpClient()
public static String getLocalDBContents() throws Exception
Exception
public String toString()
toString
in class Object
public void finalize()
finalize
in class Object
|
Nesstar SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |