- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.jboss.shrinkwrap.api.importer.ZipImporter
类的一些代码示例,展示了ZipImporter
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipImporter
类的具体详情如下:
包路径:org.jboss.shrinkwrap.api.importer.ZipImporter
类名称:ZipImporter
[英]Assignable type capable of importing ZIP content.
[中]能够导入ZIP内容的可分配类型。
代码示例来源:origin: javaee/security-soteria
public static WebArchive mavenWar() {
return
create(ZipImporter.class, getProperty("finalName") + ".war")
.importFrom(new File("target/" + getProperty("finalName") + ".war"))
.as(WebArchive.class);
}
代码示例来源:origin: io.thorntail/container
protected static Stream<Archive> archives(Collection<Path> paths) {
return paths.stream()
.map(path -> {
String simpleName = path.getFileName().toString();
Archive archive = ShrinkWrap.create(JavaArchive.class, simpleName);
archive.as(ZipImporter.class).importFrom(path.toFile());
return archive;
});
}
代码示例来源:origin: shrinkwrap/shrinkwrap
/**
* SHRINKWRAP-259
*/
@Test
public void createZipImporter() {
final GenericArchive importer = ShrinkWrap.create(ZipImporter.class).as(GenericArchive.class);
Assert.assertTrue("Archive did not have expected suffix", importer.getName().endsWith(".jar"));
}
}
代码示例来源:origin: org.jboss.arquillian.testenricher/arquillian-testenricher-jmx
@Override
public Archive<?> getClientDeployment(String name)
{
InputStream input = getClientDeploymentAsStream(name);
ClassLoader ctxLoader = SecurityActions.getThreadContextClassLoader();
try
{
// Create the archive in the context of the arquillian-osgi-bundle
SecurityActions.setThreadContextClassLoader(ArchiveBase.class.getClassLoader());
JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
ZipImporter zipImporter = archive.as(ZipImporter.class);
zipImporter.importZip(new ZipInputStream(input));
return archive;
}
finally
{
SecurityActions.setThreadContextClassLoader(ctxLoader);
}
}
代码示例来源:origin: org.wildfly.swarm/spi
protected boolean setupUsingAppArtifact(Archive<?> archive) throws IOException {
final String appArtifact = System.getProperty(APP_ARTIFACT);
if (appArtifact != null) {
try (InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("_bootstrap/" + appArtifact)) {
archive.as(ZipImporter.class)
.importFrom(in);
}
return true;
}
return false;
}
代码示例来源:origin: org.jboss.arquillian.daemon/arquillian-daemon-server
@Override
public void inboundBufferUpdated(final ChannelHandlerContext ctx, final ByteBuf in) throws Exception {
if (log.isLoggable(Level.FINEST)) {
log.finest("Using the " + this.getClass().getSimpleName());
}
try {
// Read in the archive using the isolated CL context of this domain
final InputStream instream = new ByteBufInputStream(in);
final GenericArchive archive = NettyServer.this.getShrinkwrapDomain().getArchiveFactory()
.create(ZipImporter.class).importFrom(instream).as(GenericArchive.class);
instream.close();
if (log.isLoggable(Level.FINEST)) {
log.finest("Got archive: " + archive.toString(true));
}
// Store the archive
final String id = archive.getId();
NettyServer.this.getDeployedArchives().put(id, archive);
// Tell the client OK, and let it know the ID of the archive (so it may be undeployed)
final ByteBuf out = ctx.nextOutboundByteBuffer();
NettyServer.sendResponse(ctx, out, WireProtocol.RESPONSE_OK_PREFIX + WireProtocol.COMMAND_DEPLOY_PREFIX
+ id);
} finally {
NettyServer.this.resetPipeline(ctx.pipeline());
}
}
}
代码示例来源:origin: thorntail/thorntail
protected static Stream<Archive> archives(Collection<Path> paths) {
return paths.stream()
.map(path -> {
String simpleName = path.getFileName().toString();
Archive archive = ShrinkWrap.create(JavaArchive.class, simpleName);
archive.as(ZipImporter.class).importFrom(path.toFile());
return archive;
});
}
代码示例来源:origin: thorntail/thorntail
protected boolean setupUsingAppArtifact(Archive<?> archive) throws IOException {
final String appArtifact = System.getProperty(APP_ARTIFACT);
if (appArtifact != null) {
try (InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("_bootstrap/" + appArtifact)) {
archive.as(ZipImporter.class)
.importFrom(in);
}
return true;
}
return false;
}
代码示例来源:origin: org.glassfish.soteria.test/common
public static WebArchive mavenWar() {
return
create(ZipImporter.class, getProperty("finalName") + ".war")
.importFrom(new File("target/" + getProperty("finalName") + ".war"))
.as(WebArchive.class);
}
代码示例来源:origin: org.wildfly.swarm/container
protected static Stream<Archive> archives(Collection<Path> paths) {
return paths.stream()
.map(path -> {
String simpleName = path.getFileName().toString();
Archive archive = ShrinkWrap.create(JavaArchive.class, simpleName);
archive.as(ZipImporter.class).importFrom(path.toFile());
return archive;
});
}
代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm
protected boolean setupUsingAppArtifact(Archive<?> archive) throws IOException {
final String appArtifact = System.getProperty(BootstrapProperties.APP_ARTIFACT);
if (appArtifact != null) {
try (InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("_bootstrap/" + appArtifact)) {
archive.as(ZipImporter.class)
.importFrom(in);
}
return true;
}
return false;
}
代码示例来源:origin: org.wildfly.swarm/container-api
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw new RuntimeException("Artifact '" + gav + "' not found.");
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: org.jboss.jbossas.as7-cdi-tck/jbossas-container
public boolean deploy(InputStream archive, String name) throws IOException {
exception = null;
if (name.endsWith("ear")) {
swArchive = ShrinkWrap.create(EnterpriseArchive.class, name);
} else if (name.endsWith("war")) {
swArchive = ShrinkWrap.create(WebArchive.class, name);
} else if (name.endsWith("jar")) {
swArchive = ShrinkWrap.create(JavaArchive.class, name);
} else {
throw new RuntimeException("Unkown archive extension: " + name);
}
swArchive.as(ZipImporter.class).importFrom(archive);
try {
deployableContainer.deploy(this.swArchive);
return true;
} catch (org.jboss.arquillian.container.spi.client.container.DeploymentException e) {
exception = e;
return false;
}
}
代码示例来源:origin: thorntail/thorntail
protected boolean setupUsingAppPath(Archive<?> archive) throws IOException {
final String appPath = System.getProperty(APP_PATH);
if (appPath != null) {
final Path path = Paths.get(appPath);
if (Files.isDirectory(path)) {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Path simple = path.relativize(file);
archive.add(new FileAsset(file.toFile()), convertSeparators(simple));
return super.visitFile(file, attrs);
}
});
} else {
archive.as(ZipImporter.class)
.importFrom(path.toFile());
}
return true;
}
return false;
}
代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw new RuntimeException("Artifact not found.");
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: org.wildfly.swarm/keycloak
private InputStream getKeycloakJson(URI keycloakJsonUri) {
final String resourceName = keycloakJsonUri != null && "classpath".equals(keycloakJsonUri.getScheme())
? keycloakJsonUri.getSchemeSpecificPart() : "keycloak.json";
InputStream keycloakJson = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);
if (keycloakJson == null) {
String appArtifact = System.getProperty(BootstrapProperties.APP_ARTIFACT);
if (appArtifact != null) {
try (InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("_bootstrap/" + appArtifact)) {
Archive<?> tmpArchive = ShrinkWrap.create(JARArchive.class);
tmpArchive.as(ZipImporter.class).importFrom(in);
Node jsonNode = tmpArchive.get(resourceName);
if (jsonNode == null) {
jsonNode = getKeycloakJsonNodeFromWebInf(tmpArchive, resourceName, true);
}
if (jsonNode == null) {
jsonNode = getKeycloakJsonNodeFromWebInf(tmpArchive, resourceName, false);
}
if (jsonNode != null && jsonNode.getAsset() != null) {
keycloakJson = jsonNode.getAsset().openStream();
}
} catch (IOException e) {
// ignore
}
}
}
return keycloakJson;
}
代码示例来源:origin: org.wildfly.swarm/spi
protected boolean setupUsingAppPath(Archive<?> archive) throws IOException {
final String appPath = System.getProperty(APP_PATH);
if (appPath != null) {
final Path path = Paths.get(appPath);
if (Files.isDirectory(path)) {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Path simple = path.relativize(file);
archive.add(new FileAsset(file.toFile()), convertSeparators(simple));
return super.visitFile(file, attrs);
}
});
} else {
archive.as(ZipImporter.class)
.importFrom(path.toFile());
}
return true;
}
return false;
}
代码示例来源:origin: org.jboss.shrinkwrap.osgi/shrinkwrap-osgi
@Override
public <TYPE extends Assignable> TYPE as(Class<TYPE> typeClass) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
jar.write(baos);
return ShrinkWrap.create(ZipImporter.class).
importFrom(new ByteArrayInputStream(baos.toByteArray())).
as(typeClass);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: io.thorntail/keycloak
private static InputStream getKeycloakJsonFromClasspath(String resourceName) {
InputStream keycloakJson = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);
if (keycloakJson == null) {
String appArtifact = System.getProperty(BootstrapProperties.APP_ARTIFACT);
if (appArtifact != null) {
try (InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("_bootstrap/" + appArtifact)) {
Archive<?> tmpArchive = ShrinkWrap.create(JARArchive.class);
tmpArchive.as(ZipImporter.class).importFrom(in);
Node jsonNode = tmpArchive.get(resourceName);
if (jsonNode == null) {
jsonNode = getKeycloakJsonNodeFromWebInf(tmpArchive, resourceName, true);
}
if (jsonNode == null) {
jsonNode = getKeycloakJsonNodeFromWebInf(tmpArchive, resourceName, false);
}
if (jsonNode != null && jsonNode.getAsset() != null) {
keycloakJson = jsonNode.getAsset().openStream();
}
} catch (IOException e) {
// ignore
}
}
}
return keycloakJson;
}
代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm
protected boolean setupUsingAppPath(Archive<?> archive) throws IOException {
final String appPath = System.getProperty(BootstrapProperties.APP_PATH);
if (appPath != null) {
final Path path = Paths.get(appPath);
if (Files.isDirectory(path)) {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Path simple = path.relativize(file);
archive.add(new FileAsset(file.toFile()), convertSeparators(simple));
return super.visitFile(file, attrs);
}
});
} else {
archive.as(ZipImporter.class)
.importFrom(path.toFile());
}
return true;
}
return false;
}
I was trying to install Django. Turns out that course's teacher said that we will be working with
我正在尝试打包 pychess打包成一个 zip 文件并使用 zipimport 导入它,但遇到了一些问题。 我已经使用以下脚本将它打包成一个 zip 文件,该脚本有效: #!/usr/bin/env
我正在尝试从 ZIP 包加载子模块,但它不起作用。怎样做才是对的? foo.zip foo/ __init__.py bar.py 测试.py import os import zipi
我将 python 嵌入到我正在创建的应用程序中,我正在寻找一种方便的方法来分发 python 代码。我最近阅读了有关 zipimport 的内容,并认为这是一种分发我所有 python 代码而不是包
当我的 sys.path 中有一个 python 共享对象文件 (.so) 时,我可以简单地执行以下操作: import _ctypes 它将导入python2.7/lib-dynload/_ctyp
我使用 python 的 paster 编写了一个简单的 Python 包,我的包具有以下目录结构: pkg/ __init__.py module1.py subpackag
我看到了one question与此相关,但它并没有真正回答我的问题。 我编写了一个程序,旨在无需安装 python 即可使用;我使用 cx_freeze 来实现这一点。我写了一个setup.py,在
目前,我正在使用我的应用程序部署完整的 python 发行版(原始 python 2.7 msi)。这是一个用delphi做的嵌入式web服务器。 Reading this , 我想知道是否可以在我的
我在终端 sudo python2.6 setup.py install 中运行以下命令,在一些输出后我得到以下错误。 Traceback (most recent call last): Fil
本文整理了Java中org.jboss.shrinkwrap.api.importer.ZipImporter.as()方法的一些代码示例,展示了ZipImporter.as()的具体用法。这些代码示
我正在编写一个简单的 Pyramid 应用程序,并尝试运行它pservedevelopment.ini。 我得到了这个: Traceback (most recent call last): Fi
我想使用 cx_freeze 将我的 hello_world.py 更改为 exe 文件。 当我像这样运行 cxfreeze 时: cxfreeze hello_world.py 然后我运行exe文件
本文整理了Java中org.jboss.shrinkwrap.api.importer.ZipImporter.importFrom()方法的一些代码示例,展示了ZipImporter.importF
我最近上传了一个使用 django appengine 补丁的应用程序,目前有一个每两分钟运行一次的 cron 作业。每次调用工作 URL 时都会消耗相当多的资源 /worker_url 200 7
我写了一个python程序,我正在尝试用py2exe“编译”,一切顺利并且创建了可执行文件。我第一次运行该程序时出现此错误: 回溯(最近一次调用最后一次): 文件“IMGui.py”,第 13 行,位
Python 3.3 的 zipfile 模块可以理解使用 bzip2 或 xz 而不是传统的 deflate 算法压缩的 .zip 文件。这种扩展压缩支持是否扩展到 zipimport 功能? 最佳
我正在尝试确定 python 使用的 zip 缓存机制是否仍然存在错误。原因是因为我正在运行的 python 代码将(看似)随机失败并显示 zipimport.ZipImportError: bad
我正在尝试在 python 脚本中使用 pytz,用作 hadoop 流作业的映射器。 按照另一个线程中的建议,我尝试将 pytz 打包为 zip“pytz.mod”,并使用 zipimport 加载
我正在尝试在我的 ubuntu 机器上安装 fastapi (20.04) 这台 PC 安装了 Python 2、Python3(指向 Python3.8)和 Python3.9。 如果我尝试安装 p
我试图安装 Django。结果那门课的老师说我们将使用 Python 3.6 我安装 Python 3.6。现在它是我的默认设置,它在某种程度上取代了我拥有的最后一个版本;这是 Python 3.5。
我是一名优秀的程序员,十分优秀!