本文整理汇总了Java中org.wildfly.swarm.undertow.WARArchive.addAsWebInfResource方法的典型用法代码示例。如果您正苦于以下问题:Java WARArchive.addAsWebInfResource方法的具体用法?Java WARArchive.addAsWebInfResource怎么用?Java WARArchive.addAsWebInfResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wildfly.swarm.undertow.WARArchive
的用法示例。
在下文中一共展示了WARArchive.addAsWebInfResource方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
// Instantiate the container
Swarm swarm = new Swarm(args);
// Create one or more deployments
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
// Add resource to deployment
deployment.addPackage(Main.class.getPackage());
deployment.addAllDependencies();
// Add Web resources
deployment.addAsWebResource(
new ClassLoaderAsset("src/main/webapp/index.html", Main.class.getClassLoader()), "src/main/webapp/index.html");
deployment.addAsWebInfResource(
new ClassLoaderAsset("src/main/webapp/WEB-INF/beans.xml", Main.class.getClassLoader()), "beans.xml");
swarm.start().deploy(deployment);
}
示例2: getImplicitDeployments
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
@Override
public List<Archive> getImplicitDeployments(TopologyWebAppFraction fraction) throws Exception {
String context = System.getProperty(TopologyProperties.CONTEXT_PATH);
if (context == null) context = DEFAULT_CONTEXT;
List<Archive> list = new ArrayList<>();
if (fraction.exposeTopologyEndpoint()) {
WARArchive war = ShrinkWrap.create(WARArchive.class, "topology-webapp.war");
war.addAsWebInfResource(new StringAsset(getWebXml(fraction)), "web.xml");
war.addClass(TopologySSEServlet.class);
war.addModule("swarm.application");
war.addModule("org.wildfly.swarm.topology");
war.addAsWebResource(new ClassLoaderAsset("topology.js", this.getClass().getClassLoader()), "topology.js");
war.setContextRoot(context);
war.as(TopologyArchive.class);
list.add(war);
}
return list;
}
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-topology,代码行数:20,代码来源:TopologyWebAppConfiguration.java
示例3: deployment
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
@Produces
@Dependent()
Archive deployment() {
String context = TopologyWebAppFraction.DEFAULT_CONTEXT;
if (this.contextPath != null) {
context = this.contextPath;
}
if (fraction.exposeTopologyEndpoint()) {
WARArchive war = ShrinkWrap.create(WARArchive.class, "topology-webapp.war");
war.addAsWebInfResource(new StringAsset(getWebXml(fraction)), "web.xml");
war.addClass(TopologySSEServlet.class);
war.addModule("swarm.application");
war.addModule("org.wildfly.swarm.topology");
war.addAsWebResource(new ClassLoaderAsset("topology.js", this.getClass().getClassLoader()), "topology.js");
war.setContextRoot(context);
war.as(TopologyArchive.class);
return war;
}
return null;
}
示例4: deployApp
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
private void deployApp() throws Exception {
WARArchive appDeployment = ShrinkWrap.create(WARArchive.class, "tubewarder.war");
appDeployment.addPackages(true, "net.weweave.tubewarder");
appDeployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/persistence-"+getConfig().getDb()+".xml", TubewarderSwarm.class.getClassLoader()), "classes/META-INF/persistence.xml");
if ("postgresql".equals(getConfig().getDb())) {
appDeployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/" + getConfig().getDb() + "-mapping.xml", TubewarderSwarm.class.getClassLoader()), "classes/META-INF/postgresql-mapping.xml");
}
File[] libs = getAdditionalJars();
for (File lib : libs) {
appDeployment.addAsLibrary(lib, lib.getName());
}
appDeployment.addAllDependencies();
appDeployment.staticContent();
deploy(appDeployment);
}
示例5: getImplicitDeployments
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
@Override
public List<Archive> getImplicitDeployments(TopologyWebAppFraction fraction) throws Exception {
String context = System.getProperty(TopologyProperties.CONTEXT_PATH);
if (context == null) context = DEFAULT_CONTEXT;
List<Archive> list = new ArrayList<>();
WARArchive war = ShrinkWrap.create(WARArchive.class, "topology-webapp.war");
war.addAsWebInfResource(new StringAsset(getWebXml(fraction)), "web.xml");
war.addClass(TopologySSEServlet.class);
war.addModule("swarm.application");
war.addModule("org.wildfly.swarm.topology");
war.addAsWebResource(new ClassLoaderAsset("topology.js", this.getClass().getClassLoader()), "topology.js");
war.setContextRoot(context);
war.as(TopologyArchive.class);
list.add(war);
return list;
}
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:18,代码来源:TopologyWebAppConfiguration.java
示例6: main
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// Instantiate the container
Swarm swarm = new Swarm(args);
// Create one or more deployments
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
// Add resource to deployment
deployment.addPackage(Main.class.getPackage());
deployment.addAllDependencies();
// Add Web resources
deployment.addAsWebResource(
new ClassLoaderAsset("index.html", Main.class.getClassLoader()), "index.html");
deployment.addAsWebInfResource(
new ClassLoaderAsset("WEB-INF/web.xml", Main.class.getClassLoader()), "web.xml");
deployment.addAsWebInfResource(
new ClassLoaderAsset("WEB-INF/beans.xml", Main.class.getClassLoader()), "beans.xml");
// If There's a KEYCLOAK_SERVER_URL env var, then read the file
if (System.getenv("KEYCLOAK_AUTH_SERVER_URL") != null) {
deployment.addAsWebInfResource(
new ClassLoaderAsset("keycloak.json", Main.class.getClassLoader()), "keycloak.json");
}
swarm.start().deploy(deployment);
}
示例7: createDeployment
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
@Deployment
public static Archive createDeployment() throws Exception {
WARArchive archive = ShrinkWrap.create(WARArchive.class, "SampleTest.war");
archive.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
archive.addPackage("example");
archive.addAllDependencies();
return archive;
}
示例8: main
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Container container = new Container();
container.fraction(new DatasourcesFraction().jdbcDriver("h2", (d) -> {
d.driverDatasourceClassName("org.h2.Driver");
d.xaDatasourceClass("org.h2.jdbcx.JdbcDataSource");
d.driverModuleName("com.h2database.h2");
}).dataSource("ExampleDS", (ds) -> {
ds.driverName("h2");
ds.connectionUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");
ds.userName("sa");
ds.password("sa");
}));
container.fraction(new JPAFraction().inhibitDefaultDatasource().defaultDatasource("jboss/datasources/ExampleDS"));
container.start();
WARArchive deployment = ShrinkWrap.create(WARArchive.class);
deployment.addClasses(BlogEntryDao.class, BlogEntryQueryImpl.class, BlogEntry.class);
deployment.addPackage(BlogEntryBean.class.getPackage());
deployment.addAllDependencies();
deployment.addAsWebResource(new ClassLoaderAsset("index.xhtml", Main.class.getClassLoader()), "index.xhtml");
deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/persistence.xml", Main.class.getClassLoader()),
"classes/META-INF/persistence.xml");
deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/load.sql", Main.class.getClassLoader()), "classes/META-INF/load.sql");
deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/beans.xml", Main.class.getClassLoader()), "classes/META-INF/beans.xml");
container.deploy(deployment);
}
示例9: testExistingWebXml
import org.wildfly.swarm.undertow.WARArchive; //导入方法依赖的package包/类
@Test
public void testExistingWebXml() {
WARArchive archive = ShrinkWrap.create( WARArchive.class );
ClassLoaderAsset asset = new ClassLoaderAsset("test-web.xml");
archive.addAsWebInfResource( asset, "web.xml" );
archive.as(Secured.class)
.protect( "/cheddar" );
Node webXml = archive.get("WEB-INF/web.xml");
Asset newAsset = webXml.getAsset();
InputStream in = newAsset.openStream();
BufferedReader reader = new BufferedReader( new InputStreamReader( in ) );
List<String> lines = reader.lines().map(String::trim).collect(Collectors.toList());
assertThat( lines ).contains( "<servlet-name>comingsoon</servlet-name>" );
assertThat( lines ).contains( "<url-pattern>/cheddar</url-pattern>" );
}