2017-01-04 83 views

回答

1

您可以從OperationResourceInfo得到這個信息的攔截器應該是這樣的

public class MyInterceptor extends AbstractPhaseInterceptor<Message> { 
    public MyInterceptor() { 
     super(Phase.RECEIVE); 
    } 

    public void handleMessage(Message message) { 
     OperationResourceInfo m = message.getExchange().get(OperationResourceInfo.class); 
     List<javax.ws.rs.core.MediaType> consumes = m.getConsumeTypes(); 
     List<javax.ws.rs.core.MediaType> produces = m.getProduceTypes(); 
    } 

    public void handleFault(Message messageParam) { 
     //Invoked when interceptor fails 
    } 
} 

記住一個inout攔截器添加到您的端點

相關問題