X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.app.geo%2Fsrc%2Forg%2Fargeo%2Fapp%2Fgeo%2Fhttp%2FWfsHttpHandler.java;h=8c143dbf01510d7eb10a56b588ec50b82ac819ea;hb=e9978679e86dcd297270432e4ed953b782f1e7c6;hp=61ea7bc8e980f42b6c430a58a94128f40656d2b9;hpb=2b20863563e9e6ddc9b421b4f5202248e0638f60;p=gpl%2Fargeo-suite.git diff --git a/org.argeo.app.geo/src/org/argeo/app/geo/http/WfsHttpHandler.java b/org.argeo.app.geo/src/org/argeo/app/geo/http/WfsHttpHandler.java index 61ea7bc..8c143db 100644 --- a/org.argeo.app.geo/src/org/argeo/app/geo/http/WfsHttpHandler.java +++ b/org.argeo.app.geo/src/org/argeo/app/geo/http/WfsHttpHandler.java @@ -34,10 +34,22 @@ import org.argeo.app.geo.GeoJson; import org.argeo.app.geo.GeoUtils; import org.argeo.app.geo.GpxUtils; import org.argeo.app.geo.JTS; +import org.argeo.app.geo.acr.GeoEntityUtils; import org.argeo.cms.acr.json.AcrJsonUtils; +import org.argeo.cms.auth.RemoteAuthUtils; import org.argeo.cms.http.HttpHeader; +import org.argeo.cms.http.RemoteAuthHttpExchange; import org.argeo.cms.http.server.HttpServerUtils; import org.argeo.cms.util.LangUtils; +import org.geotools.api.feature.GeometryAttribute; +import org.geotools.api.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeatureType; +import org.geotools.api.feature.type.AttributeDescriptor; +import org.geotools.api.feature.type.Name; +import org.geotools.api.referencing.FactoryException; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.referencing.operation.MathTransform; +import org.geotools.api.referencing.operation.TransformException; import org.geotools.feature.DefaultFeatureCollection; import org.geotools.feature.NameImpl; import org.geotools.feature.simple.SimpleFeatureBuilder; @@ -48,17 +60,7 @@ import org.geotools.wfs.GML.Version; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Envelope; import org.locationtech.jts.geom.Geometry; -import org.locationtech.jts.geom.Point; import org.locationtech.jts.geom.Polygon; -import org.opengis.feature.GeometryAttribute; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; -import org.opengis.feature.type.AttributeDescriptor; -import org.opengis.feature.type.Name; -import org.opengis.referencing.FactoryException; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.TransformException; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; @@ -112,7 +114,8 @@ public class WfsHttpHandler implements HttpHandler { outputFormat = "application/json"; } String bboxStr = getKvpParameter(parameters, BBOX); - log.debug(bboxStr); + if (log.isTraceEnabled()) + log.trace(bboxStr); final Envelope bbox; if (bboxStr != null) { String srs; @@ -199,7 +202,10 @@ public class WfsHttpHandler implements HttpHandler { if (featureAdapter == null) throw new IllegalStateException("No feature adapter found for " + typeName); // f.isContentClass(typeName); - featureAdapter.addConstraintsForFeature((AndFilter) search.getWhere(), typeName); + RemoteAuthUtils.doAs(() -> { + featureAdapter.addConstraintsForFeature((AndFilter) search.getWhere(), typeName); + return null; + }, new RemoteAuthHttpExchange(exchange)); } if (bbox != null) { @@ -355,12 +361,7 @@ public class WfsHttpHandler implements HttpHandler { protected Geometry getDefaultGeometry(Content content) { if (content.hasContentClass(EntityType.geopoint)) { - double latitude = content.get(WGS84PosName.lat, Double.class).get(); - double longitude = content.get(WGS84PosName.lon, Double.class).get(); - - Coordinate coordinate = new Coordinate(longitude, latitude); - Point the_geom = JTS.GEOMETRY_FACTORY.createPoint(coordinate); - return the_geom; + return GeoEntityUtils.toPoint(content); } return null; }