本文整理了Java中org.eclipse.jetty.webapp.WebAppContext.getBaseResource()
方法的一些代码示例,展示了WebAppContext.getBaseResource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.getBaseResource()
方法的具体详情如下:
包路径:org.eclipse.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:getBaseResource
暂无
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
@Override
public void deconfigure(WebAppContext context) throws Exception
{
//if we're not persisting the temp dir contents delete it
if (!context.isPersistTempDirectory())
{
IO.delete(context.getTempDirectory());
}
//if it wasn't explicitly configured by the user, then unset it
Boolean tmpdirConfigured = (Boolean)context.getAttribute(TEMPDIR_CONFIGURED);
if (tmpdirConfigured != null && !tmpdirConfigured)
context.setTempDirectory(null);
//reset the base resource back to what it was before we did any unpacking of resources
if (context.getBaseResource() != null)
context.getBaseResource().close();
context.setBaseResource(_preUnpackBaseResource);
}
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
Resource resource = context.getBaseResource();
if (resource == null)
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
public void unpack (WebAppContext context) throws IOException
Resource web_app = context.getBaseResource();
_preUnpackBaseResource = context.getBaseResource();
web_app = context.newResource(war);
else
web_app=context.getBaseResource();
代码示例来源:origin: org.eclipse.jetty/jetty-webapp
collection[i++]=context.getBaseResource();
for (Resource resource : resources)
collection[i++]=resource;
代码示例来源:origin: cd.connect.common/connect-runnable-war
@SuppressWarnings("unchecked")
@Override
public void configure(WebAppContext context) throws Exception {
List<Resource> resources = (List<Resource>) context.getAttribute(RESOURCE_URLS);
if (resources != null) {
if (resources.size() > 1) {
List<Resource> temp = new ArrayList<>();
temp.add(context.getBaseResource());
temp.addAll(resources);
context.setBaseResource(new ResourceCollection(temp.toArray(new Resource[temp.size()])));
} else if (resources.size() == 1) {
context.setBaseResource(resources.get(0));
}
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public File findWorkDirectory (WebAppContext context) throws IOException
{
if (context.getBaseResource() != null)
{
Resource web_inf = context.getWebInf();
if (web_inf !=null && web_inf.exists())
{
return new File(web_inf.getFile(),"work");
}
}
return null;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
public File findWorkDirectory (WebAppContext context) throws IOException
{
if (context.getBaseResource() != null)
{
Resource web_inf = context.getWebInf();
if (web_inf !=null && web_inf.exists())
{
return new File(web_inf.getFile(),"work");
}
}
return null;
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
public File findWorkDirectory (WebAppContext context) throws IOException
{
if (context.getBaseResource() != null)
{
Resource web_inf = context.getWebInf();
if (web_inf !=null && web_inf.exists())
{
return new File(web_inf.getFile(),"work");
}
}
return null;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
public File findWorkDirectory (WebAppContext context) throws IOException
{
if (context.getBaseResource() != null)
{
Resource web_inf = context.getWebInf();
if (web_inf !=null && web_inf.exists())
{
return new File(web_inf.getFile(),"work");
}
}
return null;
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
public File findWorkDirectory (WebAppContext context) throws IOException
{
if (context.getBaseResource() != null)
{
Resource web_inf = context.getWebInf();
if (web_inf !=null && web_inf.exists())
{
return new File(web_inf.getFile(),"work");
}
}
return null;
}
代码示例来源:origin: com.github.persapiens/jsf-jetty-spring-boot-autoconfigure
@Test
public void customize() throws MalformedURLException {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
this.jettySpringBootAutoConfiguration.customize(factory);
Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer();
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("test.txt").exists())
.isTrue();
}
代码示例来源:origin: org.joinfaces/jsf-spring-boot-autoconfigure
@Test
public void customize() throws MalformedURLException {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
this.jettySpringBootAutoConfiguration.customize(factory);
Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer();
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("testJetty.txt").exists())
.isTrue();
}
代码示例来源:origin: com.github.persapiens/jsf-jetty-spring-boot-autoconfigure
public void customize() throws MalformedURLException {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(this.jettyProperties);
Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer();
customizer.customize(server);
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("test.txt").exists())
.isTrue();
}
代码示例来源:origin: org.joinfaces/jsf-jetty-spring-boot-autoconfigure
@Test
public void customize() throws MalformedURLException {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
this.jettySpringBootAutoConfiguration.customize(factory);
Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer();
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("testJetty.txt").exists())
.isTrue();
}
代码示例来源:origin: com.github.persapiens/jsf-jetty-spring-boot-autoconfigure
@Test(expectedExceptions = RuntimeException.class)
public void invalidClassPathResource() throws MalformedURLException {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
JettyProperties jp = new JettyProperties();
jp.setClassPathResource("/~ã``'[ªº*-+.@#$%{&*ç|°;.<>");
JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(jp);
Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer();
customizer.customize(server);
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("test.txt").exists()).isTrue();
}
}
代码示例来源:origin: org.joinfaces/jsf-spring-boot-autoconfigure
@Test
public void customize() throws MalformedURLException {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(this.jettyProperties);
Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer();
customizer.customize(server);
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("testJetty.txt").exists())
.isTrue();
}
代码示例来源:origin: org.joinfaces/jsf-jetty-spring-boot-autoconfigure
@Test
public void customize() throws MalformedURLException {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(this.jettyProperties);
Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer();
customizer.customize(server);
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("testJetty.txt").exists())
.isTrue();
}
代码示例来源:origin: joinfaces/joinfaces
@Test
public void customize() {
JettyServletWebServerFactory factory = new JettyServletWebServerFactory();
this.jettyAutoConfiguration.jsfJettyFactoryCustomizer().customize(factory);
Server server = ((JettyWebServer) factory.getWebServer()).getServer();
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("testJetty.txt").exists())
.isTrue();
}
}
代码示例来源:origin: org.joinfaces/jsf-jetty-spring-boot-autoconfigure
@Test(expected = RuntimeException.class)
public void invalidClassPathResource() throws MalformedURLException {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
JettyProperties jp = new JettyProperties();
jp.setClassPathResource("/~ã``'[ªº*-+.@#$%{&*ç|°;.<>");
JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(jp);
Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer();
customizer.customize(server);
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("test.txt").exists()).isTrue();
}
}
代码示例来源:origin: org.joinfaces/jsf-spring-boot-autoconfigure
@Test(expected = RuntimeException.class)
public void invalidClassPathResource() throws MalformedURLException {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
JettyProperties jp = new JettyProperties();
jp.setClassPathResource("/~ã``'[ªº*-+.@#$%{&*ç|°;.<>");
JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(jp);
Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer();
customizer.customize(server);
Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class);
WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0];
assertThat(webAppContext.getBaseResource().getResource("test.txt").exists()).isTrue();
}
}
内容来源于网络,如有侵权,请联系作者删除!