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/02/12 02:57:48 UTC

[GitHub] willard-kali commented on issue #1086: 【求助】edge service自定义返回302进行重定向报错

willard-kali commented on issue #1086: 【求助】edge service自定义返回302进行重定向报错
URL: https://github.com/apache/servicecomb-java-chassis/issues/1086#issuecomment-462595397
 
 
   将代码改为:
   ```
    context.response().headers().add("Location", "/login.html");
    response.setStatus(Response.create(302, "", "").getStatus());
    response.setResult(new InvocationException(302, "", "redirect")); //新增
    super.sendResponse(response);
   ```
   既然报错说需要InvocationException,那就人为构造一个InvocationException放进去,这样就能成功实现302的重定向了。

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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