io.undertow.server.handlers.resource

## Class ResourceHandler

- java.lang.Object
- - io.undertow.server.handlers.resource.ResourceHandler

All Implemented Interfaces:
  HttpHandler

    public class ResourceHandler
    extends Object
    implements HttpHandler

Author:
  Stuart Douglas

### Nested Class Summary

Nested Classes
`static class` `ResourceHandler.Builder`

### Constructor Summary

Constructors
Constructor and Description
`ResourceHandler()` Deprecated.
`ResourceHandler(ResourceManager resourceSupplier)`
`ResourceHandler(ResourceManager resourceManager, HttpHandler next)`
`ResourceHandler(ResourceSupplier resourceSupplier)`
`ResourceHandler(ResourceSupplier resourceManager, HttpHandler next)`

### Method Summary

All Methods Instance Methods Concrete Methods
`ResourceHandler` `addWelcomeFiles(String... files)`
`Predicate` `getAllowed()`
`Predicate` `getCachable()`
`Integer` `getCacheTime()`
`ContentEncodedResourceManager` `getContentEncodedResourceManager()`
`MimeMappings` `getMimeMappings()`
`ResourceManager` `getResourceManager()`
`ResourceSupplier` `getResourceSupplier()`
`void` `handleRequest(HttpServerExchange exchange)` Handle the request.
`boolean` `isCanonicalizePaths()`
`boolean` `isDirectoryListingEnabled()`
`ResourceHandler` `setAllowed(Predicate allowed)`
`ResourceHandler` `setCachable(Predicate cachable)`
`ResourceHandler` `setCacheTime(Integer cacheTime)`
`void` `setCanonicalizePaths(boolean canonicalizePaths)` If this handler should use canonicalized paths.
`ResourceHandler` `setContentEncodedResourceManager(ContentEncodedResourceManager contentEncodedResourceManager)`
`ResourceHandler` `setDirectoryListingEnabled(boolean directoryListingEnabled)`
`ResourceHandler` `setMimeMappings(MimeMappings mimeMappings)`
`ResourceHandler` `setResourceManager(ResourceManager resourceManager)`
`ResourceHandler` `setResourceSupplier(ResourceSupplier resourceSupplier)`
`ResourceHandler` `setWelcomeFiles(String... files)`

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

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

### Constructor Detail

#### ResourceHandler

    public ResourceHandler(ResourceManager resourceSupplier)

#### ResourceHandler

    public ResourceHandler(ResourceManager resourceManager,
                           HttpHandler next)

#### ResourceHandler

    public ResourceHandler(ResourceSupplier resourceSupplier)

#### ResourceHandler

    public ResourceHandler(ResourceSupplier resourceManager,
                           HttpHandler next)

#### ResourceHandler

    @Deprecated
    public ResourceHandler()

Deprecated.
You should use `ResourceHandler(ResourceManager)` instead.

### 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`

#### isDirectoryListingEnabled

    public boolean isDirectoryListingEnabled()

#### setDirectoryListingEnabled

    public ResourceHandler setDirectoryListingEnabled(boolean directoryListingEnabled)

#### addWelcomeFiles

    public ResourceHandler addWelcomeFiles(String... files)

#### setWelcomeFiles

    public ResourceHandler setWelcomeFiles(String... files)

#### getMimeMappings

    public MimeMappings getMimeMappings()

#### setMimeMappings

    public ResourceHandler setMimeMappings(MimeMappings mimeMappings)

#### getCachable

    public Predicate getCachable()

#### setCachable

    public ResourceHandler setCachable(Predicate cachable)

#### getAllowed

    public Predicate getAllowed()

#### setAllowed

    public ResourceHandler setAllowed(Predicate allowed)

#### getResourceSupplier

    public ResourceSupplier getResourceSupplier()

#### setResourceSupplier

    public ResourceHandler setResourceSupplier(ResourceSupplier resourceSupplier)

#### getResourceManager

    public ResourceManager getResourceManager()

#### setResourceManager

    public ResourceHandler setResourceManager(ResourceManager resourceManager)

#### getCacheTime

    public Integer getCacheTime()

#### setCacheTime

    public ResourceHandler setCacheTime(Integer cacheTime)

#### getContentEncodedResourceManager

    public ContentEncodedResourceManager getContentEncodedResourceManager()

#### setContentEncodedResourceManager

    public ResourceHandler setContentEncodedResourceManager(ContentEncodedResourceManager contentEncodedResourceManager)

#### isCanonicalizePaths

    public boolean isCanonicalizePaths()

#### setCanonicalizePaths

    public void setCanonicalizePaths(boolean canonicalizePaths)

If this handler should use canonicalized paths. WARNING: If this is not true and `CanonicalPathHandler` is not installed in the handler chain then is may be possible to perform a directory traversal attack. If you set this to false make sure you have some kind of check in place to control the path.

Parameters:
  `canonicalizePaths` - If paths should be canonicalized