@Test public void testProxyMetadataURLBackReferenceNoProxyBaseUrl() throws Exception { createAppContext(null); MetadataLinkInfo link = new MetadataLinkInfoImpl(); link.setContent("/metadata.xml?foo=bar"); String url = ResponseUtils.proxifyMetadataLink(link, "http://localhost/geoserver"); assertEquals("http://localhost/geoserver/metadata.xml?foo=bar", url); }
@Test public void testProxyMetadataURLBackReference() throws Exception { createAppContext("http://foo.org/geoserver"); MetadataLinkInfo link = new MetadataLinkInfoImpl(); link.setContent("/metadata.xml?foo=bar"); String url = ResponseUtils.proxifyMetadataLink(link, "http://localhost/geoserver"); assertEquals("http://foo.org/geoserver/metadata.xml?foo=bar", url); }
@Test public void testProxyMetadataURL() throws Exception { createAppContext("http://foo.org/geoserver"); MetadataLinkInfo link = new MetadataLinkInfoImpl(); link.setContent("http://bar.com/geoserver/metadata.xml?foo=bar"); String url = ResponseUtils.proxifyMetadataLink(link, "http://localhost/geoserver"); assertEquals(link.getContent(), url); }
protected void handleMetadataLink(MetadataLinkInfo mdl, String linkType) { AttributesImpl attributes = new AttributesImpl(); if ((mdl.getAbout() != null) && (mdl.getAbout() != "")) { attributes.addAttribute("", "about", "about", "", mdl.getAbout()); } if ((linkType != null) && (linkType != "")) { attributes.addAttribute("", "xlink:type", "xlink:type", "", linkType); } if ((mdl.getContent() != null) && (mdl.getContent() != "")) { attributes.addAttribute( "", "xlink:href", "xlink:href", "", ResponseUtils.proxifyMetadataLink(mdl, request.getBaseUrl())); element("ows:Metadata", null, attributes); } }
/** * Turns the metadata URL list to XML * * @param keywords */ private void handleMetadataList(Collection<MetadataLinkInfo> metadataURLs) { if (metadataURLs == null) { return; } for (MetadataLinkInfo link : metadataURLs) { if (!SUPPORTED_MDLINK_TYPES.contains(link.getMetadataType())) { continue; } AttributesImpl lnkAtts = new AttributesImpl(); lnkAtts.addAttribute("", "type", "type", "", link.getMetadataType()); start("MetadataURL", lnkAtts); element("Format", link.getType()); String content = ResponseUtils.proxifyMetadataLink(link, request.getBaseUrl()); AttributesImpl orAtts = new AttributesImpl(); orAtts.addAttribute("", "xmlns:xlink", "xmlns:xlink", "", XLINK_NS); orAtts.addAttribute(XLINK_NS, "xlink:type", "xlink:type", "", "simple"); orAtts.addAttribute("", "xlink:href", "xlink:href", "", content); element("OnlineResource", null, orAtts); end("MetadataURL"); } }
String url = ResponseUtils.proxifyMetadataLink(gsMetadata, baseUrl); try { gwcMetadataLinks.add(
element( "MetadataURL", ResponseUtils.proxifyMetadataLink(link, request.getBaseUrl()), mtAtts);
protected void handleMetadataLink(MetadataLinkInfo mdl, String linkType) { AttributesImpl attributes = new AttributesImpl(); if ((mdl.getAbout() != null) && (mdl.getAbout() != "")) { attributes.addAttribute("", "about", "about", "", mdl.getAbout()); } if ((mdl.getMetadataType() != null) && (mdl.getMetadataType() != "")) { attributes.addAttribute( "", "metadataType", "metadataType", "", mdl.getMetadataType()); } if ((linkType != null) && (linkType != "")) { attributes.addAttribute("", "xlink:type", "xlink:type", "", linkType); } if ((mdl.getContent() != null) && (mdl.getContent() != "")) { attributes.addAttribute( "", "xlink:href", "xlink:href", "", ResponseUtils.proxifyMetadataLink(mdl, request.getBaseUrl())); } if (attributes.getLength() > 0) { element("ows:Metadata", null, attributes); } }
private void handleMetadataLink(MetadataLinkInfo mdl, String linkType) { AttributesImpl attributes = new AttributesImpl(); if ((mdl.getAbout() != null) && (mdl.getAbout() != "")) { attributes.addAttribute("", "about", "about", "", mdl.getAbout()); } if ((mdl.getMetadataType() != null) && (mdl.getMetadataType() != "")) { attributes.addAttribute( "", "metadataType", "metadataType", "", mdl.getMetadataType()); } if ((linkType != null) && (linkType != "")) { attributes.addAttribute("", "xlink:type", "xlink:type", "", linkType); } if ((mdl.getContent() != null) && (mdl.getContent() != "")) { attributes.addAttribute( "", "xlink:href", "xlink:href", "", ResponseUtils.proxifyMetadataLink(mdl, request.getBaseUrl())); } if (attributes.getLength() > 0) { element("wcs:metadataLink", null, attributes); } }
private void handleMetadataLink(MetadataLinkInfo mdl, String linkType) { AttributesImpl attributes = new AttributesImpl(); if ((mdl.getAbout() != null) && (mdl.getAbout() != "")) { attributes.addAttribute("", "about", "about", "", mdl.getAbout()); } if ((linkType != null) && (linkType != "")) { attributes.addAttribute("", "xlink:type", "xlink:type", "", linkType); } if ((mdl.getMetadataType() != null) && (mdl.getMetadataType() != "")) { attributes.addAttribute( "", "metadataType", "metadataType", "", mdl.getMetadataType()); } if ((mdl.getContent() != null) && (mdl.getContent() != "")) { attributes.addAttribute( "", "xlink:href", "xlink:href", "", ResponseUtils.proxifyMetadataLink(mdl, request.getBaseUrl())); } if (attributes.getLength() > 0) { element("wcs:metadataLink", null, attributes); } }
/** * Turns the metadata URL list to XML * * @param keywords */ private void handleMetadataList(Collection<MetadataLinkInfo> metadataURLs) { if (metadataURLs == null) { return; } for (MetadataLinkInfo link : metadataURLs) { AttributesImpl lnkAtts = new AttributesImpl(); lnkAtts.addAttribute("", "type", "type", "", link.getMetadataType()); start("MetadataURL", lnkAtts); element("Format", link.getType()); String content = ResponseUtils.proxifyMetadataLink(link, request.getBaseUrl()); AttributesImpl orAtts = attributes("xlink:type", "simple", "xlink:href", content); element("OnlineResource", null, orAtts); end("MetadataURL"); } }