Top Description Inners Fields Constructors Methods
io.undertow.server.handlers.error

public Class FileErrorPageHandler

extends Object
implements HttpHandler
Class Inheritance
All Implemented Interfaces
io.undertow.server.HttpHandler
Imports
java.io.File, .FileNotFoundException, .IOException, java.nio.channels.FileChannel, java.nio.file.Files, .Path, .Paths, .StandardOpenOption, java.util.Arrays, .Collections, .HashMap, .HashSet, .Map, .Set, java.util.stream.Collectors, io.undertow.util.MimeMappings, .Headers, org.jboss.logging.Logger, org.xnio.IoUtils, org.xnio.channels.Channels, .StreamSinkChannel, io.undertow.Handlers, .UndertowLogger, io.undertow.server.DefaultResponseListener, .ExchangeCompletionListener, .HandlerWrapper, .HttpHandler, .HttpServerExchange, io.undertow.server.handlers.ResponseCodeHandler, io.undertow.server.handlers.builder.HandlerBuilder

Handler that serves up a file from disk to serve as an error page.

This handler does not server up and response codes by default, you must configure the response codes it responds to.

Author
Stuart Douglas

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class

Field Summary

Modifier and TypeField and Description
private volatile Path
private static final Logger
private final MimeMappings
private volatile HttpHandler
private volatile Set<Integer>
responseCodes

The response codes that this handler will handle.

Constructor Summary

AccessConstructor and Description
public
FileErrorPageHandler(final File file, final Integer... responseCodes)
Deprecated

public
FileErrorPageHandler(final Path file, final Integer... responseCodes)

public
FileErrorPageHandler(HttpHandler next, final File file, final Integer... responseCodes)
Deprecated

public
FileErrorPageHandler(HttpHandler next, final Path file, final Integer... responseCodes)

public
FileErrorPageHandler(HttpHandler next, final Path file, MimeMappings mimeMappings, final Integer... responseCodes)

Method Summary

Modifier and TypeMethod and Description
public Path
public HttpHandler
public Set<Integer>
public void
handleRequest(final HttpServerExchange
the HTTP request/response exchange
exchange
)

Implements io.undertow.server.HttpHandler.handleRequest.

Handle the request.

private void
serveFile(final HttpServerExchange exchange)

public FileErrorPageHandler
setFile(final Path file)

public FileErrorPageHandler
setNext(final HttpHandler next)

public FileErrorPageHandler
setResponseCodes(final Set<Integer> responseCodes)

public FileErrorPageHandler
setResponseCodes(final Integer... responseCodes)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

fileback to summary
private volatile Path file
logback to summary
private static final Logger log
mimeMappingsback to summary
private final MimeMappings mimeMappings
nextback to summary
private volatile HttpHandler next
responseCodesback to summary
private volatile Set<Integer> responseCodes

The response codes that this handler will handle. If this is empty then this handler will have no effect.

Constructor Detail

FileErrorPageHandlerback to summary
public FileErrorPageHandler(final File file, final Integer... responseCodes)

Deprecated

Annotations
@Deprecated
FileErrorPageHandlerback to summary
public FileErrorPageHandler(final Path file, final Integer... responseCodes)
FileErrorPageHandlerback to summary
public FileErrorPageHandler(HttpHandler next, final File file, final Integer... responseCodes)

Deprecated

Annotations
@Deprecated
FileErrorPageHandlerback to summary
public FileErrorPageHandler(HttpHandler next, final Path file, final Integer... responseCodes)
FileErrorPageHandlerback to summary
public FileErrorPageHandler(HttpHandler next, final Path file, MimeMappings mimeMappings, final Integer... responseCodes)

Method Detail

getFileback to summary
public Path getFile()
getNextback to summary
public HttpHandler getNext()
getResponseCodesback to summary
public Set<Integer> getResponseCodes()
handleRequestback to summary
public void handleRequest(final HttpServerExchange exchange) throws Exception

Implements io.undertow.server.HttpHandler.handleRequest.

Doc from io.undertow.server.HttpHandler.handleRequest.

Handle the request.

Parameters
exchange:HttpServerExchange

the HTTP request/response exchange

Annotations
@Override
serveFileback to summary
private void serveFile(final HttpServerExchange exchange)
setFileback to summary
public FileErrorPageHandler setFile(final Path file)
setNextback to summary
public FileErrorPageHandler setNext(final HttpHandler next)
setResponseCodesback to summary
public FileErrorPageHandler setResponseCodes(final Set<Integer> responseCodes)
setResponseCodesback to summary
public FileErrorPageHandler setResponseCodes(final Integer... responseCodes)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
io.undertow.server.handlers.error back to summary

public Class FileErrorPageHandler.Builder

extends Object
implements HandlerBuilder
Class Inheritance
  • java.lang.Object
  • io.undertow.server.handlers.error.FileErrorPageHandler.Builder
All Implemented Interfaces
io.undertow.server.handlers.builder.HandlerBuilder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public HandlerWrapper
build(Map<String, Object>
The handler config
config
)

Implements io.undertow.server.handlers.builder.HandlerBuilder.build.

Creates the handler

public String
public String
name()

Implements io.undertow.server.handlers.builder.HandlerBuilder.name.

The string representation of the handler name.

public Map<String, Class<?>>
parameters()

Implements io.undertow.server.handlers.builder.HandlerBuilder.parameters.

Returns a map of parameters and their types.

public Set<String>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Builderback to summary
public Builder()

Method Detail

buildback to summary
public HandlerWrapper build(Map<String, Object> config)

Implements io.undertow.server.handlers.builder.HandlerBuilder.build.

Doc from io.undertow.server.handlers.builder.HandlerBuilder.build.

Creates the handler

Parameters
config:Map<String, Object>

The handler config

Returns:HandlerWrapper

The new predicate

Annotations
@Override
defaultParameterback to summary
public String defaultParameter()

Implements io.undertow.server.handlers.builder.HandlerBuilder.defaultParameter.

Returns:String

Doc from io.undertow.server.handlers.builder.HandlerBuilder.defaultParameter.

The default parameter name, or null if it does not have a default parameter

Annotations
@Override
nameback to summary
public String name()

Implements io.undertow.server.handlers.builder.HandlerBuilder.name.

Doc from io.undertow.server.handlers.builder.HandlerBuilder.name.

The string representation of the handler name.

Returns:String

The handler name

Annotations
@Override
parametersback to summary
public Map<String, Class<?>> parameters()

Implements io.undertow.server.handlers.builder.HandlerBuilder.parameters.

Doc from io.undertow.server.handlers.builder.HandlerBuilder.parameters.

Returns a map of parameters and their types.

Annotations
@Override
requiredParametersback to summary
public Set<String> requiredParameters()

Implements io.undertow.server.handlers.builder.HandlerBuilder.requiredParameters.

Returns:Set<String>

Doc from io.undertow.server.handlers.builder.HandlerBuilder.requiredParameters.

The required parameters

Annotations
@Override
io.undertow.server.handlers.error back to summary

private Class FileErrorPageHandler.Wrapper

extends Object
implements HandlerWrapper
Class Inheritance
  • java.lang.Object
  • io.undertow.server.handlers.error.FileErrorPageHandler.Wrapper
All Implemented Interfaces
io.undertow.server.HandlerWrapper

Field Summary

Modifier and TypeField and Description
private final String
private final Integer[]

Constructor Summary

AccessConstructor and Description
private
Wrapper(String file, Integer[] responseCodes)

Method Summary

Modifier and TypeMethod and Description
public HttpHandler
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fileback to summary
private final String file
responseCodesback to summary
private final Integer[] responseCodes

Constructor Detail

Wrapperback to summary
private Wrapper(String file, Integer[] responseCodes)

Method Detail

wrapback to summary
public HttpHandler wrap(HttpHandler handler)

Implements io.undertow.server.HandlerWrapper.wrap.

Annotations
@Override