@Override protected Configuration customizeConfiguration( Configuration configuration, Map<String, Set<ResourceInfo>> resources, Object request) { FeatureTypeSchemaBuilder schemaBuilder = new FeatureTypeSchemaBuilder.GML32(geoServer); ApplicationSchemaXSD2 xsd = new ApplicationSchemaXSD2(schemaBuilder); xsd.setBaseURL(GetFeatureRequest.adapt(request).getBaseURL()); xsd.setResources(resources); org.geotools.wfs.v2_0.WFSConfiguration wfs = new org.geotools.wfs.v2_0.WFSConfiguration(); wfs.getDependency(GMLConfiguration.class) .setSrsSyntax( getInfo() .getGML() .get(WFSInfo.Version.V_20) .getSrsNameStyle() .toSrsSyntax()); ApplicationSchemaConfiguration2 config = new ApplicationSchemaConfiguration2(xsd, wfs); // adding properties from original configuration to allow // hints handling config.getProperties().addAll(configuration.getProperties()); return config; }
@Override public Object read(Object request, Reader reader, Map kvp) throws Exception { WFSConfiguration config = new WFSConfiguration(); WFSXmlUtils.initWfsConfiguration(config, gs, new FeatureTypeSchemaBuilder.GML32(gs)); Parser parser = new Parser(config); parser.setEntityResolver(entityResolverProvider.getEntityResolver()); WFSInfo wfs = wfs(); WFSXmlUtils.initRequestParser(parser, wfs, gs, kvp); Object parsed = null; try { parsed = WFSXmlUtils.parseRequest(parser, reader, wfs); } catch (Exception e) { // check the exception, and set code to OperationParsingFailed if code not set if (!(e instanceof ServiceException) || ((ServiceException) e).getCode() == null) { e = new WFSException("Request parsing failed", e, "OperationParsingFailed"); } throw e; } WFSXmlUtils.checkValidationErrors(parser, this); return parsed; }