Jetty 12 : Rename resourceBase to baseResource (#8310)
* rename to baseResource
This commit is contained in:
parent
e0a9c21615
commit
af5fecd18d
|
@ -94,17 +94,17 @@
|
||||||
* gzip content encoded if a matching resource is
|
* gzip content encoded if a matching resource is
|
||||||
* found ending with ".gz"
|
* found ending with ".gz"
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class AllowedResourceAliasChecker extends AbstractLifeCycle implements Co
|
||||||
*/
|
*/
|
||||||
public AllowedResourceAliasChecker(ContextHandler contextHandler)
|
public AllowedResourceAliasChecker(ContextHandler contextHandler)
|
||||||
{
|
{
|
||||||
this(contextHandler, contextHandler::getResourceBase);
|
this(contextHandler, contextHandler::getBaseResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AllowedResourceAliasChecker(ContextHandler contextHandler, Resource baseResource)
|
public AllowedResourceAliasChecker(ContextHandler contextHandler, Resource baseResource)
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class ContextHandler extends Handler.Wrapper implements Attributes, Grace
|
||||||
|
|
||||||
private String _displayName;
|
private String _displayName;
|
||||||
private String _contextPath = "/";
|
private String _contextPath = "/";
|
||||||
private Resource _resourceBase;
|
private Resource _baseResource;
|
||||||
private ClassLoader _classLoader;
|
private ClassLoader _classLoader;
|
||||||
private Request.Processor _errorProcessor;
|
private Request.Processor _errorProcessor;
|
||||||
private boolean _allowNullPathInContext;
|
private boolean _allowNullPathInContext;
|
||||||
|
@ -675,9 +675,9 @@ public class ContextHandler extends Handler.Wrapper implements Attributes, Grace
|
||||||
* @return Returns the base resource as a string.
|
* @return Returns the base resource as a string.
|
||||||
*/
|
*/
|
||||||
@ManagedAttribute("document root for context")
|
@ManagedAttribute("document root for context")
|
||||||
public Resource getResourceBase()
|
public Resource getBaseResource()
|
||||||
{
|
{
|
||||||
return _resourceBase;
|
return _baseResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -689,10 +689,9 @@ public class ContextHandler extends Handler.Wrapper implements Attributes, Grace
|
||||||
{
|
{
|
||||||
if (isStarted())
|
if (isStarted())
|
||||||
throw new IllegalStateException(getState());
|
throw new IllegalStateException(getState());
|
||||||
_resourceBase = resourceBase;
|
_baseResource = resourceBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO inline this ???
|
|
||||||
public void setBaseResource(Path path)
|
public void setBaseResource(Path path)
|
||||||
{
|
{
|
||||||
setBaseResource(path == null ? null : ResourceFactory.root().newResource(path));
|
setBaseResource(path == null ? null : ResourceFactory.root().newResource(path));
|
||||||
|
@ -740,7 +739,7 @@ public class ContextHandler extends Handler.Wrapper implements Attributes, Grace
|
||||||
if (getDisplayName() != null)
|
if (getDisplayName() != null)
|
||||||
b.append(getDisplayName()).append(',');
|
b.append(getDisplayName()).append(',');
|
||||||
b.append(getContextPath());
|
b.append(getContextPath());
|
||||||
b.append(",b=").append(getResourceBase());
|
b.append(",b=").append(getBaseResource());
|
||||||
b.append(",a=").append(_availability.get());
|
b.append(",a=").append(_availability.get());
|
||||||
|
|
||||||
if (!vhosts.isEmpty())
|
if (!vhosts.isEmpty())
|
||||||
|
@ -833,7 +832,7 @@ public class ContextHandler extends Handler.Wrapper implements Attributes, Grace
|
||||||
@Override
|
@Override
|
||||||
public Resource getBaseResource()
|
public Resource getBaseResource()
|
||||||
{
|
{
|
||||||
return _resourceBase;
|
return _baseResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class ResourceHandler extends Handler.Wrapper
|
||||||
/**
|
/**
|
||||||
* @return Returns the resourceBase.
|
* @return Returns the resourceBase.
|
||||||
*/
|
*/
|
||||||
public Resource getResourceBase()
|
public Resource getBaseResource()
|
||||||
{
|
{
|
||||||
return _resourceBase;
|
return _resourceBase;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.server.jmx;
|
package org.eclipse.jetty.server.jmx;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jetty.jmx.ObjectMBean;
|
import org.eclipse.jetty.jmx.ObjectMBean;
|
||||||
|
@ -71,8 +70,8 @@ public class AbstractHandlerMBean extends ObjectMBean
|
||||||
name = "ROOT";
|
name = "ROOT";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null && context.getResourceBase() != null)
|
if (name == null && context.getBaseResource() != null)
|
||||||
name = context.getResourceBase().getPath().getFileName().toString();
|
name = context.getBaseResource().getPath().getFileName().toString();
|
||||||
|
|
||||||
List<String> vhosts = context.getVirtualHosts();
|
List<String> vhosts = context.getVirtualHosts();
|
||||||
if (vhosts.size() > 0)
|
if (vhosts.size() > 0)
|
||||||
|
|
|
@ -1810,7 +1810,7 @@ public class ResourceHandlerTest
|
||||||
_rootResourceHandler.stop();
|
_rootResourceHandler.stop();
|
||||||
_rootResourceHandler.setBaseResource(Resource.combine(
|
_rootResourceHandler.setBaseResource(Resource.combine(
|
||||||
ResourceFactory.root().newResource(MavenTestingUtils.getTestResourcePathDir("layer0/")),
|
ResourceFactory.root().newResource(MavenTestingUtils.getTestResourcePathDir("layer0/")),
|
||||||
_rootResourceHandler.getResourceBase()));
|
_rootResourceHandler.getBaseResource()));
|
||||||
_rootResourceHandler.start();
|
_rootResourceHandler.start();
|
||||||
|
|
||||||
HttpTester.Response response = HttpTester.parseResponse(
|
HttpTester.Response response = HttpTester.parseResponse(
|
||||||
|
@ -1872,7 +1872,7 @@ public class ResourceHandlerTest
|
||||||
_rootResourceHandler.setBaseResource(Resource.combine(
|
_rootResourceHandler.setBaseResource(Resource.combine(
|
||||||
ResourceFactory.root().newResource(MavenTestingUtils.getTestResourcePathDir("layer0/")),
|
ResourceFactory.root().newResource(MavenTestingUtils.getTestResourcePathDir("layer0/")),
|
||||||
ResourceFactory.root().newResource(MavenTestingUtils.getTestResourcePathDir("layer1/")),
|
ResourceFactory.root().newResource(MavenTestingUtils.getTestResourcePathDir("layer1/")),
|
||||||
_rootResourceHandler.getResourceBase()));
|
_rootResourceHandler.getBaseResource()));
|
||||||
_rootResourceHandler.start();
|
_rootResourceHandler.start();
|
||||||
|
|
||||||
HttpTester.Response response = HttpTester.parseResponse(
|
HttpTester.Response response = HttpTester.parseResponse(
|
||||||
|
|
|
@ -102,17 +102,17 @@
|
||||||
* If set to a boolean True, then a default set of compressed formats
|
* If set to a boolean True, then a default set of compressed formats
|
||||||
* will be used, otherwise no precompressed formats.
|
* will be used, otherwise no precompressed formats.
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -16,7 +16,7 @@ detected.
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<!-- Required minimal context configuration : -->
|
<!-- Required minimal context configuration : -->
|
||||||
<!-- + contextPath -->
|
<!-- + contextPath -->
|
||||||
<!-- + war OR resourceBase -->
|
<!-- + war OR baseResource -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<Set name="contextPath">/</Set>
|
<Set name="contextPath">/</Set>
|
||||||
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/test.war</Set>
|
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/test.war</Set>
|
||||||
|
|
|
@ -10,7 +10,7 @@ Configure and deploy the test web application
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<!-- Required minimal context configuration : -->
|
<!-- Required minimal context configuration : -->
|
||||||
<!-- + contextPath -->
|
<!-- + contextPath -->
|
||||||
<!-- + war OR resourceBase -->
|
<!-- + war OR baseResource -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<Set name="contextPath">/ee10-test</Set>
|
<Set name="contextPath">/ee10-test</Set>
|
||||||
<Set name="war"><Property name="jetty.webapps" default="." />/ee10-demo-jetty.war
|
<Set name="war"><Property name="jetty.webapps" default="." />/ee10-demo-jetty.war
|
||||||
|
|
|
@ -126,7 +126,7 @@ public abstract class AbstractUnassembledWebAppMojo extends AbstractWebAppMojo
|
||||||
//The first time we run, remember the original base dir
|
//The first time we run, remember the original base dir
|
||||||
if (originalBaseResource == null)
|
if (originalBaseResource == null)
|
||||||
{
|
{
|
||||||
if (webApp.getResourceBase() == null)
|
if (webApp.getBaseResource() == null)
|
||||||
{
|
{
|
||||||
//Use the default static resource location
|
//Use the default static resource location
|
||||||
if (!webAppSourceDirectory.exists())
|
if (!webAppSourceDirectory.exists())
|
||||||
|
@ -134,7 +134,7 @@ public abstract class AbstractUnassembledWebAppMojo extends AbstractWebAppMojo
|
||||||
originalBaseResource = ResourceFactory.of(webApp).newResource(webAppSourceDirectory.getCanonicalPath());
|
originalBaseResource = ResourceFactory.of(webApp).newResource(webAppSourceDirectory.getCanonicalPath());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
originalBaseResource = webApp.getResourceBase();
|
originalBaseResource = webApp.getBaseResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
//On every subsequent re-run set it back to the original base dir before
|
//On every subsequent re-run set it back to the original base dir before
|
||||||
|
@ -175,11 +175,11 @@ public abstract class AbstractUnassembledWebAppMojo extends AbstractWebAppMojo
|
||||||
}
|
}
|
||||||
|
|
||||||
//Still don't have a web.xml file: try the resourceBase of the webapp, if it is set
|
//Still don't have a web.xml file: try the resourceBase of the webapp, if it is set
|
||||||
if (webApp.getDescriptor() == null && webApp.getResourceBase() != null)
|
if (webApp.getDescriptor() == null && webApp.getBaseResource() != null)
|
||||||
{
|
{
|
||||||
// TODO: should never return from WEB-INF/lib/foo.jar!/WEB-INF/web.xml
|
// TODO: should never return from WEB-INF/lib/foo.jar!/WEB-INF/web.xml
|
||||||
// TODO: should also never return from a META-INF/versions/#/WEB-INF/web.xml location
|
// TODO: should also never return from a META-INF/versions/#/WEB-INF/web.xml location
|
||||||
Resource r = webApp.getResourceBase().resolve("WEB-INF/web.xml");
|
Resource r = webApp.getBaseResource().resolve("WEB-INF/web.xml");
|
||||||
if (r.exists() && !r.isDirectory())
|
if (r.exists() && !r.isDirectory())
|
||||||
{
|
{
|
||||||
webApp.setDescriptor(r.toString());
|
webApp.setDescriptor(r.toString());
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class MavenQuickStartConfiguration extends QuickStartConfiguration
|
||||||
|
|
||||||
//Iterate over all of the resource bases and ignore any that were original bases, just
|
//Iterate over all of the resource bases and ignore any that were original bases, just
|
||||||
//deleting the overlays
|
//deleting the overlays
|
||||||
Resource res = context.getResourceBase();
|
Resource res = context.getBaseResource();
|
||||||
if (res instanceof ResourceCollection)
|
if (res instanceof ResourceCollection)
|
||||||
{
|
{
|
||||||
for (Resource r : ((ResourceCollection)res).getResources())
|
for (Resource r : ((ResourceCollection)res).getResources())
|
||||||
|
|
|
@ -47,21 +47,21 @@ public class OverlayManager
|
||||||
for (Overlay o : getOverlays())
|
for (Overlay o : getOverlays())
|
||||||
{
|
{
|
||||||
//can refer to the current project in list of overlays for ordering purposes
|
//can refer to the current project in list of overlays for ordering purposes
|
||||||
if (o.getConfig() != null && o.getConfig().isCurrentProject() && webApp.getResourceBase().exists())
|
if (o.getConfig() != null && o.getConfig().isCurrentProject() && webApp.getBaseResource().exists())
|
||||||
{
|
{
|
||||||
resourceBases.add(webApp.getResourceBase());
|
resourceBases.add(webApp.getBaseResource());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//add in the selectively unpacked overlay in the correct order to the webapp's resource base
|
//add in the selectively unpacked overlay in the correct order to the webapp's resource base
|
||||||
resourceBases.add(unpackOverlay(o));
|
resourceBases.add(unpackOverlay(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resourceBases.contains(webApp.getResourceBase()) && webApp.getResourceBase().exists())
|
if (!resourceBases.contains(webApp.getBaseResource()) && webApp.getBaseResource().exists())
|
||||||
{
|
{
|
||||||
if (webApp.getBaseAppFirst())
|
if (webApp.getBaseAppFirst())
|
||||||
resourceBases.add(0, webApp.getResourceBase());
|
resourceBases.add(0, webApp.getBaseResource());
|
||||||
else
|
else
|
||||||
resourceBases.add(webApp.getResourceBase());
|
resourceBases.add(webApp.getBaseResource());
|
||||||
}
|
}
|
||||||
|
|
||||||
webApp.setBaseResource(Resource.combine(resourceBases));
|
webApp.setBaseResource(Resource.combine(resourceBases));
|
||||||
|
|
|
@ -105,11 +105,11 @@ public class WebAppPropertyConverter
|
||||||
props.put(TMP_DIR_PERSIST, Boolean.toString(webApp.isPersistTempDirectory()));
|
props.put(TMP_DIR_PERSIST, Boolean.toString(webApp.isPersistTempDirectory()));
|
||||||
|
|
||||||
//send over the calculated resource bases that includes unpacked overlays
|
//send over the calculated resource bases that includes unpacked overlays
|
||||||
Resource baseResource = webApp.getResourceBase();
|
Resource baseResource = webApp.getBaseResource();
|
||||||
if (baseResource instanceof ResourceCollection)
|
if (baseResource instanceof ResourceCollection)
|
||||||
props.put(BASE_DIRS, toCSV(((ResourceCollection)webApp.getResourceBase()).getResources()));
|
props.put(BASE_DIRS, toCSV(((ResourceCollection)webApp.getBaseResource()).getResources()));
|
||||||
else if (baseResource instanceof Resource)
|
else if (baseResource instanceof Resource)
|
||||||
props.put(BASE_DIRS, webApp.getResourceBase().toString());
|
props.put(BASE_DIRS, webApp.getBaseResource().toString());
|
||||||
|
|
||||||
//if there is a war file, use that
|
//if there is a war file, use that
|
||||||
if (webApp.getWar() != null)
|
if (webApp.getWar() != null)
|
||||||
|
|
|
@ -152,9 +152,9 @@ public class TestWebAppPropertyConverter
|
||||||
assertEquals(true, webApp.isPersistTempDirectory());
|
assertEquals(true, webApp.isPersistTempDirectory());
|
||||||
assertEquals(war.getAbsolutePath(), webApp.getWar());
|
assertEquals(war.getAbsolutePath(), webApp.getWar());
|
||||||
assertEquals(webXml.getAbsolutePath(), webApp.getDescriptor());
|
assertEquals(webXml.getAbsolutePath(), webApp.getDescriptor());
|
||||||
assertThat(webApp.getResourceBase(), instanceOf(ResourceCollection.class));
|
assertThat(webApp.getBaseResource(), instanceOf(ResourceCollection.class));
|
||||||
|
|
||||||
ResourceCollection resourceCollection = (ResourceCollection)webApp.getResourceBase();
|
ResourceCollection resourceCollection = (ResourceCollection)webApp.getBaseResource();
|
||||||
List<URI> actual = resourceCollection.getResources().stream().filter(Objects::nonNull).map(Resource::getURI).toList();
|
List<URI> actual = resourceCollection.getResources().stream().filter(Objects::nonNull).map(Resource::getURI).toList();
|
||||||
URI[] expected = new URI[]{base1.toURI(), base2.toURI()};
|
URI[] expected = new URI[]{base1.toURI(), base2.toURI()};
|
||||||
assertThat(actual, containsInAnyOrder(expected));
|
assertThat(actual, containsInAnyOrder(expected));
|
||||||
|
|
|
@ -94,17 +94,17 @@
|
||||||
* gzip content encoded if a matching resource is
|
* gzip content encoded if a matching resource is
|
||||||
* found ending with ".gz"
|
* found ending with ".gz"
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.nio.file.Files;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.jetty.ee10.annotations.AnnotationConfiguration;
|
|
||||||
import org.eclipse.jetty.ee10.annotations.AnnotationDecorator;
|
import org.eclipse.jetty.ee10.annotations.AnnotationDecorator;
|
||||||
import org.eclipse.jetty.ee10.webapp.AbstractConfiguration;
|
import org.eclipse.jetty.ee10.webapp.AbstractConfiguration;
|
||||||
import org.eclipse.jetty.ee10.webapp.Configuration;
|
import org.eclipse.jetty.ee10.webapp.Configuration;
|
||||||
|
@ -96,7 +95,7 @@ public class QuickStartConfiguration extends AbstractConfiguration
|
||||||
|
|
||||||
//check that webapp is suitable for quick start - it is not a packed war
|
//check that webapp is suitable for quick start - it is not a packed war
|
||||||
String war = context.getWar();
|
String war = context.getWar();
|
||||||
if (war == null || war.length() <= 0 || !context.getResourceBase().isDirectory())
|
if (war == null || war.length() <= 0 || !context.getBaseResource().isDirectory())
|
||||||
throw new IllegalStateException("Bad Quickstart location");
|
throw new IllegalStateException("Bad Quickstart location");
|
||||||
|
|
||||||
//look for quickstart-web.xml in WEB-INF of webapp
|
//look for quickstart-web.xml in WEB-INF of webapp
|
||||||
|
@ -233,7 +232,7 @@ public class QuickStartConfiguration extends AbstractConfiguration
|
||||||
Resource webInf = context.getWebInf();
|
Resource webInf = context.getWebInf();
|
||||||
if (webInf == null || !webInf.exists())
|
if (webInf == null || !webInf.exists())
|
||||||
{
|
{
|
||||||
Files.createDirectories(context.getResourceBase().getPath().resolve("WEB-INF"));
|
Files.createDirectories(context.getBaseResource().getPath().resolve("WEB-INF"));
|
||||||
webInf = context.getWebInf();
|
webInf = context.getWebInf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class QuickStartDescriptorProcessor extends IterativeDescriptorProcessor
|
||||||
default -> values.add(value);
|
default -> values.add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributeNormalizer normalizer = new AttributeNormalizer(context.getResourceBase());
|
AttributeNormalizer normalizer = new AttributeNormalizer(context.getBaseResource());
|
||||||
// handle values
|
// handle values
|
||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
|
@ -240,7 +240,7 @@ public class QuickStartDescriptorProcessor extends IterativeDescriptorProcessor
|
||||||
|
|
||||||
//also add to base resource of webapp
|
//also add to base resource of webapp
|
||||||
List<Resource> collection = new ArrayList<>();
|
List<Resource> collection = new ArrayList<>();
|
||||||
collection.add(context.getResourceBase());
|
collection.add(context.getBaseResource());
|
||||||
collection.addAll(metaInfResources);
|
collection.addAll(metaInfResources);
|
||||||
context.setBaseResource(Resource.combine(collection));
|
context.setBaseResource(Resource.combine(collection));
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class QuickStartGeneratorConfiguration extends AbstractConfiguration
|
||||||
_originAttribute = DEFAULT_ORIGIN_ATTRIBUTE_NAME;
|
_originAttribute = DEFAULT_ORIGIN_ATTRIBUTE_NAME;
|
||||||
context.getMetaData().getOrigins();
|
context.getMetaData().getOrigins();
|
||||||
|
|
||||||
if (context.getResourceBase() == null)
|
if (context.getBaseResource() == null)
|
||||||
throw new IllegalArgumentException("No base resource for " + this);
|
throw new IllegalArgumentException("No base resource for " + this);
|
||||||
|
|
||||||
MetaData md = context.getMetaData();
|
MetaData md = context.getMetaData();
|
||||||
|
@ -166,7 +166,7 @@ public class QuickStartGeneratorConfiguration extends AbstractConfiguration
|
||||||
// Set some special context parameters
|
// Set some special context parameters
|
||||||
|
|
||||||
// The location of the war file on disk
|
// The location of the war file on disk
|
||||||
AttributeNormalizer normalizer = new AttributeNormalizer(context.getResourceBase());
|
AttributeNormalizer normalizer = new AttributeNormalizer(context.getBaseResource());
|
||||||
|
|
||||||
// The library order
|
// The library order
|
||||||
addContextParamFromAttribute(context, out, ServletContext.ORDERED_LIBS);
|
addContextParamFromAttribute(context, out, ServletContext.ORDERED_LIBS);
|
||||||
|
|
|
@ -16,7 +16,7 @@ detected.
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<!-- Required minimal context configuration : -->
|
<!-- Required minimal context configuration : -->
|
||||||
<!-- + contextPath -->
|
<!-- + contextPath -->
|
||||||
<!-- + war OR resourceBase -->
|
<!-- + war OR baseResource -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<Set name="contextPath">/test</Set>
|
<Set name="contextPath">/test</Set>
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ import org.eclipse.jetty.util.resource.ResourceFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO restore javadoc
|
||||||
|
*/
|
||||||
public class DefaultServlet extends HttpServlet
|
public class DefaultServlet extends HttpServlet
|
||||||
{
|
{
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(DefaultServlet.class);
|
private static final Logger LOG = LoggerFactory.getLogger(DefaultServlet.class);
|
||||||
|
@ -94,8 +97,8 @@ public class DefaultServlet extends HttpServlet
|
||||||
_resourceService = new ServletResourceService(servletContextHandler);
|
_resourceService = new ServletResourceService(servletContextHandler);
|
||||||
_resourceService.setWelcomeFactory(_resourceService);
|
_resourceService.setWelcomeFactory(_resourceService);
|
||||||
|
|
||||||
_baseResource = servletContextHandler.getResourceBase();
|
_baseResource = servletContextHandler.getBaseResource();
|
||||||
String rb = getInitParameter("resourceBase");
|
String rb = getInitParameter("baseResource", "resourceBase");
|
||||||
if (rb != null)
|
if (rb != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -105,7 +108,7 @@ public class DefaultServlet extends HttpServlet
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOG.warn("Unable to create resourceBase from {}", rb, e);
|
LOG.warn("Unable to create baseResource from {}", rb, e);
|
||||||
throw new UnavailableException(e.toString());
|
throw new UnavailableException(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,6 +228,25 @@ public class DefaultServlet extends HttpServlet
|
||||||
LOG.debug("base resource = {}", _baseResource);
|
LOG.debug("base resource = {}", _baseResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getInitParameter(String name, String... deprecated)
|
||||||
|
{
|
||||||
|
String value = super.getInitParameter(name);
|
||||||
|
if (value != null)
|
||||||
|
return value;
|
||||||
|
|
||||||
|
for (String d : deprecated)
|
||||||
|
{
|
||||||
|
value = super.getInitParameter(d);
|
||||||
|
if (value != name)
|
||||||
|
{
|
||||||
|
LOG.warn("Deprecated {} used instead of {}", d, name);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy()
|
public void destroy()
|
||||||
{
|
{
|
||||||
|
|
|
@ -853,7 +853,7 @@ public class ServletContextHandler extends ContextHandler implements Graceful
|
||||||
if (pathInContext == null || !pathInContext.startsWith(URIUtil.SLASH))
|
if (pathInContext == null || !pathInContext.startsWith(URIUtil.SLASH))
|
||||||
throw new MalformedURLException(pathInContext);
|
throw new MalformedURLException(pathInContext);
|
||||||
|
|
||||||
Resource baseResource = getResourceBase();
|
Resource baseResource = getBaseResource();
|
||||||
if (baseResource == null)
|
if (baseResource == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -1235,7 +1235,7 @@ public class ServletContextHandler extends ContextHandler implements Graceful
|
||||||
if (getContextPath() == null)
|
if (getContextPath() == null)
|
||||||
throw new IllegalStateException("Null contextPath");
|
throw new IllegalStateException("Null contextPath");
|
||||||
|
|
||||||
Resource baseResource = getResourceBase();
|
Resource baseResource = getBaseResource();
|
||||||
if (baseResource != null && baseResource.isAlias())
|
if (baseResource != null && baseResource.isAlias())
|
||||||
LOG.warn("BaseResource {} is aliased to {} in {}. May not be supported in future releases.",
|
LOG.warn("BaseResource {} is aliased to {} in {}. May not be supported in future releases.",
|
||||||
baseResource, baseResource.getAlias(), this);
|
baseResource, baseResource.getAlias(), this);
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class ServletTester extends ContainerLifeCycle
|
||||||
|
|
||||||
public Resource getResourceBase()
|
public Resource getResourceBase()
|
||||||
{
|
{
|
||||||
return _context.getResourceBase();
|
return _context.getBaseResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResourceBase(Resource base)
|
public void setResourceBase(Resource base)
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<Item>
|
<Item>
|
||||||
<New id="defcontext" class="org.eclipse.jetty.server.handler.ContextHandler">
|
<New id="defcontext" class="org.eclipse.jetty.server.handler.ContextHandler">
|
||||||
<Set name="contextPath">/tests</Set>
|
<Set name="contextPath">/tests</Set>
|
||||||
<Set name="ResourceBase"><Property name="test.docroot.base"/>/default
|
<Set name="baseResource"><Property name="test.docroot.base"/>/default
|
||||||
</Set>
|
</Set>
|
||||||
<Set name="Handler">
|
<Set name="Handler">
|
||||||
<New id="reshandler" class="org.eclipse.jetty.server.handler.ResourceHandler"/>
|
<New id="reshandler" class="org.eclipse.jetty.server.handler.ResourceHandler"/>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<Item>VirtualHost</Item>
|
<Item>VirtualHost</Item>
|
||||||
</Array>
|
</Array>
|
||||||
</Set>
|
</Set>
|
||||||
<Set name="ResourceBase"><Property name="test.docroot.base"/>/virtualhost</Set>
|
<Set name="BaseResource"><Property name="test.docroot.base"/>/virtualhost</Set>
|
||||||
<Set name="Handler"><New id="reshandler1" class="org.eclipse.jetty.server.handler.ResourceHandler"/></Set>
|
<Set name="Handler"><New id="reshandler1" class="org.eclipse.jetty.server.handler.ResourceHandler"/></Set>
|
||||||
<Set name="DisplayName">virtual</Set>
|
<Set name="DisplayName">virtual</Set>
|
||||||
</New>
|
</New>
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
<Item>
|
<Item>
|
||||||
<New id="defcontext" class="org.eclipse.jetty.server.handler.ContextHandler">
|
<New id="defcontext" class="org.eclipse.jetty.server.handler.ContextHandler">
|
||||||
<Set name="contextPath">/tests</Set>
|
<Set name="contextPath">/tests</Set>
|
||||||
<Set name="ResourceBase"><Property name="test.docroot.base"/>/default</Set>
|
<Set name="BaseResource"><Property name="test.docroot.base"/>/default</Set>
|
||||||
<Set name="Handler"><New id="reshandler2" class="org.eclipse.jetty.server.handler.ResourceHandler"/></Set>
|
<Set name="Handler"><New id="reshandler2" class="org.eclipse.jetty.server.handler.ResourceHandler"/></Set>
|
||||||
<Set name="DisplayName">default</Set>
|
<Set name="DisplayName">default</Set>
|
||||||
</New>
|
</New>
|
||||||
|
|
|
@ -94,17 +94,17 @@
|
||||||
* gzip content encoded if a matching resource is
|
* gzip content encoded if a matching resource is
|
||||||
* found ending with ".gz"
|
* found ending with ".gz"
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -94,17 +94,17 @@
|
||||||
* If set to a boolean True, then a default set of compressed formats
|
* If set to a boolean True, then a default set of compressed formats
|
||||||
* will be used, otherwise no precompressed formats.
|
* will be used, otherwise no precompressed formats.
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -264,7 +264,7 @@ public class MetaInfConfiguration extends AbstractConfiguration
|
||||||
if (resources != null && !resources.isEmpty())
|
if (resources != null && !resources.isEmpty())
|
||||||
{
|
{
|
||||||
List<Resource> collection = new ArrayList<>();
|
List<Resource> collection = new ArrayList<>();
|
||||||
collection.add(context.getResourceBase());
|
collection.add(context.getBaseResource());
|
||||||
collection.addAll(resources);
|
collection.addAll(resources);
|
||||||
context.setBaseResource(Resource.combine(collection));
|
context.setBaseResource(Resource.combine(collection));
|
||||||
}
|
}
|
||||||
|
|
|
@ -786,7 +786,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the war as a file or URL string (Resource).
|
* @return Returns the war as a file or URL string (Resource).
|
||||||
* The war may be different to the @link {@link #getResourceBase()}
|
* The war may be different to the @link {@link #getBaseResource()}
|
||||||
* if the war has been expanded and/or copied.
|
* if the war has been expanded and/or copied.
|
||||||
*/
|
*/
|
||||||
@ManagedAttribute(value = "war file location", readonly = true)
|
@ManagedAttribute(value = "war file location", readonly = true)
|
||||||
|
@ -794,9 +794,9 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||||
{
|
{
|
||||||
if (_war == null)
|
if (_war == null)
|
||||||
{
|
{
|
||||||
if (getResourceBase() != null)
|
if (getBaseResource() != null)
|
||||||
{
|
{
|
||||||
Path warPath = getResourceBase().getPath();
|
Path warPath = getBaseResource().getPath();
|
||||||
if (warPath != null)
|
if (warPath != null)
|
||||||
_war = warPath.toUri().toASCIIString();
|
_war = warPath.toUri().toASCIIString();
|
||||||
}
|
}
|
||||||
|
@ -806,7 +806,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||||
|
|
||||||
public Resource getWebInf() throws IOException
|
public Resource getWebInf() throws IOException
|
||||||
{
|
{
|
||||||
if (getResourceBase() == null)
|
if (getBaseResource() == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Is there a WEB-INF directory anywhere in the Resource Base?
|
// Is there a WEB-INF directory anywhere in the Resource Base?
|
||||||
|
@ -814,7 +814,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||||
// The result could be a ResourceCollection with multiple WEB-INF directories
|
// The result could be a ResourceCollection with multiple WEB-INF directories
|
||||||
// Can return from WEB-INF/lib/foo.jar!/WEB-INF
|
// Can return from WEB-INF/lib/foo.jar!/WEB-INF
|
||||||
// Can also never return from a META-INF/versions/#/WEB-INF location
|
// Can also never return from a META-INF/versions/#/WEB-INF location
|
||||||
Resource webInf = getResourceBase().resolve("WEB-INF/");
|
Resource webInf = getBaseResource().resolve("WEB-INF/");
|
||||||
if (!webInf.exists() || !webInf.isDirectory())
|
if (!webInf.exists() || !webInf.isDirectory())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -929,9 +929,9 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||||
else
|
else
|
||||||
name = _war;
|
name = _war;
|
||||||
}
|
}
|
||||||
else if (getResourceBase() != null)
|
else if (getBaseResource() != null)
|
||||||
{
|
{
|
||||||
name = getResourceBase().getURI().toASCIIString();
|
name = getBaseResource().getURI().toASCIIString();
|
||||||
int webapps = name.indexOf("/webapps/");
|
int webapps = name.indexOf("/webapps/");
|
||||||
if (webapps >= 0)
|
if (webapps >= 0)
|
||||||
name = name.substring(webapps + 8);
|
name = name.substring(webapps + 8);
|
||||||
|
|
|
@ -281,9 +281,9 @@ public class WebInfConfiguration extends AbstractConfiguration
|
||||||
|
|
||||||
public void unpack(WebAppContext context) throws IOException
|
public void unpack(WebAppContext context) throws IOException
|
||||||
{
|
{
|
||||||
Resource webApp = context.getResourceBase();
|
Resource webApp = context.getBaseResource();
|
||||||
_resourceFactory = ResourceFactory.closeable();
|
_resourceFactory = ResourceFactory.closeable();
|
||||||
_preUnpackBaseResource = context.getResourceBase();
|
_preUnpackBaseResource = context.getBaseResource();
|
||||||
|
|
||||||
if (webApp == null)
|
if (webApp == null)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,7 @@ public class WebInfConfiguration extends AbstractConfiguration
|
||||||
if (war != null && war.length() > 0)
|
if (war != null && war.length() > 0)
|
||||||
webApp = context.newResource(war);
|
webApp = context.newResource(war);
|
||||||
else
|
else
|
||||||
webApp = context.getResourceBase();
|
webApp = context.getBaseResource();
|
||||||
|
|
||||||
if (webApp == null)
|
if (webApp == null)
|
||||||
throw new IllegalStateException("No resourceBase or war set for context");
|
throw new IllegalStateException("No resourceBase or war set for context");
|
||||||
|
@ -516,7 +516,7 @@ public class WebInfConfiguration extends AbstractConfiguration
|
||||||
// Resource base
|
// Resource base
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Resource resource = context.getResourceBase();
|
Resource resource = context.getBaseResource();
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
{
|
{
|
||||||
if (context.getWar() == null || context.getWar().length() == 0)
|
if (context.getWar() == null || context.getWar().length() == 0)
|
||||||
|
|
|
@ -16,7 +16,7 @@ detected.
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<!-- Required minimal context configuration : -->
|
<!-- Required minimal context configuration : -->
|
||||||
<!-- + contextPath -->
|
<!-- + contextPath -->
|
||||||
<!-- + war OR resourceBase -->
|
<!-- + war OR baseResource -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<Set name="contextPath">/</Set>
|
<Set name="contextPath">/</Set>
|
||||||
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/ee9-demo-jetty.war</Set>
|
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/ee9-demo-jetty.war</Set>
|
||||||
|
|
|
@ -10,7 +10,7 @@ Configure and deploy the test web application
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<!-- Required minimal context configuration : -->
|
<!-- Required minimal context configuration : -->
|
||||||
<!-- + contextPath -->
|
<!-- + contextPath -->
|
||||||
<!-- + war OR resourceBase -->
|
<!-- + war OR baseResource -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<Set name="contextPath">/ee8-test</Set>
|
<Set name="contextPath">/ee8-test</Set>
|
||||||
<Set name="war"><Property name="jetty.webapps" default="." />/ee8-demo-jetty.war
|
<Set name="war"><Property name="jetty.webapps" default="." />/ee8-demo-jetty.war
|
||||||
|
|
|
@ -102,17 +102,17 @@
|
||||||
* If set to a boolean True, then a default set of compressed formats
|
* If set to a boolean True, then a default set of compressed formats
|
||||||
* will be used, otherwise no precompressed formats.
|
* will be used, otherwise no precompressed formats.
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -102,17 +102,17 @@
|
||||||
* If set to a boolean True, then a default set of compressed formats
|
* If set to a boolean True, then a default set of compressed formats
|
||||||
* will be used, otherwise no precompressed formats.
|
* will be used, otherwise no precompressed formats.
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -16,7 +16,7 @@ detected.
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<!-- Required minimal context configuration : -->
|
<!-- Required minimal context configuration : -->
|
||||||
<!-- + contextPath -->
|
<!-- + contextPath -->
|
||||||
<!-- + war OR resourceBase -->
|
<!-- + war OR baseResource -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<Set name="contextPath">/</Set>
|
<Set name="contextPath">/</Set>
|
||||||
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/ee9-demo-jetty.war</Set>
|
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/ee9-demo-jetty.war</Set>
|
||||||
|
|
|
@ -10,7 +10,7 @@ Configure and deploy the test web application
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<!-- Required minimal context configuration : -->
|
<!-- Required minimal context configuration : -->
|
||||||
<!-- + contextPath -->
|
<!-- + contextPath -->
|
||||||
<!-- + war OR resourceBase -->
|
<!-- + war OR baseResource -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<Set name="contextPath">/ee9-test</Set>
|
<Set name="contextPath">/ee9-test</Set>
|
||||||
<Set name="war"><Property name="jetty.webapps" default="." />/ee9-demo-jetty.war
|
<Set name="war"><Property name="jetty.webapps" default="." />/ee9-demo-jetty.war
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class AllowedResourceAliasChecker extends AbstractLifeCycle implements Co
|
||||||
|
|
||||||
protected void initialize()
|
protected void initialize()
|
||||||
{
|
{
|
||||||
_base = _contextHandler.getCoreContextHandler().getResourceBase().getPath();
|
_base = _contextHandler.getCoreContextHandler().getBaseResource().getPath();
|
||||||
if (_base == null)
|
if (_base == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1144,7 +1144,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
*/
|
*/
|
||||||
public Resource getBaseResource()
|
public Resource getBaseResource()
|
||||||
{
|
{
|
||||||
return _coreContextHandler.getResourceBase();
|
return _coreContextHandler.getBaseResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1153,7 +1153,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
@ManagedAttribute("document root for context")
|
@ManagedAttribute("document root for context")
|
||||||
public String getResourceBase()
|
public String getResourceBase()
|
||||||
{
|
{
|
||||||
Resource resourceBase = _coreContextHandler.getResourceBase();
|
Resource resourceBase = _coreContextHandler.getBaseResource();
|
||||||
return resourceBase == null ? null : resourceBase.toString();
|
return resourceBase == null ? null : resourceBase.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,12 +1168,25 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
_coreContextHandler.setBaseResource(base);
|
_coreContextHandler.setBaseResource(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the base resource for this context.
|
||||||
|
*
|
||||||
|
* @param base The resource used as the base for all static content of this context.
|
||||||
|
* @see #setResourceBase(String)
|
||||||
|
*/
|
||||||
|
public void setBaseResource(Path base)
|
||||||
|
{
|
||||||
|
_coreContextHandler.setBaseResource(base);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the base resource for this context.
|
* Set the base resource for this context.
|
||||||
*
|
*
|
||||||
* @param resourceBase A string representing the base resource for the context. Any string accepted by {@link ResourceFactory#newResource(String)} may be passed and the
|
* @param resourceBase A string representing the base resource for the context. Any string accepted by {@link ResourceFactory#newResource(String)} may be passed and the
|
||||||
* call is equivalent to <code>setBaseResource(newResource(resourceBase));</code>
|
* call is equivalent to <code>setBaseResource(newResource(resourceBase));</code>
|
||||||
|
* @deprecated use #setBaseResource
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setResourceBase(String resourceBase)
|
public void setResourceBase(String resourceBase)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1398,7 +1411,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
if (pathInContext == null || !pathInContext.startsWith(URIUtil.SLASH))
|
if (pathInContext == null || !pathInContext.startsWith(URIUtil.SLASH))
|
||||||
throw new MalformedURLException(pathInContext);
|
throw new MalformedURLException(pathInContext);
|
||||||
|
|
||||||
Resource baseResource = _coreContextHandler.getResourceBase();
|
Resource baseResource = _coreContextHandler.getBaseResource();
|
||||||
if (baseResource == null)
|
if (baseResource == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ package org.eclipse.jetty.ee9.nested;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -193,6 +194,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,
|
||||||
/**
|
/**
|
||||||
* @return Returns the base resource as a string.
|
* @return Returns the base resource as a string.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getResourceBase()
|
public String getResourceBase()
|
||||||
{
|
{
|
||||||
if (_baseResource == null)
|
if (_baseResource == null)
|
||||||
|
@ -319,6 +321,15 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,
|
||||||
_baseResource = base;
|
_baseResource = base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param basePath The resourceBase to server content from. If null the
|
||||||
|
* context resource base is used.
|
||||||
|
*/
|
||||||
|
public void setBaseResource(Path basePath)
|
||||||
|
{
|
||||||
|
setBaseResource(ResourceFactory.root().newResource(basePath));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cacheControl the cacheControl header to set on all static content.
|
* @param cacheControl the cacheControl header to set on all static content.
|
||||||
*/
|
*/
|
||||||
|
@ -395,7 +406,9 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param resourceBase The base resource as a string.
|
* @param resourceBase The base resource as a string.
|
||||||
|
* @deprecated use {@link #setBaseResource(Resource)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setResourceBase(String resourceBase)
|
public void setResourceBase(String resourceBase)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -94,17 +94,17 @@
|
||||||
* gzip content encoded if a matching resource is
|
* gzip content encoded if a matching resource is
|
||||||
* found ending with ".gz"
|
* found ending with ".gz"
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class PreconfigureQuickStartWar
|
||||||
XmlConfiguration xmlConfiguration = new XmlConfiguration(xml);
|
XmlConfiguration xmlConfiguration = new XmlConfiguration(xml);
|
||||||
xmlConfiguration.configure(webapp);
|
xmlConfiguration.configure(webapp);
|
||||||
}
|
}
|
||||||
webapp.setResourceBase(dir.getPath().toAbsolutePath().toString());
|
webapp.setBaseResource(dir.getPath().toAbsolutePath());
|
||||||
server.setHandler(webapp);
|
server.setHandler(webapp);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ detected.
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<!-- Required minimal context configuration : -->
|
<!-- Required minimal context configuration : -->
|
||||||
<!-- + contextPath -->
|
<!-- + contextPath -->
|
||||||
<!-- + war OR resourceBase -->
|
<!-- + war OR baseResource -->
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||||
<Set name="contextPath">/test</Set>
|
<Set name="contextPath">/test</Set>
|
||||||
|
|
||||||
|
|
|
@ -83,17 +83,17 @@ import org.slf4j.LoggerFactory;
|
||||||
* If set to a boolean True, then a default set of compressed formats
|
* If set to a boolean True, then a default set of compressed formats
|
||||||
* will be used, otherwise no precompressed formats.
|
* will be used, otherwise no precompressed formats.
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
@ -136,7 +136,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
|
||||||
private boolean _welcomeServlets = false;
|
private boolean _welcomeServlets = false;
|
||||||
private boolean _welcomeExactServlets = false;
|
private boolean _welcomeExactServlets = false;
|
||||||
|
|
||||||
private Resource _resourceBase;
|
private Resource _baseResource;
|
||||||
private CachedContentFactory _cache;
|
private CachedContentFactory _cache;
|
||||||
|
|
||||||
private MimeTypes _mimeTypes;
|
private MimeTypes _mimeTypes;
|
||||||
|
@ -144,7 +144,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
|
||||||
private ResourceFactory.Closeable _resourceFactory;
|
private ResourceFactory.Closeable _resourceFactory;
|
||||||
private Resource _stylesheet;
|
private Resource _stylesheet;
|
||||||
private boolean _useFileMappedBuffer = false;
|
private boolean _useFileMappedBuffer = false;
|
||||||
private String _relativeResourceBase;
|
private String _relativeBaseResource;
|
||||||
private ServletHandler _servletHandler;
|
private ServletHandler _servletHandler;
|
||||||
|
|
||||||
public DefaultServlet(ResourceService resourceService)
|
public DefaultServlet(ResourceService resourceService)
|
||||||
|
@ -188,20 +188,20 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
|
||||||
|
|
||||||
_useFileMappedBuffer = getInitBoolean("useFileMappedBuffer", _useFileMappedBuffer);
|
_useFileMappedBuffer = getInitBoolean("useFileMappedBuffer", _useFileMappedBuffer);
|
||||||
|
|
||||||
_relativeResourceBase = getInitParameter("relativeResourceBase");
|
_relativeBaseResource = getInitParameter("relativeBaseResource", "relativeResourceBase");
|
||||||
|
|
||||||
String rb = getInitParameter("resourceBase");
|
String br = getInitParameter("baseResource", "resourceBase");
|
||||||
if (rb != null)
|
if (br != null)
|
||||||
{
|
{
|
||||||
if (_relativeResourceBase != null)
|
if (_relativeBaseResource != null)
|
||||||
throw new UnavailableException("resourceBase & relativeResourceBase");
|
throw new UnavailableException("baseResource & relativeBaseResource");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_resourceBase = _contextHandler.newResource(rb);
|
_baseResource = _contextHandler.newResource(br);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOG.warn("Unable to create resourceBase from {}", rb, e);
|
LOG.warn("Unable to create baseResource from {}", br, e);
|
||||||
throw new UnavailableException(e.toString());
|
throw new UnavailableException(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
|
||||||
{
|
{
|
||||||
if (maxCacheSize != -1 || maxCachedFileSize != -2 || maxCachedFiles != -2)
|
if (maxCacheSize != -1 || maxCachedFileSize != -2 || maxCachedFiles != -2)
|
||||||
LOG.debug("ignoring resource cache configuration, using resourceCache attribute");
|
LOG.debug("ignoring resource cache configuration, using resourceCache attribute");
|
||||||
if (_relativeResourceBase != null || _resourceBase != null)
|
if (_relativeBaseResource != null || _baseResource != null)
|
||||||
throw new UnavailableException("resourceCache specified with resource bases");
|
throw new UnavailableException("resourceCache specified with resource bases");
|
||||||
_cache = (CachedContentFactory)_servletContext.getAttribute(resourceCache);
|
_cache = (CachedContentFactory)_servletContext.getAttribute(resourceCache);
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,26 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
|
||||||
_servletHandler = _contextHandler.getChildHandlerByClass(ServletHandler.class);
|
_servletHandler = _contextHandler.getChildHandlerByClass(ServletHandler.class);
|
||||||
|
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("resource base = {}", _resourceBase);
|
LOG.debug("resource base = {}", _baseResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getInitParameter(String name, String... deprecated)
|
||||||
|
{
|
||||||
|
String value = super.getInitParameter(name);
|
||||||
|
if (value != null)
|
||||||
|
return value;
|
||||||
|
|
||||||
|
for (String d : deprecated)
|
||||||
|
{
|
||||||
|
value = super.getInitParameter(d);
|
||||||
|
if (value != name)
|
||||||
|
{
|
||||||
|
LOG.warn("Deprecated {} used instead of {}", d, name);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompressedContentFormat[] parsePrecompressedFormats(String precompressed, Boolean gzip, CompressedContentFormat[] dft)
|
private CompressedContentFormat[] parsePrecompressedFormats(String precompressed, Boolean gzip, CompressedContentFormat[] dft)
|
||||||
|
@ -431,14 +450,14 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory, Welc
|
||||||
subUriPath = URIUtil.encodePath(subUriPath);
|
subUriPath = URIUtil.encodePath(subUriPath);
|
||||||
|
|
||||||
Resource r = null;
|
Resource r = null;
|
||||||
if (_relativeResourceBase != null)
|
if (_relativeBaseResource != null)
|
||||||
subUriPath = URIUtil.addPaths(_relativeResourceBase, subUriPath);
|
subUriPath = URIUtil.addPaths(_relativeBaseResource, subUriPath);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_resourceBase != null)
|
if (_baseResource != null)
|
||||||
{
|
{
|
||||||
r = _resourceBase.resolve(subUriPath);
|
r = _baseResource.resolve(subUriPath);
|
||||||
if (!_contextHandler.checkAlias(subUriPath, r))
|
if (!_contextHandler.checkAlias(subUriPath, r))
|
||||||
r = null;
|
r = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,11 +203,13 @@ public class ServletTester extends ContainerLifeCycle
|
||||||
_context.setBaseResource(resource);
|
_context.setBaseResource(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public String getResourceBase()
|
public String getResourceBase()
|
||||||
{
|
{
|
||||||
return _context.getResourceBase();
|
return _context.getResourceBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setResourceBase(String resourceBase)
|
public void setResourceBase(String resourceBase)
|
||||||
{
|
{
|
||||||
_context.setResourceBase(resourceBase);
|
_context.setResourceBase(resourceBase);
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class DispatcherTest
|
||||||
_contextHandler.setContextPath("/context");
|
_contextHandler.setContextPath("/context");
|
||||||
_contextCollection.addHandler(_contextHandler);
|
_contextCollection.addHandler(_contextHandler);
|
||||||
_resourceHandler = new ResourceHandler();
|
_resourceHandler = new ResourceHandler();
|
||||||
_resourceHandler.setResourceBase(MavenTestingUtils.getTargetFile("test-classes/dispatchResourceTest").getAbsolutePath());
|
_resourceHandler.setBaseResource(MavenTestingUtils.getTargetFile("test-classes/dispatchResourceTest").toPath());
|
||||||
_resourceHandler.setPathInfoOnly(true);
|
_resourceHandler.setPathInfoOnly(true);
|
||||||
ContextHandler resourceContextHandler = new ContextHandler("/resource");
|
ContextHandler resourceContextHandler = new ContextHandler("/resource");
|
||||||
resourceContextHandler.setHandler(_resourceHandler);
|
resourceContextHandler.setHandler(_resourceHandler);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<Item>
|
<Item>
|
||||||
<New id="defcontext" class="org.eclipse.jetty.server.handler.ContextHandler">
|
<New id="defcontext" class="org.eclipse.jetty.server.handler.ContextHandler">
|
||||||
<Set name="contextPath">/tests</Set>
|
<Set name="contextPath">/tests</Set>
|
||||||
<Set name="ResourceBase"><Property name="test.docroot.base"/>/default
|
<Set name="baseResource"><Property name="test.docroot.base"/>/default
|
||||||
</Set>
|
</Set>
|
||||||
<Set name="Handler">
|
<Set name="Handler">
|
||||||
<New id="reshandler" class="org.eclipse.jetty.server.handler.ResourceHandler"/>
|
<New id="reshandler" class="org.eclipse.jetty.server.handler.ResourceHandler"/>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<Item>VirtualHost</Item>
|
<Item>VirtualHost</Item>
|
||||||
</Array>
|
</Array>
|
||||||
</Set>
|
</Set>
|
||||||
<Set name="ResourceBase"><Property name="test.docroot.base"/>/virtualhost</Set>
|
<Set name="BaseResource"><Property name="test.docroot.base"/>/virtualhost</Set>
|
||||||
<Set name="Handler"><New id="reshandler1" class="org.eclipse.jetty.server.handler.ResourceHandler"/></Set>
|
<Set name="Handler"><New id="reshandler1" class="org.eclipse.jetty.server.handler.ResourceHandler"/></Set>
|
||||||
<Set name="DisplayName">virtual</Set>
|
<Set name="DisplayName">virtual</Set>
|
||||||
</New>
|
</New>
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
<Item>
|
<Item>
|
||||||
<New id="defcontext" class="org.eclipse.jetty.server.handler.ContextHandler">
|
<New id="defcontext" class="org.eclipse.jetty.server.handler.ContextHandler">
|
||||||
<Set name="contextPath">/tests</Set>
|
<Set name="contextPath">/tests</Set>
|
||||||
<Set name="ResourceBase"><Property name="test.docroot.base"/>/default</Set>
|
<Set name="baseResource"><Property name="test.docroot.base"/>/default</Set>
|
||||||
<Set name="Handler"><New id="reshandler2" class="org.eclipse.jetty.server.handler.ResourceHandler"/></Set>
|
<Set name="Handler"><New id="reshandler2" class="org.eclipse.jetty.server.handler.ResourceHandler"/></Set>
|
||||||
<Set name="DisplayName">default</Set>
|
<Set name="DisplayName">default</Set>
|
||||||
</New>
|
</New>
|
||||||
|
|
|
@ -94,17 +94,17 @@
|
||||||
* gzip content encoded if a matching resource is
|
* gzip content encoded if a matching resource is
|
||||||
* found ending with ".gz"
|
* found ending with ".gz"
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -102,17 +102,17 @@
|
||||||
* If set to a boolean True, then a default set of compressed formats
|
* If set to a boolean True, then a default set of compressed formats
|
||||||
* will be used, otherwise no precompressed formats.
|
* will be used, otherwise no precompressed formats.
|
||||||
*
|
*
|
||||||
* resourceBase Set to replace the context resource base
|
* baseResource Set to replace the context resource base
|
||||||
*
|
*
|
||||||
* resourceCache If set, this is a context attribute name, which the servlet
|
* resourceCache If set, this is a context attribute name, which the servlet
|
||||||
* will use to look for a shared ResourceCache instance.
|
* will use to look for a shared ResourceCache instance.
|
||||||
*
|
*
|
||||||
* relativeResourceBase
|
* relativeBaseResource
|
||||||
* Set with a pathname relative to the base of the
|
* Set with a pathname relative to the base of the
|
||||||
* servlet context root. Useful for only serving static content out
|
* servlet context root. Useful for only serving static content out
|
||||||
* of only specific subdirectories.
|
* of only specific subdirectories.
|
||||||
*
|
*
|
||||||
* pathInfoOnly If true, only the path info will be applied to the resourceBase
|
* pathInfoOnly If true, only the path info will be applied to the baseResource
|
||||||
*
|
*
|
||||||
* stylesheet Set with the location of an optional stylesheet that will be used
|
* stylesheet Set with the location of an optional stylesheet that will be used
|
||||||
* to decorate the directory listing html.
|
* to decorate the directory listing html.
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class WSServer extends LocalServer implements LocalFuzzer.Provider
|
||||||
context = new WebAppContext();
|
context = new WebAppContext();
|
||||||
context.setContextPath("/" + contextName);
|
context.setContextPath("/" + contextName);
|
||||||
context.setInitParameter("org.eclipse.jetty.ee9.servlet.Default.dirAllowed", "false");
|
context.setInitParameter("org.eclipse.jetty.ee9.servlet.Default.dirAllowed", "false");
|
||||||
context.setResourceBase(contextDir.toAbsolutePath().toString());
|
context.setBaseResource(contextDir.toAbsolutePath());
|
||||||
context.setAttribute("org.eclipse.jetty.websocket.jakarta", Boolean.TRUE);
|
context.setAttribute("org.eclipse.jetty.websocket.jakarta", Boolean.TRUE);
|
||||||
context.addConfiguration(new JakartaWebSocketConfiguration());
|
context.addConfiguration(new JakartaWebSocketConfiguration());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue