Package com.helger.photon.app
Class PhotonUnifiedResponse
java.lang.Object
com.helger.servlet.response.UnifiedResponse
com.helger.photon.app.PhotonUnifiedResponse
public class PhotonUnifiedResponse
extends com.helger.servlet.response.UnifiedResponse
Extends the
UnifiedResponse with additional sanity methods for easier
pratical use.- Author:
- Philip Helger
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class com.helger.servlet.response.UnifiedResponse
DEFAULT_ALLOW_CONTENT_ON_REDIRECT, DEFAULT_ALLOW_CONTENT_ON_STATUS_CODE, DEFAULT_CONTENT_DISPOSITION_TYPE, DEFAULT_WARN_ON_DUPLICATE_COOKIES, MAX_CSS_KB_FOR_IE -
Constructor Summary
ConstructorsConstructorDescriptionPhotonUnifiedResponse(com.helger.http.EHttpVersion eHttpVersion, com.helger.commons.http.EHttpMethod eHttpMethod, jakarta.servlet.http.HttpServletRequest aHttpRequest, com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope) -
Method Summary
Modifier and TypeMethodDescriptionattachment(String sFilename) binary(com.helger.commons.io.stream.NonBlockingByteArrayOutputStream aBAOS, com.helger.commons.mime.IMimeType aMimeType, String sFilename) HTTP 202 AcceptedHTTP 400 Bad RequestHTTP 409 ConflictHTTP 500 Internal Server ErrorHTTP 204 No ContentHTTP 404 Not FoundcreateOk()HTTP 200 OKHTTP 412 Precondition FailedcreateSeeOther(com.helger.commons.url.ISimpleURL aRedirectTargetURL) HTTP 303 See Otherstatic PhotonUnifiedResponsecreateSimple(com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope) Factory methodfinal com.helger.json.serialize.IJsonWriterSettingsprotected final com.helger.web.scope.IRequestWebScopeWithoutResponsefinal com.helger.xml.serialize.write.IXMLWriterSettingshtml(com.helger.html.hc.IHCHasChildrenMutable<?, ? super com.helger.html.hc.IHCNode> aNode, com.helger.html.hc.config.IHCOnDocumentReadyProvider aOnDocumentReadyProvider, com.helger.json.IJsonObject aCustomJson) html(com.helger.html.hc.IHCNode aNode) htmlSimple(com.helger.html.hc.IHCNode aNode) Create a simple HTML response without JSON structuringjson(com.helger.json.IJson aValue) pdf(com.helger.commons.io.stream.NonBlockingByteArrayOutputStream aBAOS) serialized(Serializable aObj) setContent(com.helger.commons.io.stream.NonBlockingByteArrayOutputStream aBAOS) final voidsetJsonWriterSettings(com.helger.json.serialize.IJsonWriterSettings aJWS) final voidsetXMLWriterSettings(com.helger.xml.serialize.write.IXMLWriterSettings aXWS) xml(com.helger.xml.microdom.IMicroNode aNode) xml(com.helger.xml.microdom.IMicroNode aNode, com.helger.xml.serialize.write.IXMLWriterSettings aSettings) Methods inherited from class com.helger.servlet.response.UnifiedResponse
addCookie, addCustomResponseHeader, addCustomResponseHeaders, applyToResponse, cacheControl, createSimple, disableCaching, enableCaching, getAllCookies, getCharset, getContentDispositionFilename, getContentDispositionType, getHttpMethod, getHttpVersion, getLogPrefix, getMimeType, getRequestBrowserInfo, getRequestURL, getStatusCode, hasContent, hasCookies, isAllowContentOnRedirect, isAllowContentOnStatusCode, isHttpHeaderValuesQuoteIfNecessary, isHttpHeaderValuesUnified, isRedirectDefined, isSilentMode, isStatusCodeDefined, isWarnOnDuplicateCookies, logError, logInfo, logWarn, removeAllCookies, removeCacheControl, removeCaching, removeCharset, removeContent, removeContentDispositionFilename, removeCookie, removeCustomResponseHeaders, removeETag, removeExpires, removeLastModified, removeMimeType, removeStrictTransportSecurity, removeXFrameOptions, responseHeaderMap, setAllowContentOnRedirect, setAllowContentOnStatusCode, setAllowMimeSniffing, setCacheControl, setCharset, setContent, setContent, setContent, setContentAndCharset, setContentDispositionFilename, setContentDispositionType, setCustomResponseHeader, setCustomResponseHeaders, setDownloadFilename, setEmptyContent, setEnableXSSFilter, setETag, setETagIfApplicable, setExpires, setHttpHeaderValuesQuoteIfNecessary, setHttpHeaderValuesUnified, setLastModified, setMimeType, setMimeTypeString, setRedirect, setRedirect, setRedirect, setRedirect, setRequestBrowserInfo, setSilentMode, setStatus, setStatusUnauthorized, setStrictTransportSecurity, setWarnOnDuplicateCookies, setXFrameOptions, showRequestInfo
-
Constructor Details
-
PhotonUnifiedResponse
-
-
Method Details
-
getRequestScope
protected final com.helger.web.scope.IRequestWebScopeWithoutResponse getRequestScope() -
getXMLWriterSettings
-
setXMLWriterSettings
public final void setXMLWriterSettings(@Nonnull com.helger.xml.serialize.write.IXMLWriterSettings aXWS) -
getJsonWriterSettings
-
setJsonWriterSettings
public final void setJsonWriterSettings(@Nonnull com.helger.json.serialize.IJsonWriterSettings aJWS) -
jsonEmpty
-
json
-
xml
-
xml
-
xml
-
xml
@Nonnull public PhotonUnifiedResponse xml(@Nullable com.helger.xml.microdom.IMicroNode aNode, @Nonnull com.helger.xml.serialize.write.IXMLWriterSettings aSettings) -
xml
-
xml
@Nonnull public PhotonUnifiedResponse xml(@Nullable Node aNode, @Nonnull com.helger.xml.serialize.write.IXMLWriterSettings aSettings) -
text
-
html
-
html
@Nonnull public PhotonUnifiedResponse html(@Nullable com.helger.html.hc.IHCHasChildrenMutable<?, ? super com.helger.html.hc.IHCNode> aNode, @Nullable com.helger.html.hc.config.IHCOnDocumentReadyProvider aOnDocumentReadyProvider, @Nullable com.helger.json.IJsonObject aCustomJson) -
htmlSimple
Create a simple HTML response without JSON structuring- Parameters:
aNode- The node to be rendered. May benull.- Returns:
- this for chaining
-
createOk
HTTP 200 OK- Returns:
- this for chaining
-
createAccepted
HTTP 202 Accepted- Returns:
- this for chaining
- Since:
- 8.1.3
-
createNoContent
HTTP 204 No Content- Returns:
- this for chaining
-
createSeeOther
@Nonnull public PhotonUnifiedResponse createSeeOther(@Nonnull com.helger.commons.url.ISimpleURL aRedirectTargetURL) HTTP 303 See Other- Parameters:
aRedirectTargetURL- The redirect URL. May not benull.- Returns:
- this for chaining
-
createBadRequest
HTTP 400 Bad Request- Returns:
- this for chaining
-
createNotFound
HTTP 404 Not Found- Returns:
- this for chaining
-
createConflict
HTTP 409 Conflict- Returns:
- this for chaining
-
createPreconditionFailed
HTTP 412 Precondition Failed- Returns:
- this for chaining
-
createInternalServerError
HTTP 500 Internal Server Error- Returns:
- this for chaining
-
setContent
@Nonnull public PhotonUnifiedResponse setContent(@Nonnull com.helger.commons.io.stream.NonBlockingByteArrayOutputStream aBAOS) -
serialized
-
pdf
@Nonnull public PhotonUnifiedResponse pdf(@Nonnull com.helger.commons.io.stream.NonBlockingByteArrayOutputStream aBAOS) -
pdf
@Nonnull public PhotonUnifiedResponse pdf(@Nonnull byte[] aData, @Nonnull @Nonempty String sFilename) -
pdf
@Nonnull public PhotonUnifiedResponse pdf(@Nonnull com.helger.commons.io.stream.NonBlockingByteArrayOutputStream aBAOS, @Nonnull @Nonempty String sFilename) -
attachment
-
binary
-
createSimple
@Nonnull public static PhotonUnifiedResponse createSimple(@Nonnull com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope) Factory method- Parameters:
aRequestScope- The current request scope. May not benull.- Returns:
- New
PhotonUnifiedResponse. Nevernull.
-