com.artima.place
Class WebServerLink
java.lang.Object
|
+--com.artima.place.WebServerLink
- All Implemented Interfaces:
- Link, ProgressEventGenerator, java.io.Serializable
- public final class WebServerLink
- extends java.lang.Object
- implements Link, ProgressEventGenerator
Represents an HTTP-based link to a service on a webserver. The service will
be retrieved from an HTTP URL. The MIME type of the HTTP GET must be
application/x-serviceitem or application/serviceitem,
which is a serialized marshalled Jini ServiceItem.
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WebServerLink
public WebServerLink(URLString url)
- Construct a
WebServerLink with a URLString.
- Parameters:
url - the URL pointing to the serialized marshalled ServiceItem
to be produced when this link's retrieveService method is invoked.- Throws:
NullPointerException - if passed url reference is
nulljava.lang.IllegalArgumentException - if the passed url is not an http
URL
WebServerLink
public WebServerLink(URLString[] urls)
- Construct a
WebServerLink with an array of
URLStrings.
- Parameters:
urls - the URLs, in order, all pointing to separate copies of the serialized marshalled ServiceItem
to be produced when this link's retrieveService method is invoked.- Throws:
NullPointerException - if passed urls array is
nulljava.lang.IllegalArgumentException - if passed urls array is
emptyjava.lang.IllegalArgumentException - if any of the passed urls are not http
URLs
retrieveService
public net.jini.core.lookup.ServiceItem retrieveService()
throws java.rmi.RemoteException,
StoppedException
- Retrieves a service from a web server. The MIME type of the data returned by the
web server must be either
application/x-serviceitem or
application/serviceitem, which indicates the data is a
serialized marshalled Jini ServiceItem. Any other MIME type will
generate a RemoteException.
- Specified by:
retrieveService in interface Link
- Returns:
- the
ServiceItem the retrieved service item - Throws:
java.rmi.RemoteException - to indicate a failure in retrieving the serviceStoppedException - to indicate that the request was stopped
stopRetrieval
public void stopRetrieval()
- Request any ongoing retrieval to stop.
- Specified by:
stopRetrieval in interface Link
addProgressListener
public void addProgressListener(ProgressListener listener)
- Adds the specified
ProgressListener to receive progress
events from this object. If listener is null, no
exception is thrown and no action is performed.
- Specified by:
addProgressListener in interface ProgressEventGenerator
- Parameters:
listener - the ProgressListener to add
removeProgressListener
public void removeProgressListener(ProgressListener listener)
- Removes the specified
ProgressListener so that it no
longer receives progress events from this object. This method performs
no function, nor does it throw an exception, if the listener specified
by the argument was not previously added to this object. If
listener is null, no exception is thrown and no
action is performed.
- Specified by:
removeProgressListener in interface ProgressEventGenerator
- Parameters:
listener - the ProgressListener to remove