OpenLayers. Protocol.HTTP

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

Inherits from

Summary
OpenLayers. Protocol.HTTPA basic HTTP protocol for vector layers.
Properties
url{String} Service URL, read-only, set through the options passed to constructor.
headers{Object} HTTP request headers, read-only, set through the options passed to the constructor, Example: {‘Content-Type’: ‘plain/text’}
params{Object} Parameters of GET requests, read-only, set through the options passed to the constructor, Example: {‘bbox’: ‘5,5,5,5’}
callback{Object} Function to be called when the read, create, update, delete or commit operation completes, read-only, set through the options passed to the constructor.
scope{Object} Callback execution scope, read-only, set through the options passed to the constructor.
readWithPOST{Boolean} true if read operations are done with POST requests instead of GET, defaults to false.
wildcarded.{Boolean} If true percent signs are added around values read from LIKE filters, for example if the protocol read method is passed a LIKE filter whose property is “foo” and whose value is “bar” the string “foo__ilike=%bar%” will be sent in the query string; defaults to false.
Constructor
OpenLayers. Protocol.HTTPA class for giving layers generic HTTP protocol.
Functions
destroyClean up the protocol.
readConstruct a request for reading new features.
handleReadIndividual callbacks are created for read, create and update, should a subclass need to override each one separately.
filterToParamsConvert an OpenLayers.Filter object to parameters.
regex2valueConvert the value from a regular expression string to a LIKE/ILIKE string known to the web service.
createConstruct a request for writing newly created features.
handleCreateCalled the the request issued by create is complete.
updateConstruct a request updating modified feature.
handleUpdateCalled the the request issued by update is complete.
deleteConstruct a request deleting a removed feature.
handleDeleteCalled the the request issued by delete is complete.
handleResponseCalled by CRUD specific handlers.
parseFeaturesRead HTTP response body and return features.
commitIterate over each feature and take action based on the feature state.
abortAbort 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).
callUserCallbackThis method is used from within the commit method each time an an HTTP response is received from the server, it is responsible for calling the user-supplied callbacks.
Properties
OpenLayers. Protocol. HTTP. COMP_TYPE_TO_OP_STR{Object} A private class-level property mapping the OpenLayers.Filter.Comparison types to the operation strings of the protocol.

Properties

url

{String} Service URL, read-only, set through the options passed to constructor.

headers

{Object} HTTP request headers, read-only, set through the options passed to the constructor, Example: {‘Content-Type’: ‘plain/text’}

params

{Object} Parameters of GET requests, read-only, set through the options passed to the constructor, Example: {‘bbox’: ‘5,5,5,5’}

callback

{Object} Function to be called when the read, create, update, delete or commit operation completes, read-only, set through the options passed to the constructor.

scope

{Object} Callback execution scope, read-only, set through the options passed to the constructor.

readWithPOST

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

wildcarded.

{Boolean} If true percent signs are added around values read from LIKE filters, for example if the protocol read method is passed a LIKE filter whose property is “foo” and whose value is “bar” the string “foo__ilike=%bar%” will be sent in the query string; defaults to false.

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}
format{OpenLayers.Format}
callback{Function}
scope{Object}

Functions

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.  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 the features received from the server.

handleRead

handleRead: function(resp,
options)

Individual callbacks are created for read, create and update, should a subclass need to override each one separately.

Parameters

resp{OpenLayers.Protocol.Response} The response object to pass to the user callback.
options{Object} The user options passed to the read call.

filterToParams

filterToParams: function(filter,
params)

Convert an OpenLayers.Filter object to parameters.

Parameters

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

Returns

{Object} The resulting parameters object.

regex2value

regex2value: function(value)

Convert the value from a regular expression string to a LIKE/ILIKE string known to the web service.

Parameters

value{String} The regex string.

Returns

{String} The converted string.

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.

handleCreate

handleCreate: function(resp,
options)

Called the the request issued by create is complete.  May be overridden by subclasses.

Parameters

resp{OpenLayers.Protocol.Response} The response object to pass to any user callback.
options{Object} The user options passed to the create call.

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.

handleUpdate

handleUpdate: function(resp,
options)

Called the the request issued by update is complete.  May be overridden by subclasses.

Parameters

resp{OpenLayers.Protocol.Response} The response object to pass to any user callback.
options{Object} The user options passed to the update call.

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.

handleDelete

handleDelete: function(resp,
options)

Called the the request issued by delete is complete.  May be overridden by subclasses.

Parameters

resp{OpenLayers.Protocol.Response} The response object to pass to any user callback.
options{Object} The user options passed to the delete call.

handleResponse

handleResponse: function(resp,
options)

Called by CRUD specific handlers.

Parameters

resp{OpenLayers.Protocol.Response} The response object to pass to any user callback.
options{Object} The user options passed to the create, read, update, or delete call.

parseFeatures

parseFeatures: function(request)

Read HTTP response body and return features.

Parameters

request{XMLHttpRequest} The request object

Returns

{Array({OpenLayers.Feature.Vector})} or {OpenLayers.Feature.Vector} Array of features or a single feature.

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}

callUserCallback

callUserCallback: function(resp,
options)

This method is used from within the commit method each time an an HTTP response is received from the server, it is responsible for calling the user-supplied callbacks.

Parameters

resp{OpenLayers.Protocol.Response}
options{Object} The map of options passed to the commit call.

Properties

OpenLayers. Protocol. HTTP. COMP_TYPE_TO_OP_STR

{Object} A private class-level property mapping the OpenLayers.Filter.Comparison types to the operation strings of the protocol.

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.
destroy: function()
Clean up the protocol.
handleRead: function(resp,
options)
Individual callbacks are created for read, create and update, should a subclass need to override each one separately.
filterToParams: function(filter,
params)
Convert an OpenLayers.Filter object to parameters.
This class represents an OGC Filter.
regex2value: function(value)
Convert the value from a regular expression string to a LIKE/ILIKE string known to the web service.
handleCreate: function(resp,
options)
Called the the request issued by create is complete.
handleUpdate: function(resp,
options)
Called the the request issued by update is complete.
handleDelete: function(resp,
options)
Called the the request issued by delete is complete.
handleResponse: function(resp,
options)
Called by CRUD specific handlers.
parseFeatures: function(request)
Read HTTP response body and return features.
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).
callUserCallback: function(resp,
options)
This method is used from within the commit method each time an an HTTP response is received from the server, it is responsible for calling the user-supplied callbacks.
A class for giving layers generic HTTP protocol.
Abstract vector layer protocol class.
Base class for format reading/writing a variety of formats.
Protocols return Response objects to their users.
Vector features use the OpenLayers.Geometry classes as geometry description.
Close