# OpenLayers.Protocol.HTTP

A basic HTTP protocol for vector layers. Create a new instance with the OpenLayers.Protocol.HTTP constructor.

#### Inherits from

- OpenLayers.Protocol

Summary

OpenLayers.Protocol.HTTP | A basic HTTP protocol for vector layers.
Properties |
readWithPOST | {Boolean} true if read operations are done with POST requests instead of GET, defaults to false.
updateWithPOST | {Boolean} true if update operations are done with POST requests defaults to false.
deleteWithPOST | {Boolean} true if delete operations are done with POST requests defaults to false.
srsInBBOX | {Boolean} Include the SRS identifier in BBOX query string parameter.
Constructor |
OpenLayers.Protocol.HTTP | A class for giving layers generic HTTP protocol.
Functions |
destroy | Clean up the protocol.
filterToParams | Optional method to translate an OpenLayers.Filter object into an object that can be serialized as request query string provided.
read | Construct a request for reading new features.
create | Construct a request for writing newly created features.
update | Construct a request updating modified feature.
delete | Construct a request deleting a removed feature.
commit | Iterate over each feature and take action based on the feature state.
abort | Abort an ongoing request, the response object passed to this method must come from this HTTP protocol (as a result of a create, read, update, delete or commit operation).

### Properties

### readWithPOST

{Boolean} true if read operations are done with POST requests instead of GET, defaults to false.

### updateWithPOST

{Boolean} true if update operations are done with POST requests defaults to false.

### deleteWithPOST

{Boolean} true if delete operations are done with POST requests defaults to false. if true, POST data is set to output of format.write().

### srsInBBOX

{Boolean} Include the SRS identifier in BBOX query string parameter. Default is false. If true and the layer has a projection object set, any BBOX filter will be serialized with a fifth item identifying the projection. E.g. bbox=-1000,-1000,1000,1000,EPSG:900913

### Constructor

### OpenLayers.Protocol.HTTP

A class for giving layers generic HTTP protocol.

#### Parameters

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

#### Valid options include

url | {String}
headers | {Object}
params | {Object} URL parameters for GET requests
format | {OpenLayers.Format}
callback | {Function}
scope | {Object}

### Functions

### destroy

> destroy: function()

Clean up the protocol.

### filterToParams

Optional method to translate an OpenLayers.Filter object into an object that can be serialized as request query string provided. If a custom method is not provided, the filter will be serialized using the OpenLayers.Format.QueryStringFilter class.

#### Parameters

filter | {OpenLayers.Filter} filter to convert.
params | {Object} The parameters object.

#### Returns

{Object} The resulting parameters object.

### read

> read: function( | options | )

Construct a request for reading new features.

#### Parameters

options | {Object} Optional object for configuring the request. This object is modified and should not be reused.

#### Valid options

url | {String} Url for the request.
params | {Object} Parameters to get serialized as a query string.
headers | {Object} Headers to be set on the request.
filter | {OpenLayers.Filter} Filter to get serialized as a query string.
readWithPOST | {Boolean} If the request should be done with POST.

#### Returns

{OpenLayers.Protocol.Response} A response object, whose “priv” property references the HTTP request, this object is also passed to the callback function when the request completes, its “features” property is then populated with the features received from the server.

### create

> create: function( | features,
> | options | )

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. This object is modified and should not be reused.

#### Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object, whose “priv” property references the HTTP request, this object is also passed to the callback function when the request completes, its “features” property is then populated with the the features received from the server.

### update

> update: function( | feature,
> | options | )

Construct a request updating modified feature.

#### Parameters

feature | {OpenLayers.Feature.Vector}
options | {Object} Optional object for configuring the request. This object is modified and should not be reused.

#### Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object, whose “priv” property references the HTTP request, this object is also passed to the callback function when the request completes, its “features” property is then populated with the the feature received from the server.

### delete

> "delete": function( | feature,
> | options | )

Construct a request deleting a removed feature.

#### Parameters

feature | {OpenLayers.Feature.Vector}
options | {Object} Optional object for configuring the request. This object is modified and should not be reused.

#### Returns

{OpenLayers.Protocol.Response} An OpenLayers.Protocol.Response object, whose “priv” property references the HTTP request, this object is also passed to the callback function when the request completes.

### commit

> commit: function( | features,
> | options | )

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

#### Parameters

features | {Array({OpenLayers.Feature.Vector})}
options | {Object} Optional object for setting up intermediate commit callbacks.

#### Valid options

create | {Object} Optional object to be passed to the create method.
update | {Object} Optional object to be passed to the update method.
delete | {Object} Optional object to be passed to the delete method.
callback | {Function} Optional function to be called when the commit is complete.
scope | {Object} Optional object to be set as the scope of the callback.

#### Returns

{Array(OpenLayers.Protocol.Response)} An array of response objects, one per request made to the server, each object’s “priv” property references the corresponding HTTP request.

### abort

> abort: function( | response | )

Abort an ongoing request, the response object passed to this method must come from this HTTP protocol (as a result of a create, read, update, delete or commit operation).

#### Parameters

response | {OpenLayers.Protocol.Response}

> destroy: function()

Clean up the protocol.
This class represents an OGC Filter.

> read: function( | options | )

Construct a request for reading new features.

> create: function( | features,
> | options | )

Construct a request for writing newly created features.

> update: function( | feature,
> | options | )

Construct a request updating modified feature.

> "delete": function( | feature,
> | options | )

Construct a request deleting a removed feature.

> commit: function( | features,
> | options | )

Iterate over each feature and take action based on the feature state.

> abort: function( | response | )

Abort an ongoing request, the response object passed to this method must come from this HTTP protocol (as a result of a create, read, update, delete or commit operation).
A class for giving layers generic HTTP protocol.
Abstract vector layer protocol class.
Base class for format reading/writing a variety of formats.
Parser for reading a query string and creating a simple filter.
Protocols return Response objects to their users.
Vector features use the OpenLayers.Geometry classes as geometry description.
Close