Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.labkey.remoteapi
Class PostCommand<ResponseType extends CommandResponse>

    java.lang.Object
      org.labkey.remoteapi.Command<ResponseType>
          org.labkey.remoteapi.PostCommand<ResponseType>

Direct Known Subclasses:
  CreateGroupCommand, CreateUserCommand, DeleteGroupCommand, ExecuteSqlCommand, GroupMembersCommand, RenameGroupCommand, SaveAssayBatchCommand, SaveRowsCommand

    public class PostCommand<ResponseType extends CommandResponse>

extends Command<ResponseType>

Base class for all commands that needs to post data to the server, rather than providing parameters in the query string.

Client code will not typically use this class directly, but will instead use one of the classes that extend this class (e.g., `UpdateRowsCommand`).

However, if future versions of the LabKey Server expose new HTTP APIs requiring a POST that are not yet supported with a specialized class in this library, the developer may still invoke these APIs by creating an instance of the PostCommand object directly, providing the controller and action name for the new API. The post body may then be supplied by overriding the `getJsonObject()` method, returning the JSON object to post.

Version:
  1.0
Author:
  Dave Stearns, LabKey Corporation

Nested Class Summary

Nested classes/interfaces inherited from class org.labkey.remoteapi.Command
`Command.CommonParameters`

Field Summary

Fields inherited from class org.labkey.remoteapi.Command
`CONTENT_TYPE_JSON`

Constructor Summary
`PostCommand(PostCommand source)`
`PostCommand(java.lang.String controllerName, java.lang.String actionName)` Constructs a new PostCommand given a controller and action name.

Method Summary
`PostCommand` | `copy()` Returns a copy of this object.
`protected org.apache.commons.httpclient.HttpMethod` | `createMethod()` Overrides `Command.createMethod()` to create a `PostMethod` object.
`org.json.simple.JSONObject` | `getJsonObject()` Returns the JSON object to post, or null if the JSON object has not yet been set.
`void` | `setJsonObject(org.json.simple.JSONObject jsonObject)` Sets the JSON object to post.

Methods inherited from class org.labkey.remoteapi.Command
`createResponse, execute, getActionName, getActionUrl, getControllerName, getHttpMethod, getParameters, getParamValueAsString, getQueryString, getRequiredVersion, getTimeout, setParameters, setRequiredVersion, setTimeout`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PostCommand

    public PostCommand(java.lang.String controllerName,
                       java.lang.String actionName)

  Constructs a new PostCommand given a controller and action name.

  Parameters:
    `controllerName` - The controller name.
    `actionName` - The action name.

### PostCommand

    public PostCommand(PostCommand source)

Method Detail

### getJsonObject

    public org.json.simple.JSONObject getJsonObject()

  Returns the JSON object to post, or null if the JSON object has not yet been set. Override this method to provide the JSON object dynamically.

  Returns:
    The JSON object to post.

### setJsonObject

    public void setJsonObject(org.json.simple.JSONObject jsonObject)

  Sets the JSON object to post.

  Parameters:
    `jsonObject` - The JSON object to post

### createMethod

    protected org.apache.commons.httpclient.HttpMethod createMethod()

  Overrides `Command.createMethod()` to create a `PostMethod` object.

  Override this method if your post command sends something other than JSON in the post body. In your override, create the PostMethod and set the RequestEntity appropriately.

  Overrides:
    `createMethod` in class `Command<ResponseType extends CommandResponse>`
  Returns:
    The PostMethod object.

### copy

    public PostCommand copy()

  Description copied from class: `Command`
  Returns a copy of this object. Derived classes should override this to copy their own data members

  Overrides:
    `copy` in class `Command<ResponseType extends CommandResponse>`
  Returns:
    A copy of this object

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD