Skip to content

Commit

Permalink
-fix rewrite rule
Browse files Browse the repository at this point in the history
-fix formatting
  • Loading branch information
holomekc committed Dec 11, 2023
1 parent 11b2aa8 commit 7b36b60
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,22 @@ jobs:
docker container run -d --name test -p 8080:8080 ${{ matrix.versions.IMAGES[0] }}
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/mappings; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/matched; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/unmatched; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/state; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/files; do sleep 1; done'
docker container rm -f test
# version
docker container run -d --name test -p 8080:8080 ${{ matrix.versions.IMAGES[1] }}
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/mappings; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/matched; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/unmatched; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/state; do sleep 1; done'
timeout 10 bash -c 'while ! curl --fail http://localhost:8080/__admin/webapp/files; do sleep 1; done'
docker container rm -f test
- name: Push wiremock-gui image to Docker HUB
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ dependencies {
}
api platform("com.fasterxml.jackson:jackson-bom:$versions.jackson")
api "com.fasterxml.jackson.core:jackson-core",
"com.fasterxml.jackson.core:jackson-annotations",
"com.fasterxml.jackson.core:jackson-databind",
"com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
"com.fasterxml.jackson.core:jackson-annotations",
"com.fasterxml.jackson.core:jackson-databind",
"com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
api "org.apache.httpcomponents.client5:httpclient5:5.2.1"
api "org.xmlunit:xmlunit-core:$versions.xmlUnit"
api "org.xmlunit:xmlunit-legacy:$versions.xmlUnit", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ public void handle(
handlers.setHandlers(
ArrayUtils.addAll(extensionHandlers(), adminContext, asyncTimeoutSettingHandler));

// We prepend the rewrite handle for the wiremock gui web app to make sure that we route the requests properly
// We prepend the rewrite handle for the wiremock gui web app to make sure that we route the
// requests properly
final RewriteHandler rewriteHandler = webAppRewriteContext(adminContext);
handlers.prependHandler(rewriteHandler);

Expand Down Expand Up @@ -396,10 +397,10 @@ private ServletContextHandler addAdminContext(

// Include wiremock-gui websocket into admin context
JakartaWebSocketServletContainerInitializer.configure(
adminContext,
(servletContext, serverContainer) -> {
serverContainer.addEndpoint(WebSocketEndpoint.class);
});
adminContext,
(servletContext, serverContainer) -> {
serverContainer.addEndpoint(WebSocketEndpoint.class);
});

decorateAdminServiceContextAfterConfig(adminContext);

Expand All @@ -413,8 +414,8 @@ protected void decorateAdminServiceContextAfterConfig(
ServletContextHandler adminServiceContext) {}

/**
* Rewrite web app. We use Angular. We must rewrite every /__admin/webapp path to the index.html of our
* single page application.
* Rewrite web app. We use Angular. We must rewrite every /__admin/webapp path to the index.html
* of our single page application.
*
* @param adminContextHandler admin context handler is used to provide the static file content
* @return the rewrite handler
Expand All @@ -425,7 +426,7 @@ private RewriteHandler webAppRewriteContext(ServletContextHandler adminContextHa
rewrite.setRewritePathInfo(true);

RewriteRegexRule rewriteRule = new RewriteRegexRule();
rewriteRule.setRegex("/__admin/webapp/(mappings|matched|unmatched|state).*");
rewriteRule.setRegex("/__admin/webapp/(mappings|matched|unmatched|state|files).*");
rewriteRule.setReplacement("/__admin/webapp/index.html");
rewrite.addRule(rewriteRule);

Expand Down

0 comments on commit 7b36b60

Please sign in to comment.