Class ServerObject
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 DSRequest
s) or in an Application configuration file (.app.xml) for
responding to RPCRequest
s.
NOTE: Please take note of the
points made in this discussion
of caching and thread-safety issues in server-side DataSources.
-
Field Summary
Modifier and TypeFieldDescriptionSpecifies the name of the attribute by which to look up the DMI instance.Specifies the scope in which the DMI instance is to be looked up.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").For a ServerObject defined at theDataSource level
, by default we only allow it to intercept standard CRUD operations (ie, ordinary fetches, adds, updates and removes).By default, for DMI DSResponses, DSResponse.data is filtered on the server to just the set of fields defined on the DataSource.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().Specifies the mechanism for locating the class instance on which to invoke the method.Specifies the name of the method to call for operations using this ServerObject.If set, the Smart GWT server will use JXPath to call your server code. -
Constructor Summary
-
Method Summary
-
Field Details
-
bean
For use whenlookupStyle
is"spring"
or"cdi"
, id (name) of the bean to ask Spring (CDI) to create.Default value is null
-
dropExtraFields
By default, for DMI DSResponses, DSResponse.data is filtered on the server to just the set of fields defined on the DataSource. This behavior can be overridden in several ways - see the overview inDMI
for details. The value of this attribute overridesDataSource.dropExtraFields
.Default value is null
-
methodName
Specifies the name of the method to call for operations using this ServerObject. This is a DataSource-level default; you can override it for individual operations either by specifying theOperationBinding.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
-
attributeName
Specifies the name of the attribute by which to look up the DMI instance. This attribute is consulted only when the value oflookupStyle
is"attribute"
.Default value is null
- See Also:
-
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").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 oflookupStyle
.It is also used for
"cdi"
value oflookupStyle
, to provide class name of the bean to ask CDI to create.Default value is null
- See Also:
-
lookupStyle
Specifies the mechanism for locating the class instance on which to invoke the method. Valid values are as follows:- "spring": For use with the Spring framework.
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 alsoServerInit
for special concerns with framework initialization when using Spring. - "cdi": For use with CDI (Contexts
and Dependency Injection). Use
bean
to configure the name of the bean to invoke or, alternatively,className
to configure its class name. - "new": A new instance of the class specified by
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 byclassName
is still used). - "factory": A custom factory provides the class instance on which the DMI method is to be
invoked. In this case,
className
specifies the className of the factory that will provide the instance on which the DMI method is to be invoked. The class specified byclassName
must provide exactly one method namedcreate
that must return the class instance on which you wish the DMI method to be invoked. Like the DMI methods, thecreate
method can request a standard set of values as arguments. SeeDMI
for a list of available values. - "attribute": The instance on which the DMI method is to be
invoked is looked up in the scope defined by
attributeScope
via the attribute name specified inattributeName
.
Default value is "new"
- See Also:
- "spring": For use with the Spring framework.
-
attributeScope
Specifies the scope in which the DMI instance is to be looked up. Valid values are:"request"
,"session"
, and"application"
. IfattributeScope
is left out of theServerObject
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
- See Also:
-
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(). This allows you to hide the name of the server-side class used as the factory or implementer of the DMI from the browser as a security precaution.Default value is null
- See Also:
-
targetXPath
If set, the Smart GWT server will use JXPath to call your server code. TheJXPathContext
(start point) will be the object arrived at by applying thelookupStyle
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
-
crudOnly
For a ServerObject defined at theDataSource 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 theOperationBinding 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
-
-
Constructor Details
-
ServerObject
public ServerObject()
-