Package uk.ac.starlink.topcat.interop

# Class TopcatServer

java.lang.Object
uk.ac.starlink.topcat.interop.TopcatServer

public class TopcatServer extends Object
Provides HTTP server functionality for TOPCAT. This includes a web server for dynamically generated content and an XML-RPC server for use with SAMP. This class is a singleton.

Since:
  29 Aug 2008
Author:
  Mark Taylor

## Method Summary

Modifier and Type
Method
Description
`URL`
`addResource(String name, org.astrogrid.samp.httpd.ServerResource resource)`
Makes a resource available for retrieving from this internal HTTP server.
`static TopcatServer`
`getInstance()`
Returns the sole instance of this class.
`org.astrogrid.samp.client.ClientProfile`
`getProfile()`
Returns a SAMP client profile.
`URL`
`getRelativeUrl(String subPath)`
Returns the URL for a resource available at a path served by this server.
`URL`
`getTopcatPackageUrl()`
Returns the URL corresponding to the classpath for the package uk.ac.starlink.topcat.
`boolean`
`isFound(URL url)`
Indicates whether this server can serve the resource with a given URL.
`void`
`removeResource(URL url)`
Removes a resource from this server.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### getProfile

public org.astrogrid.samp.client.ClientProfile getProfile()
Returns a SAMP client profile.

Returns:
  profile

### addResource

public URL addResource(String name, org.astrogrid.samp.httpd.ServerResource resource)
Makes a resource available for retrieving from this internal HTTP server. A `name` may be supplied which will appear at the end of the URL, but this is just for cosmetic purposes. The URL at which the resource is available will provided as the return value.

Parameters:
  `name` - filename identifying the resource
  `resource` - resource to make available
Returns:
  URL at which `resource` can be found

### removeResource

public void removeResource(URL url)
Removes a resource from this server.

Parameters:
  `url` - URL returned by a previous addResource call

### getTopcatPackageUrl

public URL getTopcatPackageUrl()
Returns the URL corresponding to the classpath for the package uk.ac.starlink.topcat.

Returns:
  documentation URL

### getRelativeUrl

public URL getRelativeUrl(String subPath)
Returns the URL for a resource available at a path served by this server.

Parameters:
  `subPath` - path relative to this server's base URL
Returns:
  URL, or null in case of trouble

### isFound

public boolean isFound(URL url)
Indicates whether this server can serve the resource with a given URL.

Parameters:
  `url` - URL to enquire about
Returns:
  true if a request for `url` will complete with non-error status

### getInstance

public static TopcatServer getInstance() throws IOException
Returns the sole instance of this class.

Returns:
  instance
Throws:
  `IOException`