diff --git a/src/apps/geoserver/restconfig/src/main/java/org/geoserver/cloud/restconfig/RestConfigApplication.java b/src/apps/geoserver/restconfig/src/main/java/org/geoserver/cloud/restconfig/RestConfigApplication.java index 00b2b8d43..921cf39e8 100644 --- a/src/apps/geoserver/restconfig/src/main/java/org/geoserver/cloud/restconfig/RestConfigApplication.java +++ b/src/apps/geoserver/restconfig/src/main/java/org/geoserver/cloud/restconfig/RestConfigApplication.java @@ -4,6 +4,7 @@ */ package org.geoserver.cloud.restconfig; +import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.retry.annotation.EnableRetry; @@ -16,8 +17,12 @@ public static void main(String[] args) { try { SpringApplication.run(RestConfigApplication.class, args); } catch (RuntimeException e) { - e.printStackTrace(); - System.exit(-1); + try { + LoggerFactory.getLogger(RestConfigApplication.class) + .error("Application run failed", e); + } finally { + System.exit(-1); + } } } } diff --git a/src/apps/geoserver/wcs/src/main/java/org/geoserver/cloud/wcs/WCSController.java b/src/apps/geoserver/wcs/src/main/java/org/geoserver/cloud/wcs/WCSController.java index 67699dca6..a1658a7ce 100644 --- a/src/apps/geoserver/wcs/src/main/java/org/geoserver/cloud/wcs/WCSController.java +++ b/src/apps/geoserver/wcs/src/main/java/org/geoserver/cloud/wcs/WCSController.java @@ -4,16 +4,13 @@ */ package org.geoserver.cloud.wcs; -import static org.springframework.web.bind.annotation.RequestMethod.GET; -import static org.springframework.web.bind.annotation.RequestMethod.POST; - import org.geoserver.cloud.virtualservice.VirtualServiceVerifier; import org.geoserver.ows.Dispatcher; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; @@ -39,16 +36,19 @@ public void getSchema(HttpServletRequest request, HttpServletResponse response) classPathPublisher.handleRequest(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/wcs", "/ows"}) - public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { - geoserverDispatcher.handleRequest(request, response); + @GetMapping(path = {"/wcs", "/ows"}) + public void handleGet(HttpServletRequest request, HttpServletResponse response) + throws Exception { + dispatch(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/{virtualService}/wcs", "/{virtualService}/ows"}) + @PostMapping(path = {"/wcs", "/ows"}) + public void handlePost(HttpServletRequest request, HttpServletResponse response) + throws Exception { + dispatch(request, response); + } + + @GetMapping(path = {"/{virtualService}/wcs", "/{virtualService}/ows"}) public void handleVirtualService( @PathVariable(name = "virtualService") String virtualService, HttpServletRequest request, @@ -56,13 +56,21 @@ public void handleVirtualService( throws Exception { virtualServiceVerifier.checkVirtualService(virtualService); + dispatch(request, response); + } - geoserverDispatcher.handleRequest(request, response); + @PostMapping(path = {"/{virtualService}/wcs", "/{virtualService}/ows"}) + public void handleVirtualServicePost( + @PathVariable(name = "virtualService") String virtualService, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService); + dispatch(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/{virtualService}/{layer}/wcs", "/{virtualService}/{layer}/ows"}) + @GetMapping(path = {"/{virtualService}/{layer}/wcs", "/{virtualService}/{layer}/ows"}) public void handleVirtualServiceLayer( @PathVariable(name = "virtualService") String virtualService, @PathVariable(name = "layer") String layer, @@ -71,6 +79,23 @@ public void handleVirtualServiceLayer( throws Exception { virtualServiceVerifier.checkVirtualService(virtualService, layer); + dispatch(request, response); + } + + @PostMapping(path = {"/{virtualService}/{layer}/wcs", "/{virtualService}/{layer}/ows"}) + public void handleVirtualServiceLayerPost( + @PathVariable(name = "virtualService") String virtualService, + @PathVariable(name = "layer") String layer, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService, layer); + dispatch(request, response); + } + + private void dispatch(HttpServletRequest request, HttpServletResponse response) + throws Exception { geoserverDispatcher.handleRequest(request, response); } } diff --git a/src/apps/geoserver/wcs/src/main/java/org/geoserver/cloud/wcs/WcsApplication.java b/src/apps/geoserver/wcs/src/main/java/org/geoserver/cloud/wcs/WcsApplication.java index 24137ad37..3c8f86a8d 100644 --- a/src/apps/geoserver/wcs/src/main/java/org/geoserver/cloud/wcs/WcsApplication.java +++ b/src/apps/geoserver/wcs/src/main/java/org/geoserver/cloud/wcs/WcsApplication.java @@ -4,6 +4,7 @@ */ package org.geoserver.cloud.wcs; +import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.retry.annotation.EnableRetry; @@ -16,8 +17,11 @@ public static void main(String[] args) { try { SpringApplication.run(WcsApplication.class, args); } catch (RuntimeException e) { - e.printStackTrace(); - System.exit(-1); + try { + LoggerFactory.getLogger(WcsApplication.class).error("Application run failed", e); + } finally { + System.exit(-1); + } } } } diff --git a/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/web/app/WebUIApplication.java b/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/web/app/WebUIApplication.java index bccf2d46d..fca4410f4 100644 --- a/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/web/app/WebUIApplication.java +++ b/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/web/app/WebUIApplication.java @@ -4,6 +4,7 @@ */ package org.geoserver.cloud.web.app; +import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.event.ApplicationReadyEvent; @@ -19,8 +20,11 @@ public static void main(String[] args) { try { SpringApplication.run(WebUIApplication.class, args); } catch (RuntimeException e) { - e.printStackTrace(); - System.exit(-1); + try { + LoggerFactory.getLogger(WebUIApplication.class).error("Application run failed", e); + } finally { + System.exit(-1); + } } } diff --git a/src/apps/geoserver/wfs/src/main/java/org/geoserver/cloud/wfs/app/WFSController.java b/src/apps/geoserver/wfs/src/main/java/org/geoserver/cloud/wfs/app/WFSController.java index d72d3221a..b22b5a803 100644 --- a/src/apps/geoserver/wfs/src/main/java/org/geoserver/cloud/wfs/app/WFSController.java +++ b/src/apps/geoserver/wfs/src/main/java/org/geoserver/cloud/wfs/app/WFSController.java @@ -4,16 +4,13 @@ */ package org.geoserver.cloud.wfs.app; -import static org.springframework.web.bind.annotation.RequestMethod.GET; -import static org.springframework.web.bind.annotation.RequestMethod.POST; - import org.geoserver.cloud.virtualservice.VirtualServiceVerifier; import org.geoserver.ows.Dispatcher; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; @@ -40,31 +37,42 @@ public void getSchema(HttpServletRequest request, HttpServletResponse response) classPathPublisher.handleRequest(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/wfs", "/ows"}) - public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { - geoserverDispatcher.handleRequest(request, response); + @GetMapping(path = {"/wfs", "/ows"}) + public void handleGet(HttpServletRequest request, HttpServletResponse response) + throws Exception { + dispatch(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/{virtualService}/wfs", "/{virtualService}/ows"}) - public void handleVirtualService( + @PostMapping(path = {"/wfs", "/ows"}) + public void handlePost(HttpServletRequest request, HttpServletResponse response) + throws Exception { + dispatch(request, response); + } + + @GetMapping(path = {"/{virtualService}/wfs", "/{virtualService}/ows"}) + public void handleVirtualServiceGet( @PathVariable(name = "virtualService") String virtualService, HttpServletRequest request, HttpServletResponse response) throws Exception { virtualServiceVerifier.checkVirtualService(virtualService); + dispatch(request, response); + } - geoserverDispatcher.handleRequest(request, response); + @PostMapping(path = {"/{virtualService}/wfs", "/{virtualService}/ows"}) + public void handleVirtualServicePost( + @PathVariable(name = "virtualService") String virtualService, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService); + dispatch(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/{virtualService}/{layer}/wfs", "/{virtualService}/{layer}/ows"}) - public void handleVirtualServiceLayer( + @GetMapping(path = {"/{virtualService}/{layer}/wfs", "/{virtualService}/{layer}/ows"}) + public void handleVirtualServiceLayerGet( @PathVariable(name = "virtualService") String virtualService, @PathVariable(name = "layer") String layer, HttpServletRequest request, @@ -72,6 +80,23 @@ public void handleVirtualServiceLayer( throws Exception { virtualServiceVerifier.checkVirtualService(virtualService, layer); + dispatch(request, response); + } + + @PostMapping(path = {"/{virtualService}/{layer}/wfs", "/{virtualService}/{layer}/ows"}) + public void handleVirtualServiceLayerPost( + @PathVariable(name = "virtualService") String virtualService, + @PathVariable(name = "layer") String layer, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService, layer); + dispatch(request, response); + } + + private void dispatch(HttpServletRequest request, HttpServletResponse response) + throws Exception { geoserverDispatcher.handleRequest(request, response); } } diff --git a/src/apps/geoserver/wms/src/main/java/org/geoserver/cloud/wms/app/WmsApplication.java b/src/apps/geoserver/wms/src/main/java/org/geoserver/cloud/wms/app/WmsApplication.java index 6020e6205..87e4831a2 100644 --- a/src/apps/geoserver/wms/src/main/java/org/geoserver/cloud/wms/app/WmsApplication.java +++ b/src/apps/geoserver/wms/src/main/java/org/geoserver/cloud/wms/app/WmsApplication.java @@ -4,6 +4,7 @@ */ package org.geoserver.cloud.wms.app; +import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.retry.annotation.EnableRetry; @@ -16,8 +17,11 @@ public static void main(String[] args) { try { SpringApplication.run(WmsApplication.class, args); } catch (RuntimeException e) { - e.printStackTrace(); - System.exit(-1); + try { + LoggerFactory.getLogger(WmsApplication.class).error("Application run failed", e); + } finally { + System.exit(-1); + } } } } diff --git a/src/apps/geoserver/wms/src/main/java/org/geoserver/cloud/wms/controller/WMSController.java b/src/apps/geoserver/wms/src/main/java/org/geoserver/cloud/wms/controller/WMSController.java index 95fe1ff20..4f90d3327 100644 --- a/src/apps/geoserver/wms/src/main/java/org/geoserver/cloud/wms/controller/WMSController.java +++ b/src/apps/geoserver/wms/src/main/java/org/geoserver/cloud/wms/controller/WMSController.java @@ -4,16 +4,13 @@ */ package org.geoserver.cloud.wms.controller; -import static org.springframework.web.bind.annotation.RequestMethod.GET; -import static org.springframework.web.bind.annotation.RequestMethod.POST; - import org.geoserver.cloud.virtualservice.VirtualServiceVerifier; import org.geoserver.ows.Dispatcher; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; @@ -64,31 +61,42 @@ public void getStaticResource(HttpServletRequest request, HttpServletResponse re classPathPublisher.handleRequest(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/wms", "/ows"}) - public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { - geoserverDispatcher.handleRequest(request, response); + @GetMapping(path = {"/wms", "/ows"}) + public void handleGet(HttpServletRequest request, HttpServletResponse response) + throws Exception { + dispatch(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/{virtualService}/wms", "/{virtualService}/ows"}) - public void handleVirtualService( + @PostMapping(path = {"/wms", "/ows"}) + public void handlePost(HttpServletRequest request, HttpServletResponse response) + throws Exception { + dispatch(request, response); + } + + @GetMapping(path = {"/{virtualService}/wms", "/{virtualService}/ows"}) + public void handleVirtualServiceGet( @PathVariable(name = "virtualService") String virtualService, HttpServletRequest request, HttpServletResponse response) throws Exception { virtualServiceVerifier.checkVirtualService(virtualService); + dispatch(request, response); + } - geoserverDispatcher.handleRequest(request, response); + @PostMapping(path = {"/{virtualService}/wms", "/{virtualService}/ows"}) + public void handleVirtualServicePost( + @PathVariable(name = "virtualService") String virtualService, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService); + dispatch(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/{virtualService}/{layer}/wms", "/{virtualService}/{layer}/ows"}) - public void handleVirtualServiceLayer( + @GetMapping(path = {"/{virtualService}/{layer}/wms", "/{virtualService}/{layer}/ows"}) + public void handleVirtualServiceLayerGet( @PathVariable(name = "virtualService") String virtualService, @PathVariable(name = "layer") String layer, HttpServletRequest request, @@ -96,6 +104,23 @@ public void handleVirtualServiceLayer( throws Exception { virtualServiceVerifier.checkVirtualService(virtualService, layer); + dispatch(request, response); + } + + @PostMapping(path = {"/{virtualService}/{layer}/wms", "/{virtualService}/{layer}/ows"}) + public void handleVirtualServiceLayerPost( + @PathVariable(name = "virtualService") String virtualService, + @PathVariable(name = "layer") String layer, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService, layer); + dispatch(request, response); + } + + private void dispatch(HttpServletRequest request, HttpServletResponse response) + throws Exception { geoserverDispatcher.handleRequest(request, response); } } diff --git a/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WPSController.java b/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WPSController.java index 40a675207..a344db6b7 100644 --- a/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WPSController.java +++ b/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WPSController.java @@ -4,14 +4,13 @@ */ package org.geoserver.cloud.wps; -import static org.springframework.web.bind.annotation.RequestMethod.GET; -import static org.springframework.web.bind.annotation.RequestMethod.POST; - +import org.geoserver.cloud.virtualservice.VirtualServiceVerifier; import org.geoserver.ows.Dispatcher; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.http.HttpServletRequest; @@ -23,6 +22,8 @@ private @Autowired org.geoserver.ows.ClasspathPublisher classPathPublisher; + private @Autowired VirtualServiceVerifier virtualServiceVerifier; + @GetMapping("/") public RedirectView redirectRootToGetCapabilities() { return new RedirectView("/wps?SERVICE=WPS&REQUEST=GetCapabilities"); @@ -35,10 +36,66 @@ public void getSchema(HttpServletRequest request, HttpServletResponse response) classPathPublisher.handleRequest(request, response); } - @RequestMapping( - method = {GET, POST}, - path = {"/wps", "/{workspace}/wps", "/ows", "/{workspace}/ows"}) - public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { + @GetMapping(path = {"/wps", "/ows"}) + public void handleGet(HttpServletRequest request, HttpServletResponse response) + throws Exception { + dispatch(request, response); + } + + @PostMapping(path = {"/wps", "/ows"}) + public void handlePost(HttpServletRequest request, HttpServletResponse response) + throws Exception { + dispatch(request, response); + } + + @GetMapping(path = {"/{virtualService}/wps", "/{virtualService}/ows"}) + public void handleVirtualServiceGet( + @PathVariable(name = "virtualService") String virtualService, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService); + dispatch(request, response); + } + + @PostMapping(path = {"/{virtualService}/wps", "/{virtualService}/ows"}) + public void handleVirtualServicePost( + @PathVariable(name = "virtualService") String virtualService, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService); + dispatch(request, response); + } + + @GetMapping(path = {"/{virtualService}/{layer}/wps", "/{virtualService}/{layer}/ows"}) + public void handleVirtualServiceLayerGet( + @PathVariable(name = "virtualService") String virtualService, + @PathVariable(name = "layer") String layer, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService, layer); + dispatch(request, response); + } + + @PostMapping(path = {"/{virtualService}/{layer}/wps", "/{virtualService}/{layer}/ows"}) + public void handleVirtualServiceLayerPost( + @PathVariable(name = "virtualService") String virtualService, + @PathVariable(name = "layer") String layer, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + virtualServiceVerifier.checkVirtualService(virtualService, layer); + dispatch(request, response); + } + + private void dispatch(HttpServletRequest request, HttpServletResponse response) + throws Exception { geoserverDispatcher.handleRequest(request, response); } } diff --git a/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WpsApplication.java b/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WpsApplication.java index 5fa143927..7164707e1 100644 --- a/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WpsApplication.java +++ b/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WpsApplication.java @@ -4,6 +4,7 @@ */ package org.geoserver.cloud.wps; +import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.retry.annotation.EnableRetry; @@ -16,8 +17,11 @@ public static void main(String[] args) { try { SpringApplication.run(WpsApplication.class, args); } catch (RuntimeException e) { - e.printStackTrace(); - System.exit(-1); + try { + LoggerFactory.getLogger(WpsApplication.class).error("Application run failed", e); + } finally { + System.exit(-1); + } } } } diff --git a/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WpsApplicationConfiguration.java b/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WpsApplicationConfiguration.java index 569d23832..60a1961b9 100644 --- a/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WpsApplicationConfiguration.java +++ b/src/apps/geoserver/wps/src/main/java/org/geoserver/cloud/wps/WpsApplicationConfiguration.java @@ -5,6 +5,8 @@ package org.geoserver.cloud.wps; import org.geoserver.cloud.config.factory.FilteringXmlBeanDefinitionReader; +import org.geoserver.cloud.virtualservice.VirtualServiceVerifier; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; @@ -22,4 +24,10 @@ // "jar:gs-web-core-.*!/applicationContext.xml", // // "jar:gs-web-wps-.*!/applicationContext.xml", // }) -public class WpsApplicationConfiguration {} +public class WpsApplicationConfiguration { + + @Bean + VirtualServiceVerifier virtualServiceVerifier() { + return new VirtualServiceVerifier(); + } +} diff --git a/src/catalog/backends/datadir/src/main/java/org/geoserver/cloud/config/catalog/backend/datadirectory/ParallelDataDirectoryGeoServerLoader.java b/src/catalog/backends/datadir/src/main/java/org/geoserver/cloud/config/catalog/backend/datadirectory/ParallelDataDirectoryGeoServerLoader.java index 0f58da40a..57eb6eeab 100644 --- a/src/catalog/backends/datadir/src/main/java/org/geoserver/cloud/config/catalog/backend/datadirectory/ParallelDataDirectoryGeoServerLoader.java +++ b/src/catalog/backends/datadir/src/main/java/org/geoserver/cloud/config/catalog/backend/datadirectory/ParallelDataDirectoryGeoServerLoader.java @@ -4,7 +4,11 @@ */ package org.geoserver.cloud.config.catalog.backend.datadirectory; -import static org.geoserver.catalog.StyleInfo.*; +import static org.geoserver.catalog.StyleInfo.DEFAULT_GENERIC; +import static org.geoserver.catalog.StyleInfo.DEFAULT_LINE; +import static org.geoserver.catalog.StyleInfo.DEFAULT_POINT; +import static org.geoserver.catalog.StyleInfo.DEFAULT_POLYGON; +import static org.geoserver.catalog.StyleInfo.DEFAULT_RASTER; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; @@ -28,6 +32,7 @@ import org.geoserver.platform.config.UpdateSequence; import org.geoserver.security.GeoServerSecurityManager; import org.geotools.api.referencing.FactoryException; +import org.geotools.api.referencing.NoSuchAuthorityCodeException; import org.vfny.geoserver.util.DataStoreUtils; import java.io.IOException; @@ -92,8 +97,13 @@ protected CatalogImpl newTemporaryCatalog() { return new CatalogPlugin(); } - /** There's no {@link GeoServerLoaderProxy} in gs-cloud */ - public @PostConstruct void load() { + /** + * There's no {@link GeoServerLoaderProxy} in gs-cloud + * + * @throws FactoryException + * @throws NoSuchAuthorityCodeException + */ + public @PostConstruct void load() throws FactoryException { triggerCollaboratorBeansLoading(); final long initialSequence = updateSequence.currValue(); @@ -107,17 +117,15 @@ protected CatalogImpl newTemporaryCatalog() { } } - /** */ - private void triggerCollaboratorBeansLoading() { + /** + * @throws FactoryException + * @throws NoSuchAuthorityCodeException + */ + private void triggerCollaboratorBeansLoading() throws FactoryException { // force initializing the referencing subsystem or can get // "java.lang.IllegalArgumentException: NumberSystem // tech.units.indriya.function.DefaultNumberSystem not found" when hit in parallel - try { - org.geotools.referencing.CRS.decode("EPSG:4326"); - } catch (FactoryException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + org.geotools.referencing.CRS.decode("EPSG:4326"); // misconfigured layers may end up calling FeatureTypeInfo.getFeatureType(), which in turn // will trigger GeoServerExtensions and deadlock on the main thread's while spring is diff --git a/src/catalog/backends/pgsql/src/main/java/org/geoserver/cloud/backend/pgsql/resource/PgsqlResourceStore.java b/src/catalog/backends/pgsql/src/main/java/org/geoserver/cloud/backend/pgsql/resource/PgsqlResourceStore.java index 34820d88a..03763e88e 100644 --- a/src/catalog/backends/pgsql/src/main/java/org/geoserver/cloud/backend/pgsql/resource/PgsqlResourceStore.java +++ b/src/catalog/backends/pgsql/src/main/java/org/geoserver/cloud/backend/pgsql/resource/PgsqlResourceStore.java @@ -150,13 +150,12 @@ public long save(@NonNull PgsqlResource resource, byte[] contents) { } public long getLastmodified(long resourceId) { - Long mtime = + Timestamp ts = template.queryForObject( - "SELECT mtime FROM resourcestore WHERE id = ?", - Timestamp.class, - resourceId) - .getTime(); - return null == mtime ? 0L : mtime.longValue(); + "SELECT mtime FROM resourcestore WHERE id = ?", + Timestamp.class, + resourceId); + return null == ts ? 0L : ts.getTime(); } @Override diff --git a/src/catalog/jackson-bindings/geoserver/src/main/java/org/geoserver/jackson/databind/mapper/SharedMappers.java b/src/catalog/jackson-bindings/geoserver/src/main/java/org/geoserver/jackson/databind/mapper/SharedMappers.java index cb1ccfef2..1cadac57e 100644 --- a/src/catalog/jackson-bindings/geoserver/src/main/java/org/geoserver/jackson/databind/mapper/SharedMappers.java +++ b/src/catalog/jackson-bindings/geoserver/src/main/java/org/geoserver/jackson/databind/mapper/SharedMappers.java @@ -30,7 +30,6 @@ import org.mapstruct.ObjectFactory; import org.mapstruct.ReportingPolicy; import org.mapstruct.factory.Mappers; -import org.springframework.lang.Nullable; import java.util.Optional; @@ -86,8 +85,8 @@ public Class canonicalNameToClass(String value) { } /** Added due to {@link GMLInfo#getMimeTypeToForce()} */ - public String optToString(@Nullable Optional value) { - return value == null ? null : value.orElse(null); + public String optToString(Optional value) { + return value.orElse(null); } public Optional stringToOpt(String value) { diff --git a/src/gwc/services/src/main/java/org/gwc/web/rest/GeoWebCacheController.java b/src/gwc/services/src/main/java/org/gwc/web/rest/GeoWebCacheController.java index ed16ac773..b4de323ae 100644 --- a/src/gwc/services/src/main/java/org/gwc/web/rest/GeoWebCacheController.java +++ b/src/gwc/services/src/main/java/org/gwc/web/rest/GeoWebCacheController.java @@ -9,6 +9,7 @@ import org.geowebcache.controller.GeoWebCacheDispatcherController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest; @@ -27,14 +28,15 @@ public class GeoWebCacheController { private @Autowired GeoWebCacheDispatcher gwcDispatcher; - @RequestMapping( + @GetMapping( path = { "", "/home", "/demo/**", "/proxy/**", }) - public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { + public void handleGet(HttpServletRequest request, HttpServletResponse response) + throws Exception { gwcDispatcher.handleRequest(request, response); } }