3

I have an InInterceptor that gets some information from the HTTPHeaders and creates a custom object

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));
}

Then in service methods I use below code to get the custom object

final Message message = PhaseInterceptorChain.getCurrentMessage();
final CustomObject customObject=(CustomObject)message.getContextualProperty("CustomObject");

I was wondering if its possible to get this through @Context ..

@GET
@Path("/custom")
@Produces("application/json")
public List<Node> getA(@Context("CustomObject") String user) throws XYZException;

Thanks

user325643
  • 353
  • 1
  • 8
  • 20
  • formatting hint: You should add 4 spaces in front of the lonely `}`. Then it will be part of the code and highlighted. I can't do that because an edit requires 6 nonspace characters. – Shegit Brahm Apr 11 '12 at 08:05
  • Did you ever get this to work? I am looking into the same problem. e.g: @Context User user; – thomas77 Mar 04 '15 at 14:50

0 Answers0