|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.rest.entityDelegates.ERXAbstractRestResponseWriter
er.rest.entityDelegates.ERXXmlRestResponseWriter
public class ERXXmlRestResponseWriter
Provides the common output methods for generating XML responses to a REST request.
The response writers can be used in two styles. In one style, they can be connected to a rest request handler and are controlled with Properties. In another form, they can be used programmatically and can be configured with ERXKeyFilters to control their output. ERXKeyFilters provides a really bad version of Rails' to_json :include maps.
ERXKeyFilter companyFilter = new ERXKeyFilter(ERXKeyFilter.Base.Attributes); ERXKeyFilter remindersFilter = companyFilter.include(Company.REMINDERS); remindersFilter.include(Reminder.SUMMARY); remindersFilter.exclude(Reminder.CREATION_DATE); ERXPListRestResponseWriter writer = new ERXPListRestResponseWriter(companyFilter); String str = writer.toString(Company.fetchRequiredCompany(ERXEC.newEditingContext(), Company.NAME.is("mDT Consulting")));
Field Summary |
---|
Fields inherited from interface er.rest.entityDelegates.IERXRestResponseWriter |
---|
DETAILS_PREFIX, DETAILS_PROPERTIES_PREFIX, REST_PREFIX |
Constructor Summary | |
---|---|
ERXXmlRestResponseWriter()
Constructs an ERXXmlRestResponseWriter with displayAllProperties = false. |
|
ERXXmlRestResponseWriter(boolean displayAllProperties,
boolean displayAllToMany)
Constructs an ERXXmlRestResponseWriter. |
|
ERXXmlRestResponseWriter(ERXKeyFilter filter)
Constructs an ERXXmlRestResponseWriter. |
Method Summary | |
---|---|
protected void |
appendArrayToResponse(ERXRestContext context,
IERXRestResponse response,
ERXRestKey result,
java.lang.String arrayName,
java.lang.String entityName,
com.webobjects.foundation.NSArray valueKeys,
int indent,
com.webobjects.foundation.NSMutableSet<java.lang.Object> visitedObjects)
Writes the given array of objects to the response. |
protected void |
appendDetailsToResponse(ERXRestContext context,
IERXRestResponse response,
com.webobjects.eoaccess.EOEntity entity,
com.webobjects.eocontrol.EOEnterpriseObject eo,
java.lang.String objectName,
java.lang.String entityName,
java.lang.Object id,
com.webobjects.foundation.NSArray displayKeys,
int indent,
com.webobjects.foundation.NSMutableSet<java.lang.Object> visitedObjects)
Writes the visible details of an object to the response. |
protected void |
appendNoDetailsToResponse(ERXRestContext context,
IERXRestResponse response,
com.webobjects.eoaccess.EOEntity entity,
com.webobjects.eocontrol.EOEnterpriseObject eo,
java.lang.String objectName,
java.lang.String entityName,
java.lang.Object id,
int indent)
Write an object to the response without showing its details. |
protected void |
appendPrimitiveToResponse(ERXRestContext context,
IERXRestResponse response,
ERXRestKey result,
int indent,
java.lang.Object value)
Writes the bare primitive out to the response. |
void |
appendToResponse(ERXRestContext context,
IERXRestResponse response,
ERXRestKey result)
Called at the end of a request to produce the output to the user. |
protected void |
appendTypeToResponse(IERXRestResponse response,
java.lang.Object value)
|
protected void |
appendVisitedToResponse(ERXRestContext context,
IERXRestResponse response,
com.webobjects.eoaccess.EOEntity entity,
com.webobjects.eocontrol.EOEnterpriseObject eo,
java.lang.String objectName,
java.lang.String entityName,
java.lang.Object id,
int indent)
Write an object to the response that has already been visited. |
Methods inherited from class er.rest.entityDelegates.ERXAbstractRestResponseWriter |
---|
appendArrayToResponse, appendDictionaryToResponse, appendToResponse, displayDetails, displayProperties, indent, toString, toString, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ERXXmlRestResponseWriter()
public ERXXmlRestResponseWriter(boolean displayAllProperties, boolean displayAllToMany)
displayAllProperties
- if true, by default all properties are eligible to be displayed (probably should only be true in
development, but it won't really hurt anything). Note that entity delegates will still control
permissions on the properties, it just defaults to checking all of them.displayAllToMany
- if true, all to-many relationships will be displayedpublic ERXXmlRestResponseWriter(ERXKeyFilter filter)
Method Detail |
---|
public void appendToResponse(ERXRestContext context, IERXRestResponse response, ERXRestKey result) throws ERXRestException, ERXRestSecurityException, ERXRestNotFoundException, java.text.ParseException
IERXRestResponseWriter
appendToResponse
in interface IERXRestResponseWriter
appendToResponse
in class ERXAbstractRestResponseWriter
context
- the rest contextresponse
- the response to write intoresult
- the result of the rest request
ERXRestException
- if there is a general failure
ERXRestSecurityException
- if there is a security violation
ERXRestNotFoundException
- if there is a missing entity
ParseException
- if there is a parse errorprotected void appendTypeToResponse(IERXRestResponse response, java.lang.Object value)
protected void appendArrayToResponse(ERXRestContext context, IERXRestResponse response, ERXRestKey result, java.lang.String arrayName, java.lang.String entityName, com.webobjects.foundation.NSArray valueKeys, int indent, com.webobjects.foundation.NSMutableSet<java.lang.Object> visitedObjects) throws ERXRestException, ERXRestSecurityException, ERXRestNotFoundException, java.text.ParseException
ERXAbstractRestResponseWriter
appendArrayToResponse
in class ERXAbstractRestResponseWriter
context
- the rest contextresponse
- the responseresult
- the current keyarrayName
- the name of the array in the context of its parententityName
- the entity name of the contents of the arrayvalueKeys
- an array of ERXRestKeys that represent the entries in the arrayindent
- the indent levelvisitedObjects
- the list of objects that have been visited already in this request (to prevent infinite loops)
ERXRestException
- if a general error occurs
ERXRestSecurityException
- if a security error occurs
ERXRestNotFoundException
- if an object is not found
ParseException
- if a parse error occursprotected void appendVisitedToResponse(ERXRestContext context, IERXRestResponse response, com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, java.lang.String objectName, java.lang.String entityName, java.lang.Object id, int indent)
ERXAbstractRestResponseWriter
appendVisitedToResponse
in class ERXAbstractRestResponseWriter
context
- the rest contextresponse
- the responseentity
- the entity of the objecteo
- the current objectobjectName
- the name of the object (relative to its parent)entityName
- the entity name of the objectid
- the id of the objectindent
- the indent levelprotected void appendNoDetailsToResponse(ERXRestContext context, IERXRestResponse response, com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, java.lang.String objectName, java.lang.String entityName, java.lang.Object id, int indent)
ERXAbstractRestResponseWriter
appendNoDetailsToResponse
in class ERXAbstractRestResponseWriter
context
- the rest contextresponse
- the responseentity
- the entity of the objecteo
- the current objectobjectName
- the name of the object (relative to its parent)entityName
- the entity name of the objectid
- the id of the objectindent
- the indent levelprotected void appendDetailsToResponse(ERXRestContext context, IERXRestResponse response, com.webobjects.eoaccess.EOEntity entity, com.webobjects.eocontrol.EOEnterpriseObject eo, java.lang.String objectName, java.lang.String entityName, java.lang.Object id, com.webobjects.foundation.NSArray displayKeys, int indent, com.webobjects.foundation.NSMutableSet<java.lang.Object> visitedObjects) throws ERXRestException, ERXRestSecurityException, ERXRestNotFoundException, java.text.ParseException
ERXAbstractRestResponseWriter
appendDetailsToResponse
in class ERXAbstractRestResponseWriter
context
- the rest contextresponse
- the responseentity
- the entity of the objecteo
- the current objectobjectName
- the name of the object (relative to its parent)entityName
- the entity name of the objectid
- the id of the objectdisplayKeys
- the list of ERXRestKeys to displayindent
- the indent levelvisitedObjects
- the list of objects that have been visited already in this request (to prevent infinite loops)
ERXRestException
- if a general error occurs
ERXRestSecurityException
- if a security error occurs
ERXRestNotFoundException
- if an object is not found
ParseException
- if a parse error occursprotected void appendPrimitiveToResponse(ERXRestContext context, IERXRestResponse response, ERXRestKey result, int indent, java.lang.Object value) throws ERXRestException
ERXAbstractRestResponseWriter
appendPrimitiveToResponse
in class ERXAbstractRestResponseWriter
context
- the rest contextresponse
- the responseresult
- the current keyindent
- the indent levelvalue
- the value to append
ERXRestException
- if a general failure occurs
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |