我有一个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;
由于