Made Tile.Image.IFrame an addin which will be used only if a layer is configured with the maxGetUrlLength option. This deprecates Layer.WMS.Post. r=tschaub (closes #2824)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10755 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2010-09-16 21:54:22 +00:00
parent 1284b71bbc
commit ce90aebfd0
11 changed files with 300 additions and 224 deletions
+3 -1
View File
@@ -161,6 +161,8 @@
<div id="map" style="width: 512; height: 256; border: 1px solid red;"></div>
<div id="docs">
<p><b>Deprecated.</b> See <a href="wms-long-url.html">wms-long-url.html</a>
for the recommended way to avoid long URLs.</p><p>
This example uses a large SLD created on the client side to style a WMS
layer. This example uses a WMS.Post layer which transfers data via the
HTTP-POST protocol. <br>
@@ -171,7 +173,7 @@
instead. The default setting (["mozilla", "firefox", "opera"])
excludes problematic browsers without removing the ability to use long
request parameters, because all these browsers support long urls via
GET.
GET.</p>
</div>
</body>
</html>
+41
View File
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<title>WMS with POST Requests to Avoid Long URLs</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<h1 id="title">WMS with POST Requests to Avoid Long URLs</h1>
<div id="tags">
sld, sld_body, post, iframe, advanced
</div>
<div id="shortdesc">Render tiles in IMG or IFRAME elements, depending on
the complexity of the GetMap request</div>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>The <code>maxGetUrlLength</code> property of the layer's
<code>tileOptions</code> option causes tiles to be requested using
HTTP POST when the length of the GET url would exceed the specified
length (2048 characters is recommended). In real life applications,
this happens often when using the SLD_BODY request parameter for
inline styling.
</p><p>
<input type="radio" name="group" id="longurl" checked="checked">
Long URL - POST requests
<br>
<input type="radio" name="group" id="shorturl">
Short URL - GET requests
</p><p>
View the <a href="wms-long-url.js" target="_blank">wms-long-url.js</a>
source to see how this is done.
</p>
</div>
<script src="../lib/OpenLayers.js"></script>
<script src="wms-long-url.js"></script>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
// a long text that we set as dummy param (makeTheUrlLong) to make the url long
var longText = new Array(205).join("1234567890");
var map = new OpenLayers.Map( 'map' );
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: 'basic', makeTheUrlLong: longText},
{tileOptions: {maxGetUrlLength: 2048}}
);
map.addLayer(layer);
map.zoomToMaxExtent();
// add behavior to dom elements
document.getElementById("longurl").onclick = function() {
layer.mergeNewParams({makeTheUrlLong: longText})
}
document.getElementById("shorturl").onclick = function() {
layer.mergeNewParams({makeTheUrlLong: null})
}