Skip to content

Commit

Permalink
Merge branch 'wicket-10.x-bootstrap-5.x' into deps-10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-g authored Dec 31, 2024
2 parents 759cb91 + ab9f6c5 commit 000bfa8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.wicket.markup.html.IPackageResourceGuard;
import org.apache.wicket.markup.html.SecurePackageResourceGuard;
import org.apache.wicket.request.resource.IResourceReferenceFactory;
import org.apache.wicket.request.resource.IResourceUrlSanitizer;
import org.apache.wicket.request.resource.ResourceReferenceRegistry;

/**
Expand Down Expand Up @@ -39,6 +40,10 @@ public static void install(final Application app, final SassCompilerOptionsFacto
ResourceReferenceRegistry resourceReferenceRegistry = app.getResourceReferenceRegistry();
IResourceReferenceFactory delegate = resourceReferenceRegistry.getResourceReferenceFactory();
resourceReferenceRegistry.setResourceReferenceFactory(new SassResourceReferenceFactory(delegate));

IResourceUrlSanitizer sanitizer = app.getResourceSettings().getUrlSanitizer();
SassResourceUrlSanitizer sassSanitizer = new SassResourceUrlSanitizer(sanitizer);
app.getResourceSettings().setUrlSanitizer(sassSanitizer);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package de.agilecoders.wicket.sass;

import org.apache.wicket.request.resource.IResourceUrlSanitizer;
import org.apache.wicket.request.resource.ResourceReference;

public class SassResourceUrlSanitizer implements IResourceUrlSanitizer
{

private IResourceUrlSanitizer delegate;

public SassResourceUrlSanitizer(IResourceUrlSanitizer delegate)
{
this.delegate = delegate;
}

@Override
public ResourceReference.UrlAttributes sanitize(ResourceReference.UrlAttributes urlAttributes,
Class<?> scope, String name)
{
if (ContextRelativeSassResourceReference.CONTEXT_RELATIVE_SASS_REFERENCE_VARIATION.equals(
urlAttributes.getVariation()))
{
return urlAttributes;
}
else
{
return delegate.sanitize(urlAttributes, scope, name);
}
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<junit-platform.version>1.11.4</junit-platform.version>
<jsass.version>5.11.1</jsass.version>
<hamcrest.version>3.0</hamcrest.version>
<logback.version>1.5.14</logback.version>
<logback.version>1.5.15</logback.version>
<modernizr.version>2.8.3-1</modernizr.version>
<mockito.version>5.14.2</mockito.version>
<jakarta.servlet-api.version>5.0.0</jakarta.servlet-api.version>
Expand Down

0 comments on commit 000bfa8

Please sign in to comment.