|
4 | 4 | */
|
5 | 5 | package org.geoserver.cloud.gwc.config.services;
|
6 | 6 |
|
| 7 | +import org.geoserver.catalog.Catalog; |
| 8 | +import org.geoserver.gwc.controller.GwcUrlHandlerMapping; |
| 9 | +import org.geoserver.gwc.layer.GWCGeoServerRESTConfigurationProvider; |
7 | 10 | import org.geowebcache.rest.converter.GWCConverter;
|
8 | 11 | import org.geowebcache.util.ApplicationContextProvider;
|
9 | 12 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
15 | 18 | * The original {@literal geowebcache-rest-context.xml}:
|
16 | 19 | *
|
17 | 20 | * <pre>{@code
|
18 |
| - * <!-- Used by org.geoserver.rest.RestConfiguration when setting up converters --> |
19 |
| - * <bean id="gwcConverter" class="org.geowebcache.rest.converter.GWCConverter"> |
20 |
| - * <constructor-arg ref="gwcAppCtx" /> |
21 |
| - * </bean> |
| 21 | + * <!-- Used by org.geoserver.rest.RestConfiguration when setting up converters --> |
| 22 | + * <bean id="gwcConverter" class="org.geowebcache.rest.converter.GWCConverter"> |
| 23 | + * <constructor-arg ref="gwcAppCtx" /> |
| 24 | + * </bean> |
22 | 25 | *
|
23 |
| - * <context:component-scan base-package= |
24 |
| - * "org.geowebcache.rest, org.geowebcache.diskquota.rest.controller, org.geowebcache.service.wmts" /> |
| 26 | + * <bean id="GWCGeoServerRESTConfigurationProvider" class="org.geoserver.gwc.layer.GWCGeoServerRESTConfigurationProvider"> |
| 27 | + * <description> |
| 28 | + * XmlConfiguration contributor to set up XStream with GeoServer provided configuration objects for GWC's REST API |
| 29 | + * </description> |
| 30 | + * <constructor-arg ref="catalog"/> |
| 31 | + * </bean> |
| 32 | + * |
| 33 | + * <!-- Specific URL mapping for GWC WMTS REST API --> |
| 34 | + * <bean id="gwcWmtsRestUrlHandlerMapping" class="org.geoserver.gwc.controller.GwcUrlHandlerMapping"> |
| 35 | + * <constructor-arg ref="catalog" /> |
| 36 | + * <constructor-arg type="java.lang.String" value="/gwc/rest/wmts" /> |
| 37 | + * <property name="alwaysUseFullPath" value="true" /> |
| 38 | + * <property name="order" value="10" /> |
| 39 | + * </bean> |
| 40 | + * |
| 41 | + * <context:component-scan base-package="org.geowebcache.rest, org.geowebcache.diskquota.rest.controller" /> |
25 | 42 | * }</pre>
|
26 | 43 | *
|
27 | 44 | * <p>scans too much. We're only scanning {@literal org.geowebcache.rest}. {@literal
|
@@ -50,7 +67,51 @@ public class RESTConfigConfiguration {
|
50 | 67 | * @param appCtx
|
51 | 68 | */
|
52 | 69 | @SuppressWarnings("rawtypes")
|
53 |
| - public @Bean GWCConverter<?> gwcConverter(ApplicationContextProvider appCtx) { |
| 70 | + @Bean |
| 71 | + GWCConverter<?> gwcConverter(ApplicationContextProvider appCtx) { |
54 | 72 | return new GWCConverter(appCtx);
|
55 | 73 | }
|
| 74 | + |
| 75 | + /** |
| 76 | + * The original {@literal geowebcache-rest-context.xml}: |
| 77 | + * |
| 78 | + * <pre>{@code |
| 79 | + * <bean id="GWCGeoServerRESTConfigurationProvider" class="org.geoserver.gwc.layer.GWCGeoServerRESTConfigurationProvider"> |
| 80 | + * <description> |
| 81 | + * XmlConfiguration contributor to set up XStream with GeoServer provided configuration objects for GWC's REST API |
| 82 | + * </description> |
| 83 | + * <constructor-arg ref="catalog"/> |
| 84 | + * </bean> |
| 85 | + * }</pre> |
| 86 | + * |
| 87 | + * @param catalog |
| 88 | + */ |
| 89 | + @Bean |
| 90 | + GWCGeoServerRESTConfigurationProvider gwcGeoServerRESTConfigurationProvider(Catalog catalog) { |
| 91 | + return new GWCGeoServerRESTConfigurationProvider(catalog); |
| 92 | + } |
| 93 | + |
| 94 | + /** |
| 95 | + * The original {@literal geowebcache-rest-context.xml}: |
| 96 | + * |
| 97 | + * <pre>{@code |
| 98 | + * <!-- Specific URL mapping for GWC WMTS REST API --> |
| 99 | + * <bean id="gwcWmtsRestUrlHandlerMapping" class="org.geoserver.gwc.controller.GwcUrlHandlerMapping"> |
| 100 | + * <constructor-arg ref="catalog" /> |
| 101 | + * <constructor-arg type="java.lang.String" value="/gwc/rest/wmts" /> |
| 102 | + * <property name="alwaysUseFullPath" value="true" /> |
| 103 | + * <property name="order" value="10" /> |
| 104 | + * </bean> |
| 105 | + * }</pre> |
| 106 | + * |
| 107 | + * @param catalog |
| 108 | + * @param catalog |
| 109 | + */ |
| 110 | + @Bean |
| 111 | + GwcUrlHandlerMapping gwcWmtsRestUrlHandlerMapping(Catalog catalog) { |
| 112 | + GwcUrlHandlerMapping handler = new GwcUrlHandlerMapping(catalog, "/gwc/rest/wmts"); |
| 113 | + handler.setAlwaysUseFullPath(true); |
| 114 | + handler.setOrder(10); |
| 115 | + return handler; |
| 116 | + } |
56 | 117 | }
|
0 commit comments