我有一个 InInterceptor 从 HTTPHeaders 获取一些信息并创建一个自定义对象
public void handleMessage(Message message) throws Fault {
final HttpServletRequest request = (HttpServletRequest) message
.get(AbstractHTTPDestination.HTTP_REQUEST);
String a= request.getHeader("A");
String b= request.getHeader("B");
message.put("CustomObject", new CustomObject(a,b));
}
然后在服务方法中,我使用下面的代码来获取自定义对象
final Message message = PhaseInterceptorChain.getCurrentMessage();
final CustomObject customObject=(CustomObject)message.getContextualProperty("CustomObject");
我想知道是否有可能通过@Context ..
@GET
@Path("/custom")
@Produces("application/json")
public List<Node> getA(@Context("CustomObject") String user) throws XYZException;
谢谢