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 Modifier and Type Class Description static class
ResourceHandler.Builder
-
Constructor Summary
Constructors Constructor Description ResourceHandler()
Deprecated.ResourceHandler(ResourceManager resourceSupplier)
ResourceHandler(ResourceManager resourceManager, HttpHandler next)
ResourceHandler(ResourceSupplier resourceSupplier)
ResourceHandler(ResourceSupplier resourceManager, HttpHandler next)
-
Method Summary
-
-
-
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 useResourceHandler(io.undertow.server.handlers.resource.ResourceManager)
instead.
-
-
Method Detail
-
handleRequest
public void handleRequest(HttpServerExchange exchange) throws Exception
Description copied from interface:HttpHandler
Handle the request.- Specified by:
handleRequest
in interfaceHttpHandler
- 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 andCanonicalPathHandler
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
-
-