public class DelegatedResource extends ServerResource
Executable
via entry points. The entry points must be global
functions, closures, or whatever other technique the language engine uses to
for entry points.
Supported entry points are:
handleInit()
handleGet()
handleGetInfo()
handlePost()
handlePut()
handleDelete()
handleOptions()
A conversation
service is sent as an argument to all entry
points. Additionally, document
, caching
, and
application
services are available as global variables. See
DelegatedResourceConversationService
,
DelegatedResourceDocumentService
,
DelegatedResourceCachingService
, and ApplicationService
.
Before using this resource, make sure to configure a valid document source in
the application's Context
as
com.threecrickets.prudence.DelegatedResource.documentSource
.
This document source is exposed to the executable as
document.source
.
For a simpler delegate, see DelegatedHandler
.
Summary of settings configured via the application's Context
:
com.threecrickets.prudence.cache:
Cache
.com.threecrickets.prudence.DelegatedResource.applicationServiceName
: Defaults to "application".com.threecrickets.prudence.DelegatedResource.cacheKeyTemplateHandlers
: ConcurrentMap
<String, String>com.threecrickets.prudence.DelegatedResource.cachingServiceName
: Defaults to "caching".com.threecrickets.prudence.DelegatedResource.clientCachingMode:
Integer
, defaults to
CachingUtil.CLIENT_CACHING_MODE_CONDITIONAL
.com.threecrickets.prudence.DelegatedResource.defaultCacheKeyTemplate:
String
, defaults to "{ri}|{dn}|{nmt}|{nl}|{ne}".com.threecrickets.prudence.DelegatedResource.defaultCharacterSet:
CharacterSet
, defaults to CharacterSet.UTF_8
.com.threecrickets.prudence.DelegatedResource.defaultLanguageTag:
String
, defaults to "javascript".com.threecrickets.prudence.DelegatedResource.debug:
Boolean
, defaults to false.com.threecrickets.prudence.DelegatedResource.defaultName:
String
, defaults to "default".com.threecrickets.prudence.DelegatedResource.documentFormatter:
DocumentFormatter
. Defaults to a JygmentsDocumentFormatter
.
com.threecrickets.prudence.DelegatedResource.documentServiceName
: Defaults to "document".com.threecrickets.prudence.DelegatedResource.documentSource:
DocumentSource
. Required.com.threecrickets.prudence.DelegatedResource.encodeSizeThreshold:
Integer
, defaults to 1024.com.threecrickets.prudence.DelegatedResource.entryPointNameForDelete:
String
, defaults to "handleDelete".com.threecrickets.prudence.DelegatedResource.entryPointNameForGet:
String
, defaults to "handleGet".com.threecrickets.prudence.DelegatedResource.entryPointNameForGetInfo:
String
, defaults to "handleGetInfo".com.threecrickets.prudence.DelegatedResource.entryPointNameForInit:
String
, defaults to "handleInit".com.threecrickets.prudence.DelegatedResource.entryPointNameForOptions:
String
, defaults to "handleOptions".com.threecrickets.prudence.DelegatedResource.entryPointNameForPost:
String
, defaults to "handlePost".com.threecrickets.prudence.DelegatedResource.entryPointNameForPut:
String
, defaults to "handlePut".com.threecrickets.prudence.DelegatedResource.errorWriter:
Writer
, defaults to standard error.com.threecrickets.prudence.DelegatedResource.executionController:
ExecutionController
.com.threecrickets.prudence.DelegatedResource.fileUploadDirectory:
File
, defaults to "uploads" under the application root.com.threecrickets.prudence.DelegatedResource.fileUploadSizeThreshold:
Integer
, defaults to zero.com.threecrickets.prudence.DelegatedResource.languageManager:
LanguageManager
, defaults to a new instance.com.threecrickets.prudence.DelegatesResource.libraryDocumentSources:
Iterable
of DocumentSource
of Executable
.com.threecrickets.prudence.DelegatedResource.maxClientCachingDuration:
Integer
, defaults to -1.com.threecrickets.prudence.DelegatedResource.negotiateEncoding:
defaults to a true.com.threecrickets.prudence.DelegatedResource.parserManager:
ParserManager
, defaults to a new instance.com.threecrickets.prudence.DelegatedResource.prepare:
Boolean
, defaults to true.com.threecrickets.prudence.DelegatedResource.sourceViewable:
Boolean
, defaults to false.com.threecrickets.prudence.DelegatedResource.trailingSlashRequired:
Boolean
, defaults to true.com.threecrickets.prudence.DelegatedResource.writer:
Writer
, defaults to standard output."Restlet" is a registered trademark of Restlet S.A.S..
Modifier and Type | Field and Description |
---|---|
static String |
DOCUMENT_NAME_ATTRIBUTE
Document name attribute for a
Request . |
Constructor and Description |
---|
DelegatedResource() |
Modifier and Type | Method and Description |
---|---|
Representation |
delete()
Delegates to the
handleDelete() entry point in the
executable. |
Representation |
delete(Variant variant)
Delegates to the
handleDelete() entry point in the
executable. |
protected void |
doInit()
Initializes the resource, and delegates to the
handleInit()
entry point in the executable. |
void |
doRelease() |
Representation |
get()
Delegates to the
handleGet() entry point in the executable. |
Representation |
get(Variant variant)
Delegates to the
handleGet() entry point in the executable. |
com.threecrickets.prudence.internal.attributes.DelegatedResourceAttributes |
getAttributes()
The attributes as configured in the
Application context. |
RepresentationInfo |
getInfo()
Delegates to the
handleGetInfo() entry point in the
executable. |
RepresentationInfo |
getInfo(Variant variant)
Delegates to the
handleGetInfo() entry point in the
executable. |
Representation |
options()
Delegates to the
handleOptions() entry point in the
executable. |
Representation |
options(Variant variant)
Delegates to the
handleOptions() entry point in the
executable. |
Representation |
post(Representation entity)
Delegates to the
handlePost() entry point in the executable. |
Representation |
post(Representation entity,
Variant variant)
Delegates to the
handlePost() entry point in the executable. |
Representation |
put(Representation entity)
Delegates to the
handlePut() entry point in the executable. |
Representation |
put(Representation entity,
Variant variant)
Delegates to the
handlePut() entry point in the executable. |
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.DelegatedResourceAttributes getAttributes()
Application
context.protected void doInit() throws ResourceException
handleInit()
entry point in the executable.doInit
in class Resource
ResourceException
public Representation get() throws ResourceException
handleGet()
entry point in the executable.get
in class ServerResource
ResourceException
- In case of a handling errorpublic Representation get(Variant variant) throws ResourceException
handleGet()
entry point in the executable.get
in class ServerResource
variant
- The variant of the response entityResourceException
- In case of a handling errorpublic RepresentationInfo getInfo() throws ResourceException
handleGetInfo()
entry point in the
executable.getInfo
in class ServerResource
ResourceException
- In case of a handling errorpublic RepresentationInfo getInfo(Variant variant) throws ResourceException
handleGetInfo()
entry point in the
executable.getInfo
in class ServerResource
variant
- The variant of the response entityResourceException
- In case of a handling errorpublic Representation post(Representation entity) throws ResourceException
handlePost()
entry point in the executable.post
in class ServerResource
entity
- The posted entityResourceException
- In case of a handling errorpublic Representation post(Representation entity, Variant variant) throws ResourceException
handlePost()
entry point in the executable.post
in class ServerResource
entity
- The posted entityvariant
- The variant of the response entityResourceException
- In case of a handling errorpublic Representation put(Representation entity) throws ResourceException
handlePut()
entry point in the executable.put
in class ServerResource
entity
- The posted entityResourceException
- In case of a handling errorpublic Representation put(Representation entity, Variant variant) throws ResourceException
handlePut()
entry point in the executable.put
in class ServerResource
entity
- The posted entityvariant
- The variant of the response entityResourceException
- In case of a handling errorpublic Representation delete() throws ResourceException
handleDelete()
entry point in the
executable.delete
in class ServerResource
ResourceException
- In case of a handling errorpublic Representation delete(Variant variant) throws ResourceException
handleDelete()
entry point in the
executable.delete
in class ServerResource
variant
- The variant of the response entityResourceException
- In case of a handling errorpublic Representation options() throws ResourceException
handleOptions()
entry point in the
executable.options
in class ServerResource
ResourceException
- In case of a handling errorpublic Representation options(Variant variant) throws ResourceException
handleOptions()
entry point in the
executable.options
in class ServerResource
variant
- The variant of the response entityResourceException
- In case of a handling errorCopyright © 2009-2016 Three Crickets LLC.