public class ServerObject
extends java.lang.Object DMI (Direct Method Invocation). This class is not meant to be created and used, it is actually documentation of settings allowed in a DataSource descriptor (.ds.xml file), for use with Smart GWT Pro Edition and above. See com.smartgwt.client.docs.serverds for how to use this documentation.
A ServerObject declaration appears in the XML definition of a DataSource (for responding to DSRequests) or in an Application configuration file (.app.xml) for responding to RPCRequests.
NOTE: Please take note of the points made in this discussion of caching and thread-safety issues in server-side DataSources.
| Modifier and Type | Field and Description |
|---|---|
java.lang.String | attributeName Specifies the name of the attribute by which to look up the DMI instance. |
java.lang.String | attributeScope Specifies the scope in which the DMI instance is to be looked up. |
java.lang.String | bean |
java.lang.String | className Specifies the fully-qualified class name that provides the server-side endpoint of the DMI ( lookupStyle:"new") or the class name of the factory that produces the DMI instance (lookupStyle:"factory"). |
java.lang.Boolean | crudOnly For a ServerObject defined at the DataSource level, by default we only allow it to intercept standard CRUD operations (ie, ordinary fetches, adds, updates and removes). |
java.lang.Boolean | dropExtraFields By default, for DMI DSResponses, DSResponse.data is filtered on the server to just the set of fields defined on the DataSource. |
java.lang.String | ID You can optionally specify an ID on the ServerObject config block - in which case you can use that value as the "className" argument when calling DMI.call(). |
java.lang.String | lookupStyle Specifies the mechanism for locating the class instance on which to invoke the method. |
java.lang.String | methodName Specifies the name of the method to call for operations using this ServerObject. |
java.lang.String | targetXPath If set, the Smart GWT server will use JXPath to call your server code. |
| Constructor and Description |
|---|
ServerObject() |
public java.lang.String bean
lookupStyle is "spring" or "cdi", id (name) of the bean to ask Spring (CDI) to create. Default value is null
public java.lang.Boolean dropExtraFields
DMI for details. The value of this attribute overrides DataSource.dropExtraFields. Default value is null
public java.lang.String methodName
OperationBinding.serverMethod attribute, or by declaring an operation-level serverObject that specifies a different methodName (if you specify both an operationBinding.serverMethod and an operation-level serverObject.methodName, the latter takes precedence) Default value is null
public java.lang.String attributeName
lookupStyle is "attribute". Default value is null
attributeScope, lookupStylepublic java.lang.String className
lookupStyle:"new") or the class name of the factory that produces the DMI instance (lookupStyle:"factory"). This is one of the values that you need to pass to DMI.call() to invoke the DMI from the client.
The value of this attribute is used for "new" and "factory" values of lookupStyle.
It is also used for "cdi" value of lookupStyle, to provide class name of the bean to ask CDI to create.
Default value is null
lookupStyle, IDpublic java.lang.String lookupStyle
bean contains the name of the bean to invoke. Which application context is used can be configured via web.xml (see the example web.xml in the SDK). See also ServerInit for special concerns with framework initialization when using Spring. bean to configure the name of the bean to invoke or, alternatively, className to configure its class name. className will be created and the DMI method will be invoked on that instance (unless the specified method is static, in which case no instance is created, but the class specified by className is still used). className specifies the className of the factory that will provide the instance on which the DMI method is to be invoked. The class specified by className must provide exactly one method named create that must return the class instance on which you wish the DMI method to be invoked. Like the DMI methods, the create method can request a standard set of values as arguments. See DMI for a list of available values. attributeScope via the attribute name specified in attributeName. Default value is "new"
className, bean, attributeName, attributeScopepublic java.lang.String attributeScope
"request", "session", and "application". If attributeScope is left out of the ServerObject definition, then all scopes are searched in the order in which they are listed above. This attribute is consulted only when the value of lookupStyle is "attribute".
Default value is null
attributeName, lookupStylepublic java.lang.String ID
Default value is null
classNamepublic java.lang.String targetXPath
JXPathContext (start point) will be the object arrived at by applying the lookupStyle and related ServerObject properties. The intention of this property is to allow easier access to your existing Java objects and reduce the need to write Smart GWT-specific server code. Default value is null
public java.lang.Boolean crudOnly
DataSource level, by default we only allow it to intercept standard CRUD operations (ie, ordinary fetches, adds, updates and removes). To allow the ServerObject to intercept other types of operation - custom operations, validations, etc - set this property to false. Note that ServerObjects declared at the OperationBinding level always intercept that operation, whatever its type, and this property has no effect. NOTE: If you are intercepting operations on the server because you wish to inspect them before deciding whether to process them with bespoke code or allow them to proceed with normal processing, the way to invoke normal processing without causing any interference is:
return dsRequest.execute();
Default value is null