Skip to content

Commit

Permalink
Issue #12000 Replace URI.create with ResourceFactory in jetty maven p…
Browse files Browse the repository at this point in the history
…lugin.
  • Loading branch information
janbartel committed Jul 4, 2024
1 parent 347da8e commit 6247190
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
<systemPropertyVariables>
<jetty.port.file>${jetty.port.file}</jetty.port.file>
<maven.it.name>${project.groupId}:${project.artifactId}</maven.it.name>
<contentCheck>BLAH</contentCheck>
<pathToCheck>/blah.html</pathToCheck>
<contentCheck>SPACY</contentCheck>
<pathToCheck>/spacy.html</pathToCheck>
</systemPropertyVariables>
<dependenciesToScan>
<dependency>org.eclipse.jetty.ee10:jetty-ee10-maven-plugin</dependency>
Expand Down Expand Up @@ -95,6 +95,7 @@
<webApp>
<resourceBases>
<resourceBase>${project.basedir}/public</resourceBase>
<resourceBase>${project.basedir}/with space</resourceBase>
<resourceBase>${project.basedir}/src/main/webapp</resourceBase>
</resourceBases>
</webApp>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SPACY
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.resource.CombinedResource;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
import org.eclipse.jetty.util.resource.Resources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -230,11 +231,11 @@ public void setResourceBases(String[] resourceBases)

// This is a user provided list of configurations.
// We have to assume that mounting can happen.
List<URI> uris = Stream.of(resourceBases)
.map(URI::create)
List<Resource> resources = Stream.of(resourceBases)
.map(s -> ResourceFactory.of(this).newResource(s))
.toList();

setBaseResource(this.getResourceFactory().newResource(uris));
setBaseResource(ResourceFactory.combine(resources));
}
catch (Throwable t)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,10 @@ public void setResourceBases(String[] resourceBases)

// This is a user provided list of configurations.
// We have to assume that mounting can happen.
List<URI> uris = Stream.of(resourceBases)
.map(URI::create)
List<Resource> resources = Stream.of(resourceBases)
.map(s -> ResourceFactory.of(this).newResource(s))
.toList();
Resource r = ResourceFactory.of(this).newResource(uris);

Resource r = ResourceFactory.combine(resources);
setBaseResource(r);
}
catch (Throwable t)
Expand Down

0 comments on commit 6247190

Please sign in to comment.