/** * Notes the start of the element and sets version and service tags, as required. * * @param namespaceURI URI for namespace appended to element. * @param localName Local name of element. * @param rawName Raw name of element. * @param atts Element attributes. * @throws SAXException For any standard SAX errors. */ public void startElement( String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException { if (localName.equals("GetCapabilities")) { LOGGER.finer("found capabilities start."); for (int i = 0, n = atts.getLength(); i < n; i++) { if (atts.getLocalName(i).equals("version")) { String version = atts.getValue(i); request.setVersion(version); } else if (atts.getLocalName(i).equals("service")) { // ok WMS is implicit } else if (atts.getLocalName(i).equals("updateSequence")) { request.setUpdateSequence(atts.getValue(i)); } } } } }
request.setVersion(negotiatedVersion.toString());
GetCapabilitiesRequest req = new GetCapabilitiesRequest(); req.setBaseUrl(BASE_URL); req.setVersion(WMS.VERSION_1_3_0.toString());
/** * Retrieves the WMS's capabilities document. * * @param scaleHintUnitsPerDiaPixel true if the scalehint must be in units per diagonal of a * pixel * @return Capabilities as {@link Document} */ private Document findCapabilities(Boolean scaleHintUnitsPerDiaPixel) throws Exception { // set the Scalehint units per diagonal pixel setting. WMS wms = getWMS(); WMSInfo info = wms.getServiceInfo(); MetadataMap mm = info.getMetadata(); mm.put(WMS.SCALEHINT_MAPUNITS_PIXEL, scaleHintUnitsPerDiaPixel); info.getGeoServer().save(info); Capabilities_1_3_0_Transformer tr = new Capabilities_1_3_0_Transformer( wms, BASE_URL, wms.getAllowedMapFormats(), new HashSet<ExtendedCapabilitiesProvider>()); GetCapabilitiesRequest req = new GetCapabilitiesRequest(); req.setBaseUrl(BASE_URL); req.setVersion(WMS.VERSION_1_3_0.toString()); Document dom = WMSTestSupport.transform(req, tr); Element root = dom.getDocumentElement(); assertEquals(WMS.VERSION_1_3_0.toString(), root.getAttribute("version")); return dom; }
/** * Retrieves the WMS's capabilities document. * * @param scaleHintUnitsPerDiaPixel true if the scalehint must be in units per diagonal of a * pixel * @return Capabilities as {@link Document} */ private Document findCapabilities(Boolean scaleHintUnitsPerDiaPixel) throws Exception { // set the Scalehint units per diagonal pixel setting. WMS wms = getWMS(); WMSInfo info = wms.getServiceInfo(); info.setRootLayerTitle("test the title"); MetadataMap mm = info.getMetadata(); mm.put(WMS.SCALEHINT_MAPUNITS_PIXEL, scaleHintUnitsPerDiaPixel); info.getGeoServer().save(info); Capabilities_1_3_0_Transformer tr = new Capabilities_1_3_0_Transformer( wms, BASE_URL, wms.getAllowedMapFormats(), new HashSet<ExtendedCapabilitiesProvider>()); GetCapabilitiesRequest req = new GetCapabilitiesRequest(); req.setBaseUrl(BASE_URL); req.setVersion(WMS.VERSION_1_3_0.toString()); Document dom = WMSTestSupport.transform(req, tr); Element root = dom.getDocumentElement(); assertEquals(WMS.VERSION_1_3_0.toString(), root.getAttribute("version")); return dom; }
/** * Retrieves the WMS's capabilities document. * * @param scaleHintUnitsPerDiaPixel true if the scalehint must be in units per diagonal of a * pixel * @return Capabilities as {@link Document} */ private Document findCapabilities(Boolean scaleHintUnitsPerDiaPixel) throws Exception { // set the Scalehint units per diagonal pixel setting. WMS wms = getWMS(); WMSInfo info = wms.getServiceInfo(); MetadataMap mm = info.getMetadata(); mm.put(WMS.SCALEHINT_MAPUNITS_PIXEL, scaleHintUnitsPerDiaPixel); info.getGeoServer().save(info); GetCapabilitiesTransformer tr = new GetCapabilitiesTransformer(wms, BASE_URL, FORMATS, LEGEND_FORMAT, null); GetCapabilitiesRequest req = new GetCapabilitiesRequest(); req.setBaseUrl(BASE_URL); req.setVersion(WMS.VERSION_1_1_1.toString()); Document dom = WMSTestSupport.transform(req, tr); Element root = dom.getDocumentElement(); Assert.assertEquals(WMS.VERSION_1_1_1.toString(), root.getAttribute("version")); return dom; }