当前位置: 首页>>代码示例>>Java>>正文


Java WARArchive.addAsWebInfResource方法代码示例

本文整理汇总了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);

}
 
开发者ID:xstefank,项目名称:lra-service,代码行数:22,代码来源:Main.java

示例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;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:23,代码来源:TopologyWebAppDeploymentProducer.java

示例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);
}
 
开发者ID:weweave,项目名称:tubewarder,代码行数:18,代码来源:TubewarderSwarm.java

示例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);

}
 
开发者ID:redhat-helloworld-msa,项目名称:hola,代码行数:33,代码来源:Main.java

示例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;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:9,代码来源:SampleTest.java

示例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);
}
 
开发者ID:aracrown,项目名称:ara-blog-examples,代码行数:33,代码来源:Main.java

示例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>" );
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:23,代码来源:SecuredTest.java


注:本文中的org.wildfly.swarm.undertow.WARArchive.addAsWebInfResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。