我有一个maven模块,我需要在J2ME客户端和EJB服务器中使用.在客户端我需要为目标1.1编译它,在目标1.6的服务器中编译它.
我还需要将1.6版本部署到Nexus存储库,因此处理服务器项目的成员可以包含此依赖项,而无需下载源代码.
我在http://java.dzone.com/articles/maven-profile-best-practices上看到,使用配置文件并不是最好的方法,但作者没有说出最好的方法.
这是我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>proj-parent</artifactId>
<groupId>br.com.comp.proj</groupId>
<version>0.0.4-SNAPSHOT</version>
</parent>
<artifactId>proj-cryptolib</artifactId>
<name>proj - Cryto Lib</name>
<dependencies>
<dependency>
<groupId>br.com.comp</groupId>
<artifactId>comp-proj-mobile-messages</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.3</source>
<target>1.1</target>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud) 我正在使用Apache CXF来构建Web服务.它使用Apache WSS4J来提供WS-Security功能.我需要发出SOAP请求,必须签名.
这是我传递给WSS4J的属性文件的内容:
org.apache.ws.security.crypto.provider = org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type = PKCS12
org.apache.ws.security.crypto.merlin.keystore.provider = BC
org.apache.ws.security.crypto.merlin.keystore.password = 12345678
org.apache.ws.security.crypto.merlin.keystore.alias = my-alias
org.apache.ws.security.crypto.merlin.keystore.file = my_certificate.p12
Run Code Online (Sandbox Code Playgroud)
我希望摆脱那条线,我的密码写成纯文本.我删除了那一行并为我的WSS4JOutInterceptor提供了一个密码回调处理程序,就像上面的代码一样:
public SoapInterceptor newSignerInterceptor() {
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, "Signature");
outProps.put(WSHandlerConstants.USER, config.getKeyAlias());
outProps.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
outProps.put(WSHandlerConstants.USE_REQ_SIG_CERT, WSHandlerConstants.SIGNATURE_USER);
outProps.put(WSHandlerConstants.USE_SINGLE_CERTIFICATE, "false");
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, this.getClass().getName());
outProps.put(WSHandlerConstants.SIG_PROP_FILE, config.getPropertiesFileName());
return new WSS4JOutInterceptor(outProps);
}
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof WSPasswordCallback) {
((WSPasswordCallback) callbacks[i]).setPassword(password);
}
} …Run Code Online (Sandbox Code Playgroud) 我有一个用户可以通过Android,iPhone,BlackBerry或未知浏览器访问的页面.我有4 rich:panel秒,每个平台一个,后者是通用平台.
代码:
<rich:panel id="dlAndroid" rendered="#{fn:containsIgnoreCase(request.getHeader('User-Agent'), 'Android')}">
...
</rich:panel>
<rich:panel id="dlIphone" rendered="#{fn:containsIgnoreCase(request.getHeader('User-Agent'), 'iPhone')}">
...
</rich:panel>
<rich:panel id="dlBlackberry" rendered="#{fn:containsIgnoreCase(request.getHeader('User-Agent'), 'BlackBerry')}">
...
</rich:panel>
<rich:panel id="dlGeneric" rendered="#{ ---> WHAT TO WRITE HERE? <--- }">
Run Code Online (Sandbox Code Playgroud)
rich:panel如果没有其他人被渲染,我怎样才能渲染最后一个?