Class ServerObject

java.lang.Object
com.smartgwt.client.docs.serverds.ServerObject

public class ServerObject extends Object
The ServerObject tells the ISC server how to find or create a server-side object involved in 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.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Specifies 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.
    For use when lookupStyle is "spring" or "cdi", id (name) of the bean to ask Spring (CDI) to create.
    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 the DataSource 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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • bean

      public String bean
      For use when lookupStyle is "spring" or "cdi", id (name) of the bean to ask Spring (CDI) to create.

      Default value is null

    • dropExtraFields

      public Boolean 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 in DMI for details. The value of this attribute overrides DataSource.dropExtraFields.

      Default value is null

    • methodName

      public String 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 the 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

    • attributeName

      public String attributeName
      Specifies the name of the attribute by which to look up the DMI instance. This attribute is consulted only when the value of lookupStyle is "attribute".

      Default value is null

      See Also:
    • className

      public 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").

      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

      See Also:
    • lookupStyle

      public String 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 also ServerInit 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 by className 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 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.
      • "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 in attributeName.

      Default value is "new"

      See Also:
    • attributeScope

      public String attributeScope
      Specifies the scope in which the DMI instance is to be looked up. Valid values are: "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

      See Also:
    • ID

      public 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(). 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

      public String targetXPath
      If set, the Smart GWT server will use JXPath to call your server code. The 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

    • crudOnly

      public 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). 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

  • Constructor Details

    • ServerObject

      public ServerObject()