Top Description Fields Constructors Methods
org.glassfish.grizzly.http.server.util

public Class HtmlHelper

extends Object
Class Inheritance
Imports
java.io.IOException, .Writer, org.glassfish.grizzly.http.server.ErrorPageGenerator, .Request, .Response, org.glassfish.grizzly.http.util.HttpStatus, .HttpUtils

Utility class used to generate HTML pages.
Author
Jean-Francois Arcand

Field Summary

Modifier and TypeField and Description
private static final String
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
public static String
getErrorPage(String headerMessage, String message, String serverName)

Returns: A String containing the HTTP response.

public static String
getExceptionErrorPage(String headerMessage, String message, String serverName, Throwable t)

private static int
private static Throwable
private static String
prepareBody(String headerMessage, String message, String serverName)

Prepare the HTTP body containing the error messages.

private static String
prepareExceptionBody(String headerMessage, String message, String serverName, Throwable t)

public static void
sendErrorPage(final Request request, final Response response, final ErrorPageGenerator generator, final int status, final String reasonPhrase, final String description, final Throwable exception)

Generate and send an error page for the given HTTP response status.

public static void
setErrorAndSendErrorPage(final Request request, final Response response, final ErrorPageGenerator generator, final int status, final String reasonPhrase, final String description, final Throwable exception)

Generate and send an error page for the given HTTP response status.

public static void
writeTraceMessage(final Request request, final Response response)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CSSback to summary
private static final String CSS
MAX_STACK_ELEMENTSback to summary
private static final int MAX_STACK_ELEMENTS

Constructor Detail

HtmlHelperback to summary
public HtmlHelper()

Method Detail

formatStackElementsback to summary
private static void formatStackElements(StackTraceElement[] elements, StringBuilder builder)
getErrorPageback to summary
public static String getErrorPage(String headerMessage, String message, String serverName)
Returns:String

A String containing the HTTP response.

getExceptionErrorPageback to summary
public static String getExceptionErrorPage(String headerMessage, String message, String serverName, Throwable t)
getMaxStackElementsToDisplayback to summary
private static int getMaxStackElementsToDisplay(StackTraceElement[] elements)
getRootCauseback to summary
private static Throwable getRootCause(Throwable t)
prepareBodyback to summary
private static String prepareBody(String headerMessage, String message, String serverName)

Prepare the HTTP body containing the error messages.

prepareExceptionBodyback to summary
private static String prepareExceptionBody(String headerMessage, String message, String serverName, Throwable t)
Annotations
@SuppressWarnings:ThrowableResultOfMethodCallIgnored
sendErrorPageback to summary
public static void sendErrorPage(final Request request, final Response response, final ErrorPageGenerator generator, final int status, final String reasonPhrase, final String description, final Throwable exception) throws IOException

Generate and send an error page for the given HTTP response status. Unlike setErrorAndSendErrorPage(org.glassfish.grizzly.http.server.Request, org.glassfish.grizzly.http.server.Response, org.glassfish.grizzly.http.server.ErrorPageGenerator, int, java.lang.String, java.lang.String, java.lang.Throwable), this method doesn't change the Response status code and reason phrase.

setErrorAndSendErrorPageback to summary
public static void setErrorAndSendErrorPage(final Request request, final Response response, final ErrorPageGenerator generator, final int status, final String reasonPhrase, final String description, final Throwable exception) throws IOException

Generate and send an error page for the given HTTP response status. Unlike setErrorAndSendErrorPage(org.glassfish.grizzly.http.server.Request, org.glassfish.grizzly.http.server.Response, org.glassfish.grizzly.http.server.ErrorPageGenerator, int, java.lang.String, java.lang.String, java.lang.Throwable), this method does change the Response status code and reason phrase.

writeTraceMessageback to summary
public static void writeTraceMessage(final Request request, final Response response) throws IOException