I am trying to learn how to use the OpenGeo suite by following the tutorials on the site. The one I'm currently trying to follow is http://workshops.opengeo.org/geoext/stores/capabilities.html. Most of it works, but I can't get the grid to populate with the layers from GeoServer. This is my code:
<html>
<head>
<title>GeoExt Workshop Application</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css">
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
<script src="openlayers/lib/OpenLayers.js"></script>
<script type="text/javascript" src="geoext/lib/GeoExt.js"></script>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = "ext/resources/images/default/s.gif";
var app, items = [], controls = [];
Ext.onReady(function() {
app = new Ext.Viewport({
layout: "border",
items: items
});
});
items.push({
xtype: "gx_mappanel",
ref: "mapPanel",
region: "center",
map: {
numZoomLevels: 19,
controls: controls
},
extent: OpenLayers.Bounds.fromArray([
-122.911, 42.291,
-122.787,42.398
]),
layers: [new OpenLayers.Layer.WMS(
"Medford",
"http://localhost:8080/geoserver/wms",
{layers: "medford"},
{isBaseLayer: false}
)]
});
controls.push(
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.PanPanel(),
new OpenLayers.Control.ZoomPanel()
);
items.push({
xtype: "grid",
ref: "capsGrid", // makes the grid available as app.capsGrid
title: "Available Layers",
region: "north",
height: 150,
viewConfig: {forceFit: true},
store: new GeoExt.data.WMSCapabilitiesStore({
url: "http://localhost:8080/geoserver/wms?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1&",
autoLoad: true
}),
columns: [
{header: "Name", dataIndex: "name", sortable: true},
{header: "Title", dataIndex: "title", sortable: true},
{header: "Abstract", dataIndex: "abstract"}
],
bbar: [{
text: "Add to Map",
handler: function() {
app.capsGrid.getSelectionModel().each(function(record) {
var clone = record.clone();
clone.getLayer().mergeNewParams({
format: "image/png",
transparent: true
});
app.mapPanel.layers.add(clone);
app.mapPanel.map.zoomToExtent(
OpenLayers.Bounds.fromArray(clone.get("llbbox"))
);
});
}
}]
});
</script>
</head>
<body>
</body>
</html>
I've been playing around on firebug to try to figure out what's going on, particularly on the request
http://localhost:8080/geoserver/wms?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1&
since this is the request that is supposed to get the layer info. The request header it sends is below. The response for some reason is 0 bytes. I'm not very familiar with web development, but I thought this should be a GET request instead of an OPTIONS request.
OPTIONS /geoserver/wms?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1& HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Origin: null
Access-Control-Request-Method: GET
Access-Control-Request-Headers: x-requested-with
Connection: keep-alive
Here is the response header:
HTTP/1.1 200 OK
Allow: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS
Content-Length: 0
Server: Jetty(6.1.8)
What is going wrong? And how can I fix it?
EDIT: Here is part of the log file, which includes starting up OpenGeo and then loading the webpage I built in the tutorial. The rest is just the requests for the map tiles that look like
127.0.0.1 - - [23/Jan/2013:18:10:52 +0000] "GET /geoserver/wms?LAYERS=medford&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-122.87109375,42.36328125,-122.8271484375,42.4072265625&WIDTH=256&HEIGHT=256 HTTP/1.1" 200 6993
I went over the character limit by including them so I took them out.
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "HEAD /dashboard/version.ini HTTP/1.1" 200 0
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces.json HTTP/1.1" 200 685
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/AENVTest/datastores.json HTTP/1.1" 200 155
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/AENVTest/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/medford/datastores.json HTTP/1.1" 200 262
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/medford/coveragestores.json HTTP/1.1" 200 178
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/earth/datastores.json HTTP/1.1" 200 268
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/earth/coveragestores.json HTTP/1.1" 200 166
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/opengeo/datastores.json HTTP/1.1" 200 146
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/opengeo/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/usa/datastores.json HTTP/1.1" 200 148
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/usa/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:43 +0000] "GET /geoserver/rest/workspaces/analytics/datastores.json HTTP/1.1" 200 138
127.0.0.1 - - [23/Jan/2013:18:10:44 +0000] "GET /geoserver/rest/workspaces/analytics/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:44 +0000] "GET /geoserver/rest/workspaces/world/datastores.json HTTP/1.1" 200 252
127.0.0.1 - - [23/Jan/2013:18:10:44 +0000] "GET /geoserver/rest/workspaces/world/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:44 +0000] "GET /geoserver/rest/layers.json HTTP/1.1" 200 3036
127.0.0.1 - - [23/Jan/2013:18:10:44 +0000] "GET /geoexplorer/maps/ HTTP/1.1" 200 556
127.0.0.1 - - [23/Jan/2013:18:10:45 +0000] "HEAD /dashboard/version.ini HTTP/1.1" 200 0
127.0.0.1 - - [23/Jan/2013:18:10:48 +0000] "HEAD /dashboard/version.ini HTTP/1.1" 200 0
127.0.0.1 - - [23/Jan/2013:18:10:50 +0000] "HEAD /dashboard/version.ini HTTP/1.1" 200 0
127.0.0.1 - - [23/Jan/2013:18:10:52 +0000] "OPTIONS /geoserver/wms?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.1.1 HTTP/1.1" 200 0
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "HEAD /dashboard/version.ini HTTP/1.1" 200 0
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces.json HTTP/1.1" 200 685
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/AENVTest/datastores.json HTTP/1.1" 200 155
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/AENVTest/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/medford/datastores.json HTTP/1.1" 200 262
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/medford/coveragestores.json HTTP/1.1" 200 178
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/earth/datastores.json HTTP/1.1" 200 268
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/earth/coveragestores.json HTTP/1.1" 200 166
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/opengeo/datastores.json HTTP/1.1" 200 146
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/opengeo/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/usa/datastores.json HTTP/1.1" 200 148
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/usa/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/analytics/datastores.json HTTP/1.1" 200 138
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/analytics/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/world/datastores.json HTTP/1.1" 200 252
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/workspaces/world/coveragestores.json HTTP/1.1" 200 21
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoserver/rest/layers.json HTTP/1.1" 200 3036
127.0.0.1 - - [23/Jan/2013:18:10:53 +0000] "GET /geoexplorer/maps/ HTTP/1.1" 200 556
127.0.0.1 - - [23/Jan/2013:18:10:55 +0000] "HEAD /dashboard/version.ini HTTP/1.1" 200 0