Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gwc - handles workspace-based paths (#380) #529

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

pmauduit
Copy link
Collaborator

@pmauduit pmauduit commented Sep 27, 2024

See #380 for the context.

Extending the geowebcacheDispatcher to get full control of how the URLs are mangled in the geoserver cloud context.

Introducing a new class which allows to unzip a functional geoserver datadir so that we could test the geowebcache microservice more easily. The default one which was being used was creating fake objects not usable to test GWC.

Adding some tests to actually make sure that the different possible GWC entry points can be queried, with the different expected URI formats.

@pmauduit
Copy link
Collaborator Author

Most of the files from this PR are due to adding a test datadir to src/test/resources in the microservice. Revisiting to have it into a zip file instead.

@pmauduit pmauduit force-pushed the fix-missing-gwc-local-paths-380 branch from aec8946 to c317285 Compare September 29, 2024 11:22
@pmauduit
Copy link
Collaborator Author

New version of the PR which includes a zipped test datadir in the gs-cloud-catalog-plugin module instead of having the 500+ files in src/test/resources.

But going through the the geoserver dispatcher instead of the gwc dispatcher makes the regular GWC ui unreachable anymore. Tests are ok because they only test the http return code, which is actually a xml error page with a 200-OK HTTP return code.

@pmauduit pmauduit force-pushed the fix-missing-gwc-local-paths-380 branch 3 times, most recently from e45d9c9 to af0a09d Compare September 30, 2024 12:29
@pmauduit
Copy link
Collaborator Author

pmauduit commented Sep 30, 2024

Adding tests / splitting into different test methods
Comparing with a vanilla geoserver docker image, it seems that not all namespace-prefixed urls are working:

  • {namespace}/gwc/demo does not work, but it ends up with a 400-Bad request on a vanilla geoserver (2.26.0) docker image
  • {namespace}/gwc/demo/{layer} does not work, works in vanilla GS docker
  • {namespace}/gwc/demo/{namespace}:{layer} does not work, works in vanilla GS docker

@pmauduit pmauduit force-pushed the fix-missing-gwc-local-paths-380 branch 3 times, most recently from 44460fe to 7b8ba03 Compare September 30, 2024 16:18
@pmauduit pmauduit force-pushed the fix-missing-gwc-local-paths-380 branch from 7b8ba03 to bc7cf9b Compare October 1, 2024 13:49
@pmauduit
Copy link
Collaborator Author

pmauduit commented Oct 1, 2024

Adding a class to override the default behaviour of the GeoWebCacheDispatcher, and being able to have full control on mangling the requested URIs, but I am now wondering if some of the modifications brought by this PR are still useful or not (esp. the added beans).

Comment on lines +49 to 110
@Bean
VirtualServiceVerifier virtualServiceVerifier(@Qualifier("rawCatalog") Catalog catalog) {
return new VirtualServiceVerifier(catalog);
}

/**
* GS's src/web/gwc/src/main/java/applicationContext.xml
* <!-- Used for workspace-based demo requests so the requests to GS stay workspace-based -->
* <bean id="gwcDemoUrlHandlerMapping"
* class="org.geoserver.gwc.controller.GwcUrlHandlerMapping"> <constructor-arg ref="catalog" />
* <constructor-arg value="/gwc/demo"/> <property name="alwaysUseFullPath" value="true" />
* <property name="order" value="10" /> </bean>
* <!-- Used for workspace-based web requests (i.e. for rest/web/openlayer/ol.js) -->
* <bean id="gwcRestWebUrlHandlerMapping"
* class="org.geoserver.gwc.controller.GwcUrlHandlerMapping"> <constructor-arg ref="catalog" />
* <constructor-arg type="java.lang.String" value="/gwc/rest/web"/> <property
* name="alwaysUseFullPath" value="true" /> <property name="order" value="10" /> </bean>
*/
@Bean
@Qualifier("gwcDemoUrlHandlerMapping")
GwcUrlHandlerMapping gwcDemoUrlHandlerMapping(@Qualifier("rawCatalog") Catalog catalog) {
GwcUrlHandlerMapping handler = new GwcUrlHandlerMapping(catalog, "/gwc/demo");
handler.setAlwaysUseFullPath(true);
handler.setOrder(10);

return handler;
}

/*
@Bean
WebMvcRegistrations gwcDemoUrlHandlerMappingRegistrations(
@Qualifier("gwcDemoUrlHandlerMapping") GwcUrlHandlerMapping handler) {
return new WebMvcRegistrations() {
@Override
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
return handler;
}
};
}*/

@Bean
@Qualifier("gwcRestWebUrlHandlerMapping")
GwcUrlHandlerMapping gwcRestWebUrlHandlerMapping(@Qualifier("rawCatalog") Catalog catalog) {
GwcUrlHandlerMapping handler = new GwcUrlHandlerMapping(catalog, "/gwc/rest/web");
handler.setAlwaysUseFullPath(true);
handler.setOrder(10);

return handler;
}

/*
@Bean
WebMvcRegistrations gwcRestWebUrlHandlerMappingRegistrations(
@Qualifier("gwcRestWebUrlHandlerMapping") GwcUrlHandlerMapping handler) {
return new WebMvcRegistrations() {
@Override
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
return handler;
}
};
}*/
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this is still required

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing them and the testsuite still pass.

@pmauduit pmauduit requested a review from groldan October 1, 2024 14:50
@groldan groldan merged commit 645e1b6 into geoserver:main Oct 1, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants