如何从HttpServletRequest中提取SOAP对象.
在我的过滤器AuthenticationEntryPoint中,我有方法
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException
Run Code Online (Sandbox Code Playgroud)
我想从HttpServletRequest中提取SOAP请求?
我有一个方法:
invokList(List<Object> list);
Run Code Online (Sandbox Code Playgroud)
此方法在jar中,我无法访问它的源代码。因此,我需要以并行方式执行invokList,有人可以为此提供帮助吗?
想法是将列表拆分为多个列表,然后并行执行invokList。
我做了这个例子:
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Test {
public static void main(String[] args) {
List<Integer> list = Arrays.asList(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
list.parallelStream()
.map(Collections::singletonList)
.forEach(Test::invokList);
}
public static void invokList(List<Integer> list) {
try {
Thread.sleep(100);
System.out.println("The Thread :" + Thread.currentThread().getName() + " is processing this list" + list);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个包含另一个对象属性的对象,如下所示:
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
@JsonPropertyOrder({"fA1","b","fA2"})
@Data
public class A {
private String fA1;
private String fA2;
@JsonUnwrapped
private B b = new B();
@Data
class B {
private String fB1;
private String fB2;
}
public static void main(String[] args) throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
A a = new A ();
System.out.println(objectMapper.writeValueAsString(a));
}
}
Run Code Online (Sandbox Code Playgroud)
我想要的是生成尊重这个顺序的json:
{
"fA1":"",
"fB1":"",
"fA2":"",
"fB2":""
}
Run Code Online (Sandbox Code Playgroud)
有什么办法可以做到这一点吗?