在JSF中,可以使用EL空运算符渲染或不渲染组件
rendered="#{not empty myBean.myList}"
Run Code Online (Sandbox Code Playgroud)
正如我所理解的那样,运算符既可以作为空值检查,也可以检查列表是否为空.
我想对我自己的自定义类的某些对象进行空检查,我需要实现哪些接口或部分接口?哪个接口是空的运算符兼容?
如何获取2014-01-01和2014-06-30之间对主分支所做的所有git提交的列表?
我知道git log会给我大致这种格式(对所有提交重复):
commit <hash>
author: <author name>
date: <date>
<comment>
Run Code Online (Sandbox Code Playgroud)
但是如何将其限制为选定日期和每个提交格式一行?
<hash> <author> <date>
<hash> <author> <date>
Run Code Online (Sandbox Code Playgroud) 我有一个用@Schedule注释的方法,偶尔会被容器调用.
@Schedule(second = "*/5", minute = "*", hour = "*", persistent = false)
public void myTimerMethod() throws Exception {
    ...
}
Run Code Online (Sandbox Code Playgroud)
问题是在某些条件下,我希望此方法抛出异常以使正在进行的事务回滚.但如果我这样做超过两次,计时器将被清除,不再被调用!
INFO: EJB5119:Expunging timer ['68@@1359143163781@@server@@domain1' 'TimedObject = MyBean' 'Application = My-War' 'BEING_DELIVERED' 'PERIODIC' 'Container ID = 89072805830524936' 'Fri Jan 25 21:49:30 CET 2013' '0' '*/5 # * # * # * # * # * # * # null # null # null # true # myTimerMethod # 0' ] after [2] failed deliveries
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用在domain.xml中配置计时器重新安排
<domains>
    ...
    <configs>
        <config> …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种方法来获取给定目录中的所有目录名称,但不是文件.
例如,假设我有一个名为的文件夹Parent,在里面我有3个文件夹:Child1 Child2和Child3.
我想获取文件夹的名称,但不关心Child1,Child2等内的子文件夹的内容或名称.
有一个简单的方法吗?
我正在尝试计算光盘上文件的大小.在java-7中,这可以使用Files.walkFileTree来完成,如我在这里的回答所示.
但是,如果我想使用java-8流来执行此操作,它将适用于某些文件夹,但不适用于所有文件夹.
public static void main(String[] args) throws IOException {
    long size = Files.walk(Paths.get("c:/")).mapToLong(MyMain::count).sum();
    System.out.println("size=" + size);
}
static long count(Path path) {
    try {
        return Files.size(path);
    } catch (IOException | UncheckedIOException e) {
        return 0;
    }
}
Run Code Online (Sandbox Code Playgroud)
上面的代码适用于路径,a:/files/但c:/它会抛出异常
Exception in thread "main" java.io.UncheckedIOException: java.nio.file.AccessDeniedException: c:\$Recycle.Bin\S-1-5-20
at java.nio.file.FileTreeIterator.fetchNextIfNeeded(Unknown Source)
at java.nio.file.FileTreeIterator.hasNext(Unknown Source)
at java.util.Iterator.forEachRemaining(Unknown Source)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.LongPipeline.reduce(Unknown …Run Code Online (Sandbox Code Playgroud) 为什么(或不应该)我包含gradle依赖@aar,
有什么好处/缺点?
正如您所看到的,我将@aar添加到支持它的下面的库中.但是在做这件事之前,一切似乎都有效......
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.google.android.gms:play-services-maps:7.3.+'
    compile 'com.google.guava:guava:18.0'
    compile 'com.octo.android.robospice:robospice-spring-android:1.4.14'
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0@aar'
    compile 'de.psdev.licensesdialog:licensesdialog:1.7.0@aar'
}
Run Code Online (Sandbox Code Playgroud) 在 jlink:ed 应用程序中使用记录(预览功能 java-14),在使用选项时会出现以下错误:
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
java.lang.ClassFormatError: Invalid constant pool index 11 for name in Record attribute in class file 
myproj/MyClass$MyRecord
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
    at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
Run Code Online (Sandbox Code Playgroud) 我正在使用android上的jackson-dataformat-xml
我有一些非常基本的代码,可以在oracle jre上正常工作
JacksonXmlModule module = new JacksonXmlModule();
module.setDefaultUseWrapper(false);
XmlMapper xmlMapper = new XmlMapper(module);
Run Code Online (Sandbox Code Playgroud)
首先,我尝试了适合gradle的官方文档(由我,不确定是否正确完成):
compile 'com.fasterxml.jackson.core:jackson-core:2.5.4'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.4'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.4'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.5.4'
compile 'org.codehaus.woodstox:woodstox-core-asl:4.4.1'
compile 'javax.xml.stream:stax-api:1.0-2'
Run Code Online (Sandbox Code Playgroud)
结果:gradle将关于将corelibraries捆绑到应用程序中的构建时间失败
...
:app:preDexDebug
trouble processing "javax/xml/stream/EventFilter.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
...
Run Code Online (Sandbox Code Playgroud)
试图按照肖恩的回答进行第二次尝试 (基本上他用前缀名称重新包装corelibs并重建jackson-dataformat-xml以使用前缀名称)
compile 'com.fasterxml.jackson.core:jackson-core:2.1.2'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.1.2'
compile 'com.fasterxml.jackson.core:jackson-databind:2.1.2'
// Repackaged XML-specific libraries
compile 'edu.usf.cutr.android.xml:jackson-dataformat-xml-android:2.1.2'
compile 'edu.usf.cutr.android.xml:stax2-api-android:3.1.1'
compile 'edu.usf.cutr.android.xml:stax-api-android:1.0-2'
compile 'edu.usf.cutr.android.xml:aalto-xml-android:0.9.8'
Run Code Online (Sandbox Code Playgroud)
复制时构建时间失败
Duplicate files copied in …Run Code Online (Sandbox Code Playgroud) 使用cxf创建JAX-RS端点时,我间接启动码头实例
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(HelloWorldResource.class);
    sf.setResourceProvider(HelloWorldResource.class, new SingletonResourceProvider(new HelloWorldResource()));
    sf.setAddress("http://localhost:9000/");
    sf.create();
Run Code Online (Sandbox Code Playgroud)
这很好,但是当通过CXF启动码头线程池minThreads和maxThreads时,我该如何以编程方式配置其大小?
我试图运行使用maven-embedded-glassfish-plugin嵌入的ActiveMQ glassfish.
我已经单独完成了以下教程,所以我知道基础知识.目标是在一次点击中建立一个设置,避免在svn中使用3pp库.
1 http://www.hascode.com/2011/09/java-ee-6-development-using-the-maven-embedded-glassfish-plugin/
2 http://javadude.wordpress.com/2011/07/21/glassfish-v3-1-running-embedded-activemq-for-jms-part-1/
#2的项目设置从现在开始用作起点,我将尝试合并#1中的步骤
我已经设置了glassfish-resources.xml,希望它能从glassfish管理控制台执行配置教程1.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<resource-adapter-config resource-adapter-name="activemq-rar-5.6.0" thread-pool-ids="thread-pool-1">
    <property name="ServerUrl" value="vm://localhost:61616"></property>
    <property name="BrokerXmlConfig" value="broker:(tcp://0.0.0.0:61616)"></property>
</resource-adapter-config>
    <connector-resource enabled="true" jndi-name="amqres"
        object-type="user" pool-name="amqpool">
    </connector-resource>
    <connector-connection-pool
        connection-definition-name="javax.jms.ConnectionFactory"
        fail-all-connections="false" idle-timeout-in-seconds="300"
        is-connection-validation-required="false" max-pool-size="32"
        max-wait-time-in-millis="60000" name="amqpool" pool-resize-quantity="2"
        resource-adapter-name="activemq-rar-5.6.0" steady-pool-size="2" />
    <admin-object-resource res-adapter="activemq-rar-5.6.0"
        res-type="javax.jms.Queue" jndi-name="amqmsg"></admin-object-resource>
</resources>
Run Code Online (Sandbox Code Playgroud)
添加到pom.xml
<dependencies>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-rar</artifactId>
        <version>5.6.0</version>
        <type>rar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-core</artifactId>
        <version>5.6.0</version>
        <scope>compile</scope>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
Q1:如何加载glassfish-resources.xml?我应该使用maven admin命令还是将其放在某些META-INF中?编辑:看起来像是在web-inf如果是war和meta-inf如果是ejb-jar
Q2:不完全确定下一步是什么.#1让我将activemq和log4j库复制到GLASSFISH_HOME/glassfish/lib到目前为止我只在pom.xml中添加了依赖项,这里的等价物是什么?
问题3:还需要部署Rar.如何部署多个应用程序?