|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Uniform
org.restlet.Restlet
org.restlet.Router
org.restlet.VirtualHost
public class VirtualHost
Router of calls from Server connectors to Restlets. The attached Restlets are
typically Applications.
A virtual host is defined along three properties:
Request.getHostRef()
: the URI of the host that received
the request. Note that the same IP address can correspond to multiple domain
names and therefore receive request with different "hostRef" URIs.Request.getResourceRef()
: the URI of the target
resource of the request. If this reference is relative, then it is based on
the "hostRef", otherwise it is maintained as received. This difference is
useful for resources identified by URNs or for Web proxies or Web caches.Response.getServerInfo()
: the information about the
server connector receiving the requests such as it IP address and port
number.Pattern
) that must match the domain name, port,
scheme for references or IP address and port number for server information.
The default values match everything.
Pattern
,
Wikipedia -
Virtual Hosting,
Apache - Virtual
HostingField Summary |
---|
Fields inherited from class org.restlet.Router |
---|
BEST, CUSTOM, FIRST, LAST, NEXT, RANDOM |
Constructor Summary | |
---|---|
VirtualHost()
Constructor. |
|
VirtualHost(Context parentContext)
Constructor. |
|
VirtualHost(Context parentContext,
java.lang.String hostDomain,
java.lang.String hostPort,
java.lang.String hostScheme,
java.lang.String resourceDomain,
java.lang.String resourcePort,
java.lang.String resourceScheme,
java.lang.String serverAddress,
java.lang.String serverPort)
Constructor. |
Method Summary | |
---|---|
Route |
attach(Restlet target)
Attaches a target Restlet to this router with an empty URI pattern. |
Route |
attach(java.lang.String uriPattern,
Restlet target)
Attaches a target Restlet to this router based on a given URI pattern. |
Route |
attachDefault(Restlet defaultTarget)
Attaches a Restlet to this router as the default target to invoke when no route matches. |
protected Finder |
createFinder(java.lang.Class<? extends Resource> targetClass)
Creates a new finder instance based on the "targetClass" property. |
protected Route |
createRoute(java.lang.String uriPattern,
Restlet target)
Creates a new route for the given URI pattern and target. |
static java.lang.Integer |
getCurrent()
Returns the virtual host code associated to the current thread. |
java.lang.String |
getHostDomain()
Returns the hostRef host domain to match. |
java.lang.String |
getHostPort()
Returns the hostRef host port to match. |
java.lang.String |
getHostScheme()
Returns the hostRef scheme to match. |
static java.lang.String |
getIpAddress(java.lang.String domain)
Returns the IP address of a given domain name. |
static java.lang.String |
getLocalHostAddress()
Returns the local host IP address. |
static java.lang.String |
getLocalHostName()
Returns the local host name. |
java.lang.String |
getName()
Returns the display name. |
java.lang.String |
getResourceDomain()
Returns the resourceRef host domain to match. |
java.lang.String |
getResourcePort()
Returns the resourceRef host port to match. |
java.lang.String |
getResourceScheme()
Returns the resourceRef scheme to match. |
java.lang.String |
getServerAddress()
Returns the listening server address. |
java.lang.String |
getServerPort()
Returns the listening server port. |
static void |
setCurrent(java.lang.Integer code)
Sets the virtual host code associated with the current thread. |
void |
setHostDomain(java.lang.String hostDomain)
Sets the hostRef host domain to match. |
void |
setHostPort(java.lang.String hostPort)
Sets the hostRef host port to match. |
void |
setHostScheme(java.lang.String hostScheme)
Sets the hostRef scheme to match. |
void |
setName(java.lang.String name)
Sets the display name. |
void |
setResourceDomain(java.lang.String resourceDomain)
Sets the resourceRef host domain to match. |
void |
setResourcePort(java.lang.String resourcePort)
Sets the resourceRef host port to match. |
void |
setResourceScheme(java.lang.String resourceScheme)
Sets the resourceRef scheme to match. |
void |
setServerAddress(java.lang.String serverAddress)
Sets the listening server address. |
void |
setServerPort(java.lang.String serverPort)
Sets the listening server port. |
Methods inherited from class org.restlet.Router |
---|
attach, attachDefault, detach, getCustom, getDefaultMatchingMode, getDefaultMatchQuery, getDefaultRoute, getFinderClass, getMaxAttempts, getNext, getRequiredScore, getRetryDelay, getRoutes, getRoutingMode, handle, setDefaultMatchingMode, setDefaultMatchQuery, setDefaultRoute, setFinderClass, setMaxAttempts, setRequiredScore, setRetryDelay, setRoutes, setRoutingMode |
Methods inherited from class org.restlet.Restlet |
---|
getApplication, getContext, getLogger, init, isStarted, isStopped, setContext, start, stop |
Methods inherited from class org.restlet.Uniform |
---|
delete, delete, get, get, handle, head, head, options, options, post, post, put, put |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VirtualHost()
public VirtualHost(Context parentContext)
parentContext
- The parent component's context.public VirtualHost(Context parentContext, java.lang.String hostDomain, java.lang.String hostPort, java.lang.String hostScheme, java.lang.String resourceDomain, java.lang.String resourcePort, java.lang.String resourceScheme, java.lang.String serverAddress, java.lang.String serverPort)
parentContext
- The parent component's context.hostDomain
- The hostRef host domain pattern to match.hostPort
- The hostRef host port pattern to match.hostScheme
- The hostRef scheme protocol pattern to match.resourceDomain
- The resourceRef host domain pattern to match.resourcePort
- The resourceRef host port pattern to match.resourceScheme
- The resourceRef scheme protocol pattern to match.serverAddress
- The listening server address pattern to match.serverPort
- The listening server port pattern to match.Method Detail |
---|
public static java.lang.Integer getCurrent()
public static java.lang.String getIpAddress(java.lang.String domain)
domain
- The domain name.
public static java.lang.String getLocalHostAddress()
public static java.lang.String getLocalHostName()
public static void setCurrent(java.lang.Integer code)
code
- The thread's virtual host code.public Route attach(Restlet target)
Context.createChildContext()
method.
attach
in class Router
target
- The target Restlet to attach.
public Route attach(java.lang.String uriPattern, Restlet target)
Context.createChildContext()
method.
attach
in class Router
uriPattern
- The URI pattern that must match the relative part of the
resource URI.target
- The target Restlet to attach.
public Route attachDefault(Restlet defaultTarget)
Context.createChildContext()
method.
attachDefault
in class Router
defaultTarget
- The Restlet to use as the default target.
protected Finder createFinder(java.lang.Class<? extends Resource> targetClass)
Context.createChildContext()
method.
createFinder
in class Router
targetClass
- The target Resource class to attach.
protected Route createRoute(java.lang.String uriPattern, Restlet target)
Router
createRoute
in class Router
uriPattern
- The URI pattern that must match the relative part of the
resource URI.target
- The target Restlet to attach.
public java.lang.String getHostDomain()
public java.lang.String getHostPort()
public java.lang.String getHostScheme()
public java.lang.String getName()
public java.lang.String getResourceDomain()
public java.lang.String getResourcePort()
public java.lang.String getResourceScheme()
public java.lang.String getServerAddress()
public java.lang.String getServerPort()
public void setHostDomain(java.lang.String hostDomain)
hostDomain
- The hostRef host domain to match.public void setHostPort(java.lang.String hostPort)
hostPort
- The hostRef host port to match.public void setHostScheme(java.lang.String hostScheme)
hostScheme
- The hostRef scheme to match.public void setName(java.lang.String name)
name
- The display name.public void setResourceDomain(java.lang.String resourceDomain)
resourceDomain
- The resourceRef host domain to match.public void setResourcePort(java.lang.String resourcePort)
resourcePort
- The resourceRef host port to match.public void setResourceScheme(java.lang.String resourceScheme)
resourceScheme
- The resourceRef scheme to match.public void setServerAddress(java.lang.String serverAddress)
serverAddress
- The listening server address.public void setServerPort(java.lang.String serverPort)
serverPort
- The listening server port.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |