org.restlet.engine.component

## Class HostRoute

- java.lang.Object
- - org.restlet.Restlet
  - - org.restlet.routing.Filter
    - - org.restlet.routing.TemplateRoute
      - - org.restlet.routing.Route
        - - org.restlet.engine.component.HostRoute

All Implemented Interfaces:
  Uniform

    public class HostRoute
    extends Route

Route based on a target VirtualHost. Concurrency note: instances of this class or its subclasses can be invoked by several threads at the same time and therefore must be thread-safe. You should be especially careful when storing state in member variables.

Author:
  Jerome Louvel

### Field Summary

### Fields inherited from class org.restlet.routing.Filter

`CONTINUE, SKIP, STOP`

### Constructor Summary

Constructors
Constructor and Description
`HostRoute(Router router, VirtualHost target)` Constructor.

### Method Summary

Methods
`protected int` `beforeHandle(Request request, Response response)` Allows filtering before processing by the next Restlet.
`VirtualHost` `getVirtualHost()` Returns the target virtual host.
`float` `score(Request request, Response response)` Returns the score for a given call (between 0 and 1.0).
`void` `setNext(VirtualHost next)` Sets the next virtual host.

### Methods inherited from class org.restlet.routing.Route

`extractCookie, extractEntity, extractQuery, validate`

### Methods inherited from class org.restlet.routing.TemplateRoute

`getMatchingMode, getMatchQuery, getRouter, getTemplate, isMatchingQuery, setMatchingMode, setMatchingQuery, setMatchQuery, setRouter, setTemplate, toString`

### Methods inherited from class org.restlet.routing.Filter

`afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext, start, stop`

### Methods inherited from class org.restlet.Restlet

`finalize, getApplication, getAuthor, getContext, getDescription, getLogger, getName, getOwner, isStarted, isStopped, setAuthor, setContext, setDescription, setName, setOwner`

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

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

### Constructor Detail

#### HostRoute

    public HostRoute(Router router,
             VirtualHost target)

Constructor.

Parameters:
  `router` - The parent router.
  `target` - The target virtual host.

### Method Detail

#### beforeHandle

    protected int beforeHandle(Request request,
                   Response response)

Allows filtering before processing by the next Restlet. Set the base reference.

Overrides:
  `beforeHandle` in class `Route`
Parameters:
  `request` - The request to handle.
  `response` - The response to update.
Returns:
  The continuation status.

#### getVirtualHost

    public VirtualHost getVirtualHost()

Returns the target virtual host.

Returns:
  The target virtual host.

#### score

    public float score(Request request,
              Response response)

Returns the score for a given call (between 0 and 1.0).

Overrides:
  `score` in class `TemplateRoute`
Parameters:
  `request` - The request to score.
  `response` - The response to score.
Returns:
  The score for a given call (between 0 and 1.0).

#### setNext

    public void setNext(VirtualHost next)

Sets the next virtual host.

Parameters:
  `next` - The next virtual host.