You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/12/24 06:19:23 UTC

[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1484: query about context delivery mechanism of servicecomb

liubao68 commented on issue #1484: query about context delivery mechanism of servicecomb
URL: https://github.com/apache/servicecomb-java-chassis/issues/1484#issuecomment-568666716
 
 
   Do you mean 
   ```
     @ApiResponse(code = 200, response = User.class, message = "")
     @ResponseHeaders({@ResponseHeader(name = "h1", response = String.class),
         @ResponseHeader(name = "h2", response = String.class)})
     @Path("/cseResponse")
     @GET
   public Response cseResponse(InvocationContext c1) {
       Response response = Response.createSuccess(Status.ACCEPTED, new User());
       Headers headers = response.getHeaders();
       headers.addHeader("h1", "h1v " + c1.getContext().get(Const.SRC_MICROSERVICE).toString());
   
       InvocationContext c2 = ContextUtils.getInvocationContext();
       headers.addHeader("h2", "h2v " + c2.getContext().get(Const.SRC_MICROSERVICE).toString());
   
       return response;
     }
   ```
   
   or
   
   ```
   void testTraceIdOnContextContainsTraceId() {
       InvocationContext context = new InvocationContext();
       context.addContext(Const.TRACE_ID_NAME, String.valueOf(Long.MIN_VALUE));
       ContextUtils.setInvocationContext(context);
       String traceId = test.testTraceId();
       TestMgr.check(String.valueOf(Long.MIN_VALUE), traceId);
       ContextUtils.removeInvocationContext();
     }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services