Class sun.server.http.HttpServer
All Packages Class Hierarchy This Package Previous Next Index
Class sun.server.http.HttpServer
java.lang.Object
|
+----sun.server.Server
|
+----sun.server.http.HttpServer
- public class HttpServer
- extends Server
Base class for http servers.
-
addAccessConfiguration(String, String, String, String)
- This method can be called to protect a specified resource.
-
applyRules(String)
- Applies servlet rules to specified virtual path.
-
checkAccessConfiguration(String, HttpRequest)
- Checks the incoming request for authentication and authorization.
-
createHandler()
- Creates a new HTTP connection handler.
-
error(String)
- Issues an error message and returns.
-
error(String, Exception)
- Issues an error message with exception stack trace and returns.
-
exit(int)
- Exits the server with the specified return code.
-
fatal(String)
- Issues a fatal error message and then exits.
-
fatal(String, Exception)
- Issues a fatal error message with exception stack trace and then exits.
-
getMimeType(String)
- Returns the mime type of the specified file.
-
getRealPath(String)
- Applies alias rules to the specified virtual path and returns the
corresponding real path.
-
getServerRoot()
- Returns server root directory.
-
main(String[])
- Main function
-
restart()
- Restarts the server.
-
run()
- Runs the HTTP server.
-
shutdown()
- Shuts down the server.
run
public void run()
- Runs the HTTP server.
- Overrides:
- run in class Server
exit
public void exit(int r)
- Exits the server with the specified return code.
- Parameters:
- r - the return code
getServerRoot
public String getServerRoot()
- Returns server root directory.
applyRules
public RulesOutput applyRules(String path)
- Applies servlet rules to specified virtual path. Returns the
rules output for the servlet, or null if none.
getRealPath
public String getRealPath(String path)
- Applies alias rules to the specified virtual path and returns the
corresponding real path.
addAccessConfiguration
public void addAccessConfiguration(String resource,
String scheme,
String realm,
String aclName) throws AccessConfigurationException, IOException
- This method can be called to protect a specified resource.
Only trusted servlets can call this method. It maps the specified
resource with the specified authentication scheme and the specified
acl name in the specified realm.
- Parameters:
- resource - the name of the resource that needs to
be protected.
- scheme - the name of the authentication scheme that is
to be used when controlling access to this resource.
- realm - the name of the realm to use when controlling access
to this resource
- aclName - the name of the acl that guards this resource.
- Throws: AccessConfigurationException
- if the scheme, realm or
acl is invalid
- Throws: IOException
- if the keyfile, acl or groupfile in the realm
cannot be read
checkAccessConfiguration
public boolean checkAccessConfiguration(String name,
HttpRequest req)
- Checks the incoming request for authentication and authorization.
- Parameters:
- the - name of the resource whose ACL should be checked
- req - the http request structure
getMimeType
public String getMimeType(String name)
- Returns the mime type of the specified file.
createHandler
protected ServerHandler createHandler()
- Creates a new HTTP connection handler.
- Overrides:
- createHandler in class Server
fatal
public void fatal(String s)
- Issues a fatal error message and then exits.
- Overrides:
- fatal in class Server
fatal
public void fatal(String s,
Exception e)
- Issues a fatal error message with exception stack trace and then exits.
- Overrides:
- fatal in class Server
error
public void error(String s)
- Issues an error message and returns.
- Overrides:
- error in class Server
error
public void error(String s,
Exception e)
- Issues an error message with exception stack trace and returns.
- Overrides:
- error in class Server
shutdown
public void shutdown()
- Shuts down the server.
- Overrides:
- shutdown in class Server
restart
public void restart()
- Restarts the server.
main
public static void main(String argv[])
- Main function
All Packages Class Hierarchy This Package Previous Next Index