Commit baa18e28 authored by Andrea Aime's avatar Andrea Aime
Browse files

[GEOS-7032] You can see the content of the server by sending the right request to GeoServer

parent 8689a14e
......@@ -24,7 +24,9 @@
<constructor-arg index="3" ref="filterFactory"/>
</bean>
<bean id="geopkgProcessRequestPPIO" class="org.geoserver.geopkg.wps.GeoPackageProcessRequestPPIO" />
<bean id="geopkgProcessRequestPPIO" class="org.geoserver.geopkg.wps.GeoPackageProcessRequestPPIO" >
<constructor-arg ref="entityResolverProvider"/>
</bean>
<bean id="geopkgDataStoreFactoryInitializer" class="org.geoserver.geopkg.GeoPkgDataStoreFactoryInitializer">
<property name="resourceLoader" ref="resourceLoader"/>
</bean>
......
......@@ -4,9 +4,10 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
import org.geoserver.util.EntityResolverProvider;
import org.geoserver.wps.ppio.ComplexPPIO;
import org.geotools.geopkg.wps.xml.GPKGConfiguration;
import org.geotools.geopkg.wps.GeoPackageProcessRequest;
import org.geotools.geopkg.wps.xml.GPKGConfiguration;
import org.geotools.ows.ServiceException;
import org.geotools.xml.Configuration;
import org.geotools.xml.Parser;
......@@ -15,14 +16,18 @@ public class GeoPackageProcessRequestPPIO extends ComplexPPIO {
Configuration config = new GPKGConfiguration();
protected GeoPackageProcessRequestPPIO() {
EntityResolverProvider resolverProvider;
protected GeoPackageProcessRequestPPIO(EntityResolverProvider resolverProvider) {
super(GeoPackageProcessRequest.class, GeoPackageProcessRequest.class, "text/xml; subtype=geoserver/geopackage");
this.resolverProvider = resolverProvider;
}
@Override
public Object decode(InputStream input) throws Exception {
Parser p = new Parser(config);
p.validate(input);
p.setEntityResolver(resolverProvider.getEntityResolver());
if (!p.getValidationErrors().isEmpty()) {
throw new ServiceException("Errors were encountered while parsing GeoPackage contents: " + p.getValidationErrors());
......
package org.geoserver.script.wps;
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
import java.io.File;
import org.apache.commons.io.FileUtils;
import org.geoserver.script.ScriptIntTestSupport;
import org.w3c.dom.Document;
import static org.custommonkey.xmlunit.XMLAssert.*;
public abstract class ScriptProcessIntTest extends ScriptIntTestSupport {
@Override
......
......@@ -89,7 +89,9 @@
<bean id="cswGetCapabilitesKvpRequestReader" class="org.geoserver.csw.kvp.GetCapabilitiesKvpRequestReader"/>
<bean id="cswDescribeRecordKvpRequestReader" class="org.geoserver.csw.kvp.DescribeRecordKvpRequestReader"/>
<bean id="cswGetDomainKvpRequestReader" class="org.geoserver.csw.kvp.GetDomainKvpRequestReader"/>
<bean id="cswGetRecordsKvpRequestReader" class="org.geoserver.csw.kvp.GetRecordsKvpRequestReader"/>
<bean id="cswGetRecordsKvpRequestReader" class="org.geoserver.csw.kvp.GetRecordsKvpRequestReader">
<constructor-arg ref="entityResolverProvider"/>
</bean>
<bean id="cswGetRecordByIdKvpRequestReader" class="org.geoserver.csw.kvp.GetRecordByIdKvpRequestReader"/>
<bean id="cswGetRepositoryItemKvpRequestReader" class="org.geoserver.csw.kvp.GetRepositoryItemKvpRequestReader">
<constructor-arg ref="cswService-2.0.2" />
......@@ -111,30 +113,35 @@
<constructor-arg index="0" value="GetCapabilities" />
<constructor-arg index="1" value="2.0.2" />
<constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
<constructor-arg ref="entityResolverProvider"/>
</bean>
<bean id="cswDescribeRecordXmlReader-2.0.2"
class="org.geoserver.csw.xml.v2_0_2.CSWXmlReader">
<constructor-arg index="0" value="DescribeRecord" />
<constructor-arg index="1" value="2.0.2" />
<constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
<constructor-arg ref="entityResolverProvider"/>
</bean>
<bean id="cswGetDomainXmlReader-2.0.2"
class="org.geoserver.csw.xml.v2_0_2.CSWXmlReader">
<constructor-arg index="0" value="GetDomain" />
<constructor-arg index="1" value="2.0.2" />
<constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
<constructor-arg ref="entityResolverProvider"/>
</bean>
<bean id="cswGetRecordsXmlReader-2.0.2"
class="org.geoserver.csw.xml.v2_0_2.CSWRecordingXmlReader">
<constructor-arg index="0" value="GetRecords" />
<constructor-arg index="1" value="2.0.2" />
<constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
<constructor-arg ref="entityResolverProvider"/>
</bean>
<bean id="cswGetRecordByIdXmlReader-2.0.2"
class="org.geoserver.csw.xml.v2_0_2.CSWRecordingXmlReader">
<constructor-arg index="0" value="GetRecordById" />
<constructor-arg index="1" value="2.0.2" />
<constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
<constructor-arg ref="entityResolverProvider"/>
</bean>
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -27,6 +27,7 @@ import org.geotools.csw.CSW;
import org.geotools.filter.text.cql2.CQL;
import org.geotools.filter.v1_1.OGC;
import org.geotools.filter.v1_1.OGCConfiguration;
import org.geoserver.util.EntityResolverProvider;
import org.geotools.xml.Parser;
import org.opengis.filter.Filter;
import org.opengis.filter.sort.SortBy;
......@@ -54,9 +55,12 @@ public class GetRecordsKvpRequestReader extends CSWKvpRequestReader implements A
HashMap<String, RecordDescriptor> descriptors;
public GetRecordsKvpRequestReader() {
EntityResolverProvider resolverProvider;
public GetRecordsKvpRequestReader(EntityResolverProvider resolverProvider) {
super(GetRecordsType.class);
setRepeatedParameters(true);
this.resolverProvider = resolverProvider;
}
@Override
......@@ -143,6 +147,7 @@ public class GetRecordsKvpRequestReader extends CSWKvpRequestReader implements A
Parser parser = new Parser(new OGCConfiguration());
parser.setFailOnValidationError(true);
parser.setValidating(true);
parser.setEntityResolver(resolverProvider.getEntityResolver());
parser.getNamespaces().declarePrefix("ogc", OGC.NAMESPACE);
Filter filter = (Filter) parser.parse(new StringReader(constraint));
query.getConstraint().setFilter(filter);
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -17,6 +17,7 @@ import org.geoserver.platform.Operation;
import org.geoserver.platform.Service;
import org.geoserver.platform.ServiceException;
import org.geotools.csw.CSWConfiguration;
import org.geoserver.util.EntityResolverProvider;
/**
* The GetRecords request has a "validate" mode in which we have to return an Acknowledgement
......@@ -26,8 +27,9 @@ public class CSWRecordingXmlReader extends CSWXmlReader implements DispatcherCal
public static final ThreadLocal<String> RECORDED_REQUEST = new ThreadLocal<String>();
public CSWRecordingXmlReader(String element, String version, CSWConfiguration configuration) {
super(element, version, configuration);
public CSWRecordingXmlReader(String element, String version, CSWConfiguration configuration,
EntityResolverProvider resolverProvider) {
super(element, version, configuration, resolverProvider);
}
public Object read(Object request, Reader reader, Map kvp) throws Exception {
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -16,6 +16,7 @@ import javax.xml.namespace.QName;
import org.geoserver.ows.XmlRequestReader;
import org.geoserver.platform.ServiceException;
import org.geotools.csw.CSWConfiguration;
import org.geoserver.util.EntityResolverProvider;
import org.geotools.util.Version;
import org.geotools.util.logging.Logging;
import org.geotools.xml.Parser;
......@@ -30,9 +31,13 @@ public class CSWXmlReader extends XmlRequestReader {
private CSWConfiguration configuration;
public CSWXmlReader(String element, String version, CSWConfiguration configuration) {
private EntityResolverProvider resolverProvider;
public CSWXmlReader(String element, String version, CSWConfiguration configuration,
EntityResolverProvider resolverProvider) {
super(new QName(org.geotools.csw.CSW.NAMESPACE, element), new Version("2.0.2"), "csw");
this.configuration = configuration;
this.resolverProvider = resolverProvider;
}
@SuppressWarnings("unchecked")
......@@ -41,6 +46,7 @@ public class CSWXmlReader extends XmlRequestReader {
parser.setValidating(true);
parser.setFailOnValidationError(true);
parser.setStrict(true);
parser.setEntityResolver(resolverProvider.getEntityResolver());
Object parsed;
try {
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -17,10 +17,10 @@ import javax.xml.namespace.QName;
import net.opengis.cat.csw20.DescribeRecordType;
import org.apache.commons.io.IOUtils;
import org.custommonkey.xmlunit.exceptions.XpathException;
import org.geoserver.csw.kvp.DescribeRecordKvpRequestReader;
import org.geoserver.csw.xml.v2_0_2.CSWXmlReader;
import org.geoserver.platform.ServiceException;
import org.geoserver.util.EntityResolverProvider;
import org.geotools.csw.CSWConfiguration;
import org.junit.Test;
import org.w3c.dom.Document;
......@@ -96,7 +96,8 @@ public class DescribeRecordTest extends CSWSimpleTestSupport {
@Test
public void testXMLReader() throws Exception {
CSWXmlReader reader = new CSWXmlReader("DescribeRecord", "2.0.2", new CSWConfiguration());
CSWXmlReader reader = new CSWXmlReader("DescribeRecord", "2.0.2", new CSWConfiguration(),
EntityResolverProvider.RESOLVE_DISABLED_PROVIDER);
DescribeRecordType dr = (DescribeRecordType) reader.read(null,
getResourceAsReader("DescribeRecord.xml"), (Map) null);
assertDescribeRecordValid(dr);
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.csw;
import static junit.framework.Assert.*;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
import java.io.StringReader;
import java.util.HashMap;
......@@ -23,6 +26,7 @@ import org.geoserver.csw.kvp.GetCapabilitiesKvpRequestReader;
import org.geoserver.csw.xml.v2_0_2.CSWXmlReader;
import org.geoserver.ows.xml.v1_0.OWS;
import org.geoserver.platform.ServiceException;
import org.geoserver.util.EntityResolverProvider;
import org.geotools.csw.CSWConfiguration;
import org.geotools.filter.v1_1.OGC;
import org.geotools.xlink.XLINK;
......@@ -83,7 +87,8 @@ public class GetCapabilitiesTest extends CSWSimpleTestSupport {
@Test
public void testXMLReader() throws Exception {
CSWXmlReader reader = new CSWXmlReader("GetCapabilities", "2.0.2", new CSWConfiguration());
CSWXmlReader reader = new CSWXmlReader("GetCapabilities", "2.0.2", new CSWConfiguration(),
EntityResolverProvider.RESOLVE_DISABLED_PROVIDER);
GetCapabilitiesType caps = (GetCapabilitiesType) reader.read(null,
getResourceAsReader("GetCapabilities.xml"), (Map) null);
assertReturnedCapabilitiesComplete(caps);
......@@ -96,7 +101,7 @@ public class GetCapabilitiesTest extends CSWSimpleTestSupport {
capRequest = capRequest.replace("ows:Sections", "ows:foo");
try {
CSWXmlReader reader = new CSWXmlReader("GetCapabilities", "2.0.2",
new CSWConfiguration());
new CSWConfiguration(), EntityResolverProvider.RESOLVE_DISABLED_PROVIDER);
reader.read(null, new StringReader(capRequest), (Map) null);
fail("the parsing should have failed, the document is invalid");
} catch (ServiceException e) {
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.csw;
import static junit.framework.Assert.*;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static junit.framework.Assert.assertEquals;
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
import java.util.HashMap;
import java.util.Map;
import net.opengis.cat.csw20.GetDomainType;
import org.custommonkey.xmlunit.NamespaceContext;
import org.custommonkey.xmlunit.SimpleNamespaceContext;
import org.custommonkey.xmlunit.XMLUnit;
......@@ -17,6 +20,7 @@ import org.custommonkey.xmlunit.XpathEngine;
import org.geoserver.csw.kvp.GetDomainKvpRequestReader;
import org.geoserver.csw.xml.v2_0_2.CSWXmlReader;
import org.geoserver.ows.xml.v1_0.OWS;
import org.geoserver.util.EntityResolverProvider;
import org.geotools.csw.CSWConfiguration;
import org.geotools.filter.v1_1.OGC;
import org.geotools.xlink.XLINK;
......@@ -74,7 +78,8 @@ public class GetDomainTest extends CSWSimpleTestSupport {
@Test
public void testXMLReaderParameter() throws Exception {
CSWXmlReader reader = new CSWXmlReader("GetDomain", "2.0.2", new CSWConfiguration());
CSWXmlReader reader = new CSWXmlReader("GetDomain", "2.0.2", new CSWConfiguration(),
EntityResolverProvider.RESOLVE_DISABLED_PROVIDER);
GetDomainType gd = (GetDomainType) reader.read(null,
getResourceAsReader("GetDomainParameter.xml"), (Map) null);
assertEquals("CSW", gd.getService());
......@@ -84,7 +89,8 @@ public class GetDomainTest extends CSWSimpleTestSupport {
@Test
public void testXMLReaderProperty() throws Exception {
CSWXmlReader reader = new CSWXmlReader("GetDomain", "2.0.2", new CSWConfiguration());
CSWXmlReader reader = new CSWXmlReader("GetDomain", "2.0.2", new CSWConfiguration(),
EntityResolverProvider.RESOLVE_DISABLED_PROVIDER);
GetDomainType gd = (GetDomainType) reader.read(null,
getResourceAsReader("GetDomainProperty.xml"), (Map) null);
assertEquals("CSW", gd.getService());
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.csw;
import static junit.framework.Assert.*;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static junit.framework.Assert.assertEquals;
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.HashMap;
import java.util.Map;
......@@ -16,7 +18,10 @@ import net.opengis.cat.csw20.GetRecordByIdType;
import org.geoserver.csw.kvp.GetRecordByIdKvpRequestReader;
import org.geoserver.csw.xml.v2_0_2.CSWXmlReader;
import org.geoserver.platform.GeoServerExtensions;
import org.geoserver.platform.ServiceException;
import org.geoserver.util.EntityResolverProvider;
import org.geoserver.util.NoExternalEntityResolver;
import org.geotools.csw.CSWConfiguration;
import org.junit.Test;
import org.w3c.dom.Document;
......@@ -58,11 +63,27 @@ public class GetRecordByIdTest extends CSWSimpleTestSupport {
@Test
public void testXMLReader() throws Exception {
CSWXmlReader reader = new CSWXmlReader("GetRecordById", "2.0.2", new CSWConfiguration());
CSWXmlReader reader = new CSWXmlReader("GetRecordById", "2.0.2", new CSWConfiguration(),
EntityResolverProvider.RESOLVE_DISABLED_PROVIDER);
GetRecordByIdType dr = (GetRecordByIdType) reader.read(null, getResourceAsReader("GetRecordById.xml"), (Map) null);
assertGetRecordByIdValid(dr);
}
@Test
public void testEntityExpansion() throws Exception {
CSWXmlReader reader = new CSWXmlReader("GetRecordById", "2.0.2", new CSWConfiguration(),
GeoServerExtensions.bean(EntityResolverProvider.class));
try {
GetRecordByIdType dr = (GetRecordByIdType) reader.read(null,
getResourceAsReader("GetRecordByIdEntityExpansion.xml"), (Map) null);
fail("Should have failed with an entity expansion disallowed exception");
} catch (ServiceException e) {
Throwable cause = e.getCause();
assertTrue(cause.getMessage().contains(NoExternalEntityResolver.ERROR_MESSAGE_BASE));
}
}
@Test
public void testGetMissingId() throws Exception {
Document dom = getAsDOM(BASEPATH + "?service=csw&version=2.0.2&request=GetRecordById");
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.csw;
import static junit.framework.Assert.*;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
import java.util.ArrayList;
import java.util.Calendar;
......@@ -15,17 +17,21 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import javax.xml.namespace.QName;
import net.opengis.cat.csw20.ElementSetNameType;
import net.opengis.cat.csw20.ElementSetType;
import net.opengis.cat.csw20.GetRecordsType;
import net.opengis.cat.csw20.QueryType;
import net.opengis.cat.csw20.ResultType;
import org.custommonkey.xmlunit.XMLUnit;
import org.custommonkey.xmlunit.XpathEngine;
import org.geoserver.csw.kvp.GetRecordsKvpRequestReader;
import org.geoserver.csw.xml.v2_0_2.CSWXmlReader;
import org.geoserver.platform.ServiceException;
import org.geoserver.util.EntityResolverProvider;
import org.geotools.csw.CSWConfiguration;
import org.geotools.xml.XmlConverterFactory;
import org.junit.Test;
......@@ -60,7 +66,8 @@ public class GetRecordsTest extends CSWSimpleTestSupport {
raw.put("distributedSearch", "true");
raw.put("hopCount", "10");
raw.put("responsehandler", "http://www.geoserver.org");
GetRecordsKvpRequestReader reader = new GetRecordsKvpRequestReader();
GetRecordsKvpRequestReader reader = new GetRecordsKvpRequestReader(
EntityResolverProvider.RESOLVE_DISABLED_PROVIDER);
reader.setApplicationContext(applicationContext);
Object request = reader.createRequest();
GetRecordsType gr = (GetRecordsType) reader.read(request, parseKvp(raw), raw);
......@@ -101,7 +108,8 @@ public class GetRecordsTest extends CSWSimpleTestSupport {
raw.put("constraint",
"<ogc:Filter xmlns:ogc=\"http://www.opengis.net/ogc\"><ogc:Not><ogc:PropertyIsEqualTo><ogc:PropertyName>dc:title</ogc:PropertyName><ogc:Literal>foo</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Not></ogc:Filter>");
GetRecordsKvpRequestReader reader = new GetRecordsKvpRequestReader();
GetRecordsKvpRequestReader reader = new GetRecordsKvpRequestReader(
EntityResolverProvider.RESOLVE_DISABLED_PROVIDER);
reader.setApplicationContext(applicationContext);
Object request = reader.createRequest();
GetRecordsType gr = (GetRecordsType) reader.read(request, parseKvp(raw), raw);
......@@ -130,7 +138,8 @@ public class GetRecordsTest extends CSWSimpleTestSupport {
@Test
public void testXMLReaderParameter() throws Exception {
CSWXmlReader reader = new CSWXmlReader("GetRecords", "2.0.2", new CSWConfiguration());
CSWXmlReader reader = new CSWXmlReader("GetRecords", "2.0.2", new CSWConfiguration(),
EntityResolverProvider.RESOLVE_DISABLED_PROVIDER);
GetRecordsType gr = (GetRecordsType) reader.read(null,
getResourceAsReader("GetRecordsBrief.xml"), (Map) null);
// check the attributes
......
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE GetRecordById [
<!ELEMENT GetRecordById (Id*)>
<!ATTLIST GetRecordById
service CDATA #FIXED "CSW"
version CDATA #FIXED "2.0.2"
xmlns CDATA #FIXED "http://www.opengis.net/cat/csw/2.0.2">
<!ELEMENT Id (#PCDATA)>
<!ENTITY xxe SYSTEM "file:///file/not/there.txt" >]>
<GetRecordById service="CSW" version="2.0.2" xmlns="http://www.opengis.net/cat/csw/2.0.2">
<Id>&xxe;</Id>
<Id>REC-11</Id>
<Id>REC-12</Id>
<ElementSetName>summary</ElementSetName>
</GetRecordById>
\ No newline at end of file
......@@ -53,6 +53,7 @@
<bean id="wcs201DescribeEOCoverageSetRequestReader" class="org.geoserver.wcs2_0.eo.xml.WcsEOXmlReader">
<constructor-arg value="DescribeEOCoverageSet" />
<constructor-arg value="2.0.1" />
<constructor-arg ref="entityResolverProvider" />
</bean>
<bean id="wcs20DescribeEOCoverageSetResponse"
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -11,6 +11,7 @@ import java.util.Map;
import javax.xml.namespace.QName;
import org.geoserver.ows.XmlRequestReader;
import org.geoserver.util.EntityResolverProvider;
import org.geotools.util.Version;
import org.geotools.wcs.v2_0.WCSEO;
import org.geotools.wcs.v2_0.WCSEOConfiguration;
......@@ -26,15 +27,19 @@ import org.vfny.geoserver.wcs.WcsException;
public class WcsEOXmlReader extends XmlRequestReader {
Configuration configuration;
public WcsEOXmlReader(String element, String version) {
private EntityResolverProvider resolverProvider;
public WcsEOXmlReader(String element, String version, EntityResolverProvider resolverProvider) {
super(new QName(WCSEO.NAMESPACE, element), new Version(version), "wcs");
this.configuration = new WCSEOConfiguration();
this.resolverProvider = resolverProvider;
}
@SuppressWarnings("rawtypes")
public Object read(Object request, Reader reader, Map kvp) throws Exception {
// create the parser instance
Parser parser = new Parser(configuration);
parser.setEntityResolver(resolverProvider.getEntityResolver());
// uncomment this once we have a working validator (now it fails due to
// xlink issues)
......
......@@ -108,18 +108,21 @@
<constructor-arg index="0" value="GetCapabilities" />
<constructor-arg index="1" value="1.0.0" />
<constructor-arg index="2" ref="wpsXmlConfiguration-1.0.0" />
<constructor-arg index="3" ref="entityResolverProvider" />
</bean>
<bean id="wpsDescribeProcessXmlReader-1.0.0"
class="org.geoserver.wps.xml.v1_0_0.WpsXmlReader">
<constructor-arg index="0" value="DescribeProcess" />
<constructor-arg index="1" value="1.0.0" />
<constructor-arg index="2" ref="wpsXmlConfiguration-1.0.0" />
<constructor-arg index="3" ref="entityResolverProvider" />
</bean>
<bean id="wpsExecuteXmlReader-1.0.0"
class="org.geoserver.wps.xml.v1_0_0.WpsXmlReader">
<constructor-arg index="0" value="Execute" />
<constructor-arg index="1" value="1.0.0" />
<constructor-arg index="2" ref="wpsXmlConfiguration-1.0.0" />
<constructor-arg index="3" ref="entityResolverProvider" />
</bean>
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -45,7 +45,7 @@ public class FilterPPIO extends XMLPPIO {
@Override
public Object decode(InputStream input) throws Exception {
Parser p = new Parser(xml);
Parser p = getParser(xml);
return p.parse(input);
}
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -34,7 +34,7 @@ public class GMLPPIO extends XMLPPIO {
@Override
public Object decode(InputStream input) throws Exception {
Parser p = new Parser( xml );
Parser p = getParser(xml);
return p.parse( input );
}
......