public class VirtualHost extends Router
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
      HostingMODE_BEST_MATCH, MODE_CUSTOM, MODE_FIRST_MATCH, MODE_LAST_MATCH, MODE_NEXT_MATCH, MODE_RANDOM_MATCH| Constructor and Description | 
|---|
| 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. | 
| Modifier and Type | Method and Description | 
|---|---|
| TemplateRoute | attach(Restlet target)Attaches a target Restlet to this router with an empty URI pattern. | 
| TemplateRoute | attach(java.lang.String uriPattern,
      Restlet target)Attaches a target Restlet to this router based on a given URI pattern. | 
| TemplateRoute | attachDefault(Restlet defaultTarget)Attaches a Restlet to this router as the default target to invoke when no
 route matches. | 
| protected void | checkContext(Restlet target)Checks the context and sets it if necessary. | 
| Finder | createFinder(java.lang.Class<? extends ServerResource> targetClass)Creates a new finder instance based on the "targetClass" property. | 
| protected TemplateRoute | createRoute(java.lang.String uriPattern,
           Restlet target,
           int matchingMode)Creates a new route for the given URI pattern, target and matching mode. | 
| 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 | 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. | 
| void | setContext(Context parentContext)Sets the context. | 
| 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 | 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. | 
attach, attach, attach, attach, attachDefault, createRoute, detach, detach, doHandle, getCustom, getDefaultMatchingMode, getDefaultMatchingQuery, getDefaultRoute, getMatchingMode, getMaxAttempts, getNext, getRequiredScore, getRetryDelay, getRoutes, getRoutingMode, handle, logRoute, redirectPermanent, redirectSeeOther, redirectTemporary, setDefaultMatchingMode, setDefaultMatchingQuery, setDefaultRoute, setMaxAttempts, setRequiredScore, setRetryDelay, setRoutes, setRoutingMode, start, stopfinalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setDescription, setFinderClass, setName, setOwnerpublic 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.Patternpublic 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 TemplateRoute attach(Restlet target)
Context.createChildContext() method.public TemplateRoute attach(java.lang.String uriPattern, Restlet target)
Context.createChildContext() method.public TemplateRoute attachDefault(Restlet defaultTarget)
Context.createChildContext() method.attachDefault in class RouterdefaultTarget - The Restlet to use as the default target.protected void checkContext(Restlet target)
target - The target Restlet.public Finder createFinder(java.lang.Class<? extends ServerResource> targetClass)
Context.createChildContext() method.createFinder in class RestlettargetClass - The target Resource class to attach.Finder.createFinder(Class, Class, Context,
      Logger)protected TemplateRoute createRoute(java.lang.String uriPattern, Restlet target, int matchingMode)
RouterRouter.getDefaultMatchingQuery().createRoute in class RouteruriPattern - The URI pattern that must match the relative part of the
            resource URI.target - The target Restlet to attach.matchingMode - The matching mode.public java.lang.String getHostDomain()
Pattern class for details on the syntax.public java.lang.String getHostPort()
Pattern class for details on the syntax.public java.lang.String getHostScheme()
Pattern class for details on the syntax.public java.lang.String getResourceDomain()
Pattern class for details on the syntax.public java.lang.String getResourcePort()
Pattern class for details on the syntax.public java.lang.String getResourceScheme()
Pattern class for details on the syntax.public java.lang.String getServerAddress()
Pattern class for details on the syntax.public java.lang.String getServerPort()
Pattern class for details on the syntax.public void setContext(Context parentContext)
RestletsetContext in class RestletparentContext - The context.public void setHostDomain(java.lang.String hostDomain)
Pattern class for details on the syntax.hostDomain - The hostRef host domain to match.public void setHostPort(java.lang.String hostPort)
Pattern class for details on the syntax.hostPort - The hostRef host port to match.public void setHostScheme(java.lang.String hostScheme)
Pattern
 class for details on the syntax.hostScheme - The hostRef scheme to match.public void setResourceDomain(java.lang.String resourceDomain)
Pattern class for details on the syntax.resourceDomain - The resourceRef host domain to match.public void setResourcePort(java.lang.String resourcePort)
Pattern class for details on the syntax.resourcePort - The resourceRef host port to match.public void setResourceScheme(java.lang.String resourceScheme)
Pattern class for details on the syntax.resourceScheme - The resourceRef scheme to match.public void setServerAddress(java.lang.String serverAddress)
Pattern class for details on the syntax.serverAddress - The listening server address.public void setServerPort(java.lang.String serverPort)
Pattern
 class for details on the syntax.serverPort - The listening server port.Copyright © 2005-2024 Restlet.