public class GeneratedTextResource extends ServerResource
Executable
document for GET and POST verbs and redirects its standard
output to a StringRepresentation
.
document
, caching
, application
and
conversation
services are available as global variables in
scriptlets. See GeneratedTextResourceDocumentService
,
GeneratedTextResourceCachingService
, ApplicationService
and
GeneratedTextResourceConversationService
.
Before using this resource, make sure to configure a valid document source in
the application's Context
as
com.threecrickets.prudence.GeneratedTextResource.documentSource
.
This document source is exposed to scriptlets as document.source
.
This resource supports caching into implementations of Cache
. First,
the entire document is executed, with its output sent into a buffer. This
buffer is then cached, and only then sent to the client. Scriptlets
can control the duration of their individual cache by changing the value of
caching.duration
.
Because output is not sent to the client until after the executable finishes
its execution, it is possible for scriptlets to set output characteristics at
any time by changing the values of conversation.mediaType
,
conversation.characterSet
, and
conversation.language
.
There is experimental support for deferred response (asynchronous mode) via
conversation.defer
.
Summary of settings configured via the application's Context
:
com.threecrickets.prudence.cache:
Cache
.com.threecrickets.prudence.GeneratedTextResource.applicationServiceName
: Defaults to "application".com.threecrickets.prudence.GeneratedTextResource.cacheKeyTemplateHandlers
: ConcurrentMap
<String, String>com.threecrickets.prudence.GeneratedTextResource.cachingServiceName
: Defaults to "caching".com.threecrickets.prudence.GeneratedTextResource.clientCachingMode:
Integer
, defaults to
CachingUtil.CLIENT_CACHING_MODE_CONDITIONAL
.com.threecrickets.prudence.GeneratedTextResource.conversationServiceName
: Defaults to "conversation".com.threecrickets.prudence.GeneratedTextResource.debug:
Boolean
, defaults to false.com.threecrickets.prudence.GeneratedTextResource.defaultCacheKeyTemplate:
String
, defaults to "{ri}|{dn}|{nmt}|{nl}|{ne}".com.threecrickets.prudence.GeneratedTextResource.defaultCharacterSet:
CharacterSet
, defaults to CharacterSet.UTF_8
.com.threecrickets.prudence.GeneratedTextResource.defaultIncludedName:
String
, defaults to "index".com.threecrickets.prudence.GeneratedTextResource.defaultLanguageTag:
String
, defaults to "javascript".com.threecrickets.prudence.GeneratedTextResource.defaultName:
String
, defaults to "default".com.threecrickets.prudence.GeneratedTextResource.documentFormatter:
DocumentFormatter
. Defaults to a JygmentsDocumentFormatter
.
com.threecrickets.prudence.GeneratedTextResource.documentServiceName
: Defaults to "document".com.threecrickets.prudence.GeneratedTextResource.documentSource:
DocumentSource
. Required.com.threecrickets.prudence.GeneratedTextResource.encodeSizeThreshold:
Integer
, defaults to 1024.com.threecrickets.prudence.GeneratedTextResource.executionController:
ExecutionController
.com.threecrickets.prudence.GeneratedTextResource.fileUploadDirectory:
File
, defaults to "uploads" under the application root.com.threecrickets.prudence.GeneratedTextResource.fileUploadSizeThreshold:
Integer
, defaults to zero.com.threecrickets.prudence.GeneratedTextResource.extraDocumentSources:
Iterable
of DocumentSource
of Executable
.com.threecrickets.prudence.GeneratedTextResource.languageManager:
LanguageManager
, defaults to a new instance.com.threecrickets.prudence.GeneratedTextResource.libraryDocumentSources:
Iterable
of DocumentSource
of Executable
.com.threecrickets.prudence.GeneratedTextResource.maxClientCachingDuration:
Integer
, defaults to -1.com.threecrickets.prudence.GeneratedTextResource.negotiateEncoding:
defaults to a true.com.threecrickets.prudence.GeneratedTextResource.parserManager:
ParserManager
, defaults to a new instance.com.threecrickets.prudence.GeneratedTextResource.prepare:
Boolean
, defaults to true.com.threecrickets.prudence.GeneratedTextResource.sourceViewable:
Boolean
, defaults to false.com.threecrickets.prudence.GeneratedTextResource.trailingSlashRequired:
Boolean
, defaults to true."Restlet" is a registered trademark of Restlet S.A.S..
Constructor and Description |
---|
GeneratedTextResource() |
Modifier and Type | Method and Description |
---|---|
Representation |
delete() |
Representation |
delete(Variant variant) |
protected void |
doInit()
Initializes the resource.
|
void |
doRelease() |
Representation |
get() |
Representation |
get(Variant variant) |
com.threecrickets.prudence.internal.attributes.GeneratedTextResourceAttributes |
getAttributes()
The attributes as configured in the
Application context. |
RepresentationInfo |
getInfo() |
RepresentationInfo |
getInfo(Variant variant) |
Representation |
options() |
Representation |
options(Variant variant) |
Representation |
post(Representation entity) |
Representation |
post(Representation entity,
Variant variant) |
Representation |
put(Representation entity) |
Representation |
put(Representation entity,
Variant variant) |
abort, commit, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doNegotiatedHandle, getAttribute, getDescription, getName, getOnSent, getPreferredVariant, getRole, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, patch, patch, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDescription, setDimensions, setExisting, setLocationRef, setLocationRef, setName, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions
doError, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toString
public com.threecrickets.prudence.internal.attributes.GeneratedTextResourceAttributes getAttributes()
Application
context.protected void doInit() throws ResourceException
doInit
in class Resource
ResourceException
public Representation get() throws ResourceException
get
in class ServerResource
ResourceException
public Representation get(Variant variant) throws ResourceException
get
in class ServerResource
ResourceException
public Representation post(Representation entity) throws ResourceException
post
in class ServerResource
ResourceException
public Representation post(Representation entity, Variant variant) throws ResourceException
post
in class ServerResource
ResourceException
public Representation put(Representation entity) throws ResourceException
put
in class ServerResource
ResourceException
public Representation put(Representation entity, Variant variant) throws ResourceException
put
in class ServerResource
ResourceException
public Representation delete() throws ResourceException
delete
in class ServerResource
ResourceException
public Representation delete(Variant variant) throws ResourceException
delete
in class ServerResource
ResourceException
public Representation options() throws ResourceException
options
in class ServerResource
ResourceException
public Representation options(Variant variant) throws ResourceException
options
in class ServerResource
ResourceException
public RepresentationInfo getInfo() throws ResourceException
getInfo
in class ServerResource
ResourceException
public RepresentationInfo getInfo(Variant variant) throws ResourceException
getInfo
in class ServerResource
ResourceException
Copyright © 2009-2016 Three Crickets LLC.