简体   繁体   English

如何在播放框架中从 ws 客户端重定向 stream 301

[英]How to stream 301 redirect from ws client in play framework

I am a writing a middleware program, where it internally calls third party api.我正在编写一个中间件程序,它在内部调用第三方 api。 The third party api responds with 301 including some headers.第三方 api 响应 301,包括一些标头。 I have respond with response i got to front end.我已经响应我到前端的响应。 Is there any piece of code sample which will do this?是否有任何代码示例可以做到这一点?

In this case, I do not see other options rather than building the response object setting the headers.在这种情况下,我没有看到其他选项,而是构建响应 object 设置标题。

public Result proxy() {
  response().setHeader(myHeader, headerValue1);
  // all your custom headers
  return status(Http.Status.MOVED_PERMANENTLY, "response body").as(your media type);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM