在每篇文章中回答一个问题"如何将字符串附加到JEditorPane?" 是这样的
jep.setText(jep.getText + "new string");
Run Code Online (Sandbox Code Playgroud)
我试过这个:
jep.setText("<b>Termination time : </b>" +
CriterionFunction.estimateIndividual_top(individual) + " </br>");
jep.setText(jep.getText() + "Processes' distribution: </br>");
Run Code Online (Sandbox Code Playgroud)
结果我得到了"终止时间:1000"而没有"进程分发":
为什么会这样?
为什么我的代码不起作用?
package generatingInitialPopulation;
import java.util.Arrays;
import java.util.Collections;
public class TestShuffle {
public static void main(String[] args) {
int[] arr = new int[10];
for (int i = 0; i < arr.length; i++) {
arr[i] = i;
}
Collections.shuffle(Arrays.asList(arr));
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
}
}
Run Code Online (Sandbox Code Playgroud)
其结果是:0 1 2 3 4 5 6 7 8 9.
我期待一个随机改组的序列.
我一直在谷歌搜索"文件集和路径之间的差异"文章一段时间,但没有发现任何有用的东西.例如,以下内容之间的区别是什么(例如,有一个someDir目录,其中包含.jar文件且没有子目录):
<path id="somePathId">
<pathelement path="someDir"/>
</path>
<path id="someId">
<path refid="somePathId" />
</path>
Run Code Online (Sandbox Code Playgroud)
和
<path id="someId">
<fileset dir="someDir">
<include name="*.*">
</fileset>
</path>
Run Code Online (Sandbox Code Playgroud)
?
大家好!
这是我的请求消息:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="1">
<wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-A3BCFAE87E12A8813813289737654441">MIICCTCCAXKgAwIBAgIETzVFkDANBgkqhkiG9w0BAQUFADBJMQswCQYDVQQGEwJSVTEKMAgGA1UECBMBMTEKMAgGA1UEBxMBMTEKMAgGA1UEChMBMTEKMAgGA1UECxMBMTEKMAgGA1UEAxMBMTAeFw0xMjAyMTAxNjI4MDBaFw0xMjA1MTAxNjI4MDBaMEkxCzAJBgNVBAYTAlJVMQowCAYDVQQIEwExMQowCAYDVQQHEwExMQowCAYDVQQKEwExMQowCAYDVQQLEwExMQowCAYDVQQDEwExMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCdwxyRNYlWADnTtzH9/s/ehhD2iFzvF2xI+tBNyhbBb98EQNiIFdEegwGPhtd3Cfe1lQqtddWdFX2uLqozMAgd1KzSEuH9lI5DPiir3RfVdy+Irs5ZYiD/H4/DcUMUNyVcWspf9oG25wNdwNHKY8Aqz2269uYMCCoIBuWt6POwFQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAGLgTXbn7h2rBjv++6OopDooRifc4e2k+9sSTpLNegs9OvQzR8DpmQ/6Vt0RFprIdXSv+IVMcmL8Q2dmI9v0R61NIhdEjzSVbO2+PF9h1ShUARzMawRC/EOdjwVjDsk1WMxF18+wvH9SQxBSK3H2WpJbDWBxZCOW5CK1N6AKKJiC</wsse:BinarySecurityToken>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="SIG-2">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="soap" />
</ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<ds:Reference URI="#id-1">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="" />
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<ds:DigestValue>RJhc1ZVjXdUQEIwLTH356p7H0QY=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>F0q0NV7kaSbAcsLHxVpYD1bQ1RAJcw6wPapDKAM9PIcs7EuS9S5PlE4cQMfAp1WgsKa91r3op1OQ5UrYmmdj/UneYawdPIYSaoFBGjndTXZnOCKp4YfRTQGZ2EVJRFHJbPsTsqHedPAyJLHhciViguTGeuA0hZAQN97KB/9ZLmY=</ds:SignatureValue>
<ds:KeyInfo Id="KI-A3BCFAE87E12A8813813289737654452">
<wsse:SecurityTokenReference wsu:Id="STR-A3BCFAE87E12A8813813289737654483">
<wsse:Reference URI="#X509-A3BCFAE87E12A8813813289737654441" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" />
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature>
</wsse:Security>
</soap:Header>
<soap:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-1">
<stubMethod xmlns="http://ws_base.ws.stuff/" />
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
我尝试验证<ds:DigestValue>RJhc1ZVjXdUQEIwLTH356p7H0QY=</ds:DigestValue>与正文标签相关的内容。有像ds:CanonicalizationMethod和ds:Transforms这样的标签对我来说真的很困惑。我的问题是如何验证身体部位?首先,我应该使用什么标签开始验证
<soap:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-1">
<stubMethod xmlns="http://ws_base.ws.stuff/" />
</soap:Body> …Run Code Online (Sandbox Code Playgroud) 在CXF的文档中,据说2.7.x版本要求不在4.2.0版本下的Woodstox jar在类路径中可用.
有人可以建议Maven依赖Woodstox与CXF合作吗?
主要问题是当我尝试使用cxf的客户端时,引发了一个异常"无法创建安全的XMLInputFactory".根据不同的论坛(例如),可以使用"org.apache.cxf.stax.allowInsecureParser"系统属性来解决问题,但这似乎不是一个好方法.所以maven依赖是要走的路......
提前致谢.
我已经开始用Spring学习Apache CXF了.首先,我尝试创建一个简单的客户端/服务器模型.
服务器端是: service.HelloWorld.java
@WebService
public interface HelloWorld {
String sayHi(String text);
}
Run Code Online (Sandbox Code Playgroud)
service.HelloWorldImpl.java
@WebService(endpointInterface = "service.HelloWorld")
public class HelloWorldImpl implements HelloWorld {
public String sayHi(String text) {
return "Hello, " + text;
}
}
Run Code Online (Sandbox Code Playgroud)
客户端是: client.Client.java public class Client {
public static void main(String[] args) {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"cxf-client-servlet.xml"});
HelloWorld client = (HelloWorld) context.getBean("client");
System.out.println(client.sayHi("Batman"));
}
}
Run Code Online (Sandbox Code Playgroud)
CXF的客户端 - servlet.xml中
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schema/jaxws.xsd">
<bean id="client" class="service.HelloWorld" factory-bean="clientFactory" factory-method="create"/>
<bean …Run Code Online (Sandbox Code Playgroud) 我已经开始用Spring学习Apache CXF了.首先,我创建了一个简单的客户端/服务器模型:请参阅此处
现在我正在尝试使用简单的证书身份验证.所以我改变了配置文件(对于服务器和客户端): cxf-servlet.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint
id="helloWorld"
implementor="service.HelloWorldImpl"
address="/HelloWorld">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>
<jaxws:inInterceptors>
<bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
<ref bean="WSS4JInInterceptor"/>
</jaxws:inInterceptors>
</jaxws:endpoint>
<bean id="WSS4JInInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Signature"/>
<entry key="passwordCallbackRef">
<ref bean="passwordCallback"/>
</entry>
<entry key="signaturePropFile" value="server_sign.properties"/>
</map>
</constructor-arg>
</bean>
<bean id="passwordCallback" class="service.PasswordCallbackHandler" />
Run Code Online (Sandbox Code Playgroud)
server_sign.properties:
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=keyStorePassword
org.apache.ws.security.crypto.merlin.file=publicstore.jks
Run Code Online (Sandbox Code Playgroud)
cxf-client-servlet.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schema/jaxws.xsd">
<bean id="client" class="service.HelloWorld" factory-bean="clientFactory" factory-method="create"/>
<bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" …Run Code Online (Sandbox Code Playgroud) 我的问题是以我需要的方式进行蚂蚁记录.所以我决定使用Log4j.正如我从这篇文章中读到的,我设置了ANT_OPTS:
set ANT_OPTS=-Dlog4j.debug -Dlog4j.configuration=file:///d:/ant_dir/lib/log4j.xml
Run Code Online (Sandbox Code Playgroud)
当我尝试通过命令执行build.xml时:
D:/ant_dir>ant -listener org.apache.tools.ant.listener.Log4jListener
Run Code Online (Sandbox Code Playgroud)
我发现错误:由于依赖项无效,无法加载类org.apache.tools.ant.listener.Log4jListener. log4j.jar和log4j.xml位于ANT_HOME/lib目录中.
我一直在寻找一个教程,但一无所获.有人可以帮我提供建议或提供有用的链接吗?
我的任务是让Hudson在提交后开始新的构建.正如我在这里读到的那样,它是通过使用svn post-commit钩子完成的.问题是我不想使用VBScript,因此它是依赖于平台的.我可以看到这个VBScript中唯一重要的东西是使用svnlook命令和http:// server/subversion/$ {UUID}/notifyCommit?rev = $ REV url.就我而言,我可以做同样的事情,例如,使用java程序(需要参数作为修订,存储库位置等)
请你解开http:// server/subversion/$ {UUID}/notifyCommit?rev = $ REV url 的神秘面纱吗?我需要所有可能的变种.如果sombody可以描述与Hudson交互的整个过程(它是在获得此请求后执行的内部进程链),那将是很棒的
编辑我真的需要提交后行为,而不是轮询机制.
我是Spring AOP的新手,我尝试使用一个方面进行日志记录.这是我的配置:
方面:
@Aspect
public class LoggerAspect {
@Pointcut("execution(* aop.LoggerAspTest.*(..))")
private void infoMethods(){}
@Before("infoMethods()")
public void logBefore(JoinPoint joinPoint) {
Logger logger = Logger.getLogger(joinPoint.getTarget().getClass());
logger.info("joinPoint's kind: " + joinPoint.getKind());
logger.info("joinPoint's args: " + joinPoint.getArgs());
logger.info("joinPoint's source location: " + joinPoint.getSourceLocation());
logger.info("joinPoint's staticPart: " + joinPoint.getStaticPart());
logger.info("joinPoint's targetClass: " + joinPoint.getTarget().getClass());
logger.info("joinPoint's this: " + joinPoint.getThis());
}
}
Run Code Online (Sandbox Code Playgroud)
测试类:
@Component
public class LoggerAspTest {
// test method
public void getInfo() {
System.out.println("in the logger aspect test method!!!");
}
}
Run Code Online (Sandbox Code Playgroud)
类 - 执行者: …