org.openide.util
Interface HttpServer.Impl

Enclosing class:
HttpServer

public static interface HttpServer.Impl

Implementation of the HTTP server. Must be implemented by classes which want to register as a server.

Such a server must be prepared to specially serve pages from within the IDE, i.e. the Repository and the system class loader. (It may also serve external pages, if desired.) It should have a system option specifying at least the port number (by default, an unused port above 1000), the host access restrictions (by default, only localhost), and an toggle to disable it. It should provide URLs using the protocol http so as not to need to register a new protocol handler.


Method Summary
 boolean allowAccess(InetAddress addr)
          Requests the server to allow access to it from a given IP address.
 URL getRepositoryRoot()
          Get the URL for the Repository.
 URL getRepositoryURL(FileObject fo)
          Get the URL for a file object.
 URL getResourceRoot()
          Get URL root for a resource from system classpath.
 URL getResourceURL(String resourcePath)
          Get the URL for a resource from system classpath.
 

Method Detail

getRepositoryURL

public URL getRepositoryURL(FileObject fo)
                     throws MalformedURLException,
                            UnknownHostException
Get the URL for a file object.
Parameters:
fo - the file object
Returns:
the URL
Throws:
MalformedURLException - for the usual reasons
UnknownHostException - for the usual reasons
See Also:
HttpServer.getRepositoryURL(org.openide.filesystems.FileObject)

getRepositoryRoot

public URL getRepositoryRoot()
                      throws MalformedURLException,
                             UnknownHostException
Get the URL for the Repository. For this URL, the implementation should display a page containing a list of links to subdirectories (packages).
Returns:
the URL
Throws:
MalformedURLException - for the usual reasons
UnknownHostException - for the usual reasons
See Also:
HttpServer.getRepositoryRoot()

getResourceURL

public URL getResourceURL(String resourcePath)
                   throws MalformedURLException,
                          UnknownHostException
Get the URL for a resource from system classpath. The URL must comply to java naming conventions, i.e. the URL must end with a fully qualified resource name.
Parameters:
resourcePath - the resource path
Returns:
the URL
Throws:
MalformedURLException - for the usual reasons
UnknownHostException - for the usual reasons
See Also:
HttpServer.getResourceURL(java.lang.String)

getResourceRoot

public URL getResourceRoot()
                    throws MalformedURLException,
                           UnknownHostException
Get URL root for a resource from system classpath.
Parameters:
resourcePath - the resource path
Returns:
the URL
Throws:
MalformedURLException - for the usual reasons
UnknownHostException - for the usual reasons
See Also:
HttpServer.getResourceURL(java.lang.String)

allowAccess

public boolean allowAccess(InetAddress addr)
                    throws UnknownHostException
Requests the server to allow access to it from a given IP address. This can be useful if a module wishes another machine to be able to access the server, such as a machine running a deployment server. The server may or may not grant access to the IP address, for example if the user does not wish to grant access to the IP address.
Parameters:
addr - address for which access is requested
Returns:
true if access has been granted


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.