io.undertow.server.handlers

## Class NameVirtualHostHandler

- java.lang.Object
- - io.undertow.server.handlers.NameVirtualHostHandler

All Implemented Interfaces:
  HttpHandler

    public class NameVirtualHostHandler
    extends Object
    implements HttpHandler

A `HttpHandler` that implements virtual hosts based on the `Host:` http header header.

Author:
  Stuart Douglas

### Constructor Summary

Constructors
Constructor and Description
`NameVirtualHostHandler()`

### Method Summary

All Methods Instance Methods Concrete Methods
`NameVirtualHostHandler` `addHost(String host, HttpHandler handler)`
`HttpHandler` `getDefaultHandler()`
`Map<String,HttpHandler>` `getHosts()`
`void` `handleRequest(HttpServerExchange exchange)` Handle the request.
`NameVirtualHostHandler` `removeHost(String host)`
`NameVirtualHostHandler` `setDefaultHandler(HttpHandler defaultHandler)`

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

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

### Constructor Detail

#### NameVirtualHostHandler

    public NameVirtualHostHandler()

### Method Detail

#### handleRequest

    public void handleRequest(HttpServerExchange exchange)
                       throws Exception

Description copied from interface: `HttpHandler`
Handle the request.

Specified by:
  `handleRequest` in interface `HttpHandler`
Parameters:
  `exchange` - the HTTP request/response exchange
Throws:
  `Exception`

#### getDefaultHandler

    public HttpHandler getDefaultHandler()

#### getHosts

    public Map<String,HttpHandler> getHosts()

#### setDefaultHandler

    public NameVirtualHostHandler setDefaultHandler(HttpHandler defaultHandler)

#### addHost

    public NameVirtualHostHandler addHost(String host,
                                          HttpHandler handler)

#### removeHost

    public NameVirtualHostHandler removeHost(String host)