# OpenLayers.Protocol

Abstract vector layer protocol class. Not to be instantiated directly. Use one of the protocol subclasses instead.

Summary

OpenLayers.Protocol | Abstract vector layer protocol class.
Properties |
format | {OpenLayers.Format} The format used by this protocol.
options | {Object} Any options sent to the constructor.
autoDestroy | {Boolean} The creator of the protocol can set autoDestroy to false to fully control when the protocol is destroyed.
defaultFilter | {OpenLayers.Filter} Optional default filter to read requests
Constructor |
OpenLayers.Protocol | Abstract class for vector protocols.
Functions |
mergeWithDefaultFilter | Merge filter passed to the read method with the default one
destroy | Clean up the protocol.
read | Construct a request for reading new features.
create | Construct a request for writing newly created features.
update | Construct a request updating modified features.
delete | Construct a request deleting a removed feature.
commit | Go over the features and for each take action based on the feature state.
abort | Abort an ongoing request.
createCallback | Returns a function that applies the given public method with resp and options arguments.
OpenLayers.Protocol.Response | Protocols return Response objects to their users.
Properties |
code |
requestType | {String} The type of request this response corresponds to.
last |
features | {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features returned in the response by the server.
data | {Object} The data returned in the response by the server.
reqFeatures | {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features provided by the user and placed in the request by the protocol.
priv |
error | {Object} The error object in case a service exception was encountered.
Constructor |
OpenLayers.Protocol.Response |
Functions |
success |

### Properties

### format

{OpenLayers.Format} The format used by this protocol.

### options

{Object} Any options sent to the constructor.

### autoDestroy

{Boolean} The creator of the protocol can set autoDestroy to false to fully control when the protocol is destroyed. Defaults to true.

### defaultFilter

{OpenLayers.Filter} Optional default filter to read requests

### Constructor

### OpenLayers.Protocol

Abstract class for vector protocols. Create instances of a subclass.

#### Parameters

options | {Object} Optional object whose properties will be set on the instance.

### Functions

### mergeWithDefaultFilter

> mergeWithDefaultFilter: function( | filter | )

Merge filter passed to the read method with the default one

#### Parameters

filter | {OpenLayers.Filter}

### destroy

> destroy: function()

Clean up the protocol.

### read

> read: function( | options | )

Construct a request for reading new features.

#### Parameters

options | {Object} Optional object for configuring the request.

#### Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object, the same object will be passed to the callback function passed if one exists in the options object.

### create

> create: function()

Construct a request for writing newly created features.

#### Parameters

features | {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector}
options | {Object} Optional object for configuring the request.

#### Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object, the same object will be passed to the callback function passed if one exists in the options object.

### update

> update: function()

Construct a request updating modified features.

#### Parameters

features | {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector}
options | {Object} Optional object for configuring the request.

#### Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object, the same object will be passed to the callback function passed if one exists in the options object.

### delete

> "delete": function()

Construct a request deleting a removed feature.

#### Parameters

feature | {OpenLayers.Feature.Vector}
options | {Object} Optional object for configuring the request.

#### Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object, the same object will be passed to the callback function passed if one exists in the options object.

### commit

> commit: function()

Go over the features and for each take action based on the feature state. Possible actions are create, update and delete.

#### Parameters

features | {Array({OpenLayers.Feature.Vector})}
options | {Object} Object whose possible keys are “create”, “update”, “delete”, “callback” and “scope”, the values referenced by the first three are objects as passed to the “create”, “update”, and “delete” methods, the value referenced by the “callback” key is a function which is called when the commit operation is complete using the scope referenced by the “scope” key.

#### Returns

{Array({OpenLayers.Protocol.Response})} An array of OpenLayers.Protocol.Response objects.

### abort

> abort: function( | response | )

Abort an ongoing request.

#### Parameters

response | {OpenLayers.Protocol.Response}

### createCallback

> createCallback: function( | method,
> | response,
> | options | )

Returns a function that applies the given public method with resp and options arguments.

#### Parameters

method | {Function} The method to be applied by the callback.
response | {OpenLayers.Protocol.Response} The protocol response object.
options | {Object} Options sent to the protocol method

## OpenLayers.Protocol.Response

Protocols return Response objects to their users.

Summary

Properties |
code |
requestType | {String} The type of request this response corresponds to.
last |
features | {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features returned in the response by the server.
data | {Object} The data returned in the response by the server.
reqFeatures | {Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features provided by the user and placed in the request by the protocol.
priv |
error | {Object} The error object in case a service exception was encountered.
Constructor |
OpenLayers.Protocol.Response |
Functions |
success |

### Properties

### code

{Number} | OpenLayers.Protocol.Response.SUCCESS or OpenLayers.Protocol.Response.FAILURE

### requestType

{String} The type of request this response corresponds to. Either “create”, “read”, “update” or “delete”.

### last

{Boolean} | true if this is the last response expected in a commit, false otherwise, defaults to true.

### features

{Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features returned in the response by the server. Depending on the protocol’s read payload, either features or data will be populated.

### data

{Object} The data returned in the response by the server. Depending on the protocol’s read payload, either features or data will be populated.

### reqFeatures

{Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} The features provided by the user and placed in the request by the protocol.

### priv

### error

{Object} The error object in case a service exception was encountered.

### Constructor

### OpenLayers.Protocol.Response

#### Parameters

options | {Object} Optional object whose properties will be set on the instance.

### Functions

### success

> success: function()

#### Returns

{Boolean} | true on success, false otherwise

Base class for format reading/writing a variety of formats.
This class represents an OGC Filter.

> mergeWithDefaultFilter: function( | filter | )

Merge filter passed to the read method with the default one

> destroy: function()

Clean up the protocol.

> read: function( | options | )

Construct a request for reading new features.

> create: function()

Construct a request for writing newly created features.

> update: function()

Construct a request updating modified features.

> "delete": function()

Construct a request deleting a removed feature.

> commit: function()

Go over the features and for each take action based on the feature state.

> abort: function( | response | )

Abort an ongoing request.

> createCallback: function( | method,
> | response,
> | options | )

Returns a function that applies the given public method with resp and options arguments.
Vector features use the OpenLayers.Geometry classes as geometry description.

> success: function()

Protocols return Response objects to their users.
Close