In the web client the user can use a <input type="range".../> slider to
reduce number of points on a polyline.
To be sure to only pick last XHR request I call xhr.abort() on the
previous call.
The problem is that the onDouglasPeuckerSimplifier(...) fail. I found a
bad(!?) workaround by adding @RequestParameter(allowBlank = true) to
both/all parameters and return if some of them are null.
I was looking for values indicating that the request was aborted in
org.apache.tapestry5.services.Request.
In my log I am getting: WARN: org.mortbay.jetty.EofException
How can I detect if the XHR request is aborted?
JavaScript:
owner.simplifyPolyline = function (tolerance) {
if (owner._xhr != null) {
owner._xhr.abort();
owner._xhr = null;
}
owner._xhr =
$.post("/map/client/trackdraw:DouglasPeuckerSimplifier", {...
}).done(function (data) {...
}).always(function () {
owner._xhr = null;
});
…
Java:
private JSONObject onDouglasPeuckerSimplifier(
@RequestParameter(value = "latLngs", allowBlank = true) JSONArray
latLngs,
@RequestParameter(value = "distanceTolerance", allowBlank = true)
Double distanceTolerance) {
if (latLngs == null || distanceTolerance == null) {
return null;
}
...
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]