CF用户提供的服务路由服务限制了API的响应主体

时间:2018-03-28 05:31:50

标签: spring tomcat spring-boot cloudfoundry pivotal-cloud-foundry

我正面临这个问题,即在我的应用程序中创建用户提供的服务和bind-route-service。

这个Spring-boot应用程序对每个请求执行以下操作:

  1. 列表项
  2. 拦截传入的请求
  3. 记录有关该传入请求的信息
  4. 将传入请求转换为传出请求
  5. 记录有关该传出请求的信息
  6. 使用RestOperations.exchange
  7. 将请求转发到目标API

    我面临的问题是,当我在做一个获取请求时,我应该在响应中接近100个条目,我得到一个空体和200 OK响应。 当我使用小于等于4的$ top值执行请求时,对应用程序的同一调用工作正常。 当我不将我的服务绑定到应用程序时,对我的应用程序的同一调用工作正常并在响应正文中返回100个条目。

    在记录传入的请求和传出请求时,我发现我的路由服务应用程序正在做的只是删除由Gorouter添加的X-CF-Forwarded-Url。 我对此已经走到了尽头,在这方面的任何帮助/方向将不胜感激。

    异常日志:

    Message:
    java.io.IOException: Connection reset by peer
    Stacktrace:
    org.apache.catalina.connector.OutputBuffer.realWriteBytes
    OutputBuffer.java:393
    org.apache.tomcat.util.buf.ByteChunk.append
    ByteChunk.java:344
    org.apache.catalina.connector.OutputBuffer.writeBytes
    OutputBuffer.java:418
    org.apache.catalina.connector.OutputBuffer.write
    OutputBuffer.java:406
    org.apache.catalina.connector.CoyoteOutputStream.write
    CoyoteOutputStream.java:97
    org.apache.catalina.connector.CoyoteOutputStream.write
    CoyoteOutputStream.java:90
    org.springframework.util.StreamUtils.copy
    StreamUtils.java:92
    org.springframework.http.converter.ByteArrayHttpMessageConverter.writeInternal
    ByteArrayHttpMessageConverter.java:65
    org.springframework.http.converter.ByteArrayHttpMessageConverter.writeInternal
    ByteArrayHttpMessageConverter.java:37
    org.springframework.http.converter.AbstractHttpMessageConverter.write
    AbstractHttpMessageConverter.java:195
    org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters
    AbstractMessageConverterMethodProcessor.java:238
    org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue
    HttpEntityMethodProcessor.java:183
    org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue
    HandlerMethodReturnValueHandlerComposite.java:80
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle
    ServletInvocableHandlerMethod.java:126
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod
    RequestMappingHandlerAdapter.java:817
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal
    RequestMappingHandlerAdapter.java:731
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle
    AbstractHandlerMethodAdapter.java:85
    org.springframework.web.servlet.DispatcherServlet.doDispatch
    DispatcherServlet.java:959
    org.springframework.web.servlet.DispatcherServlet.doService
    DispatcherServlet.java:893
    org.springframework.web.servlet.FrameworkServlet.processRequest
    FrameworkServlet.java:968
    org.springframework.web.servlet.FrameworkServlet.doGet
    FrameworkServlet.java:859
    javax.servlet.http.HttpServlet.service
    HttpServlet.java:622
    org.springframework.web.servlet.FrameworkServlet.service
    FrameworkServlet.java:844
    javax.servlet.http.HttpServlet.service
    HttpServlet.java:729
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    ApplicationFilterChain.java:292
    org.apache.catalina.core.ApplicationFilterChain.doFilter
    ApplicationFilterChain.java:207
    org.apache.tomcat.websocket.server.WsFilter.doFilter
    WsFilter.java:52
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    ApplicationFilterChain.java:240
    org.apache.catalina.core.ApplicationFilterChain.doFilter
    ApplicationFilterChain.java:207
    org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal
    EndpointWebMvcAutoConfiguration.java:237
    org.springframework.web.filter.OncePerRequestFilter.doFilter
    OncePerRequestFilter.java:107
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    ApplicationFilterChain.java:240
    org.apache.catalina.core.ApplicationFilterChain.doFilter
    ApplicationFilterChain.java:207
    org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal
    WebRequestTraceFilter.java:112
    org.springframework.web.filter.OncePerRequestFilter.doFilter
    OncePerRequestFilter.java:107
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    ApplicationFilterChain.java:240
    org.apache.catalina.core.ApplicationFilterChain.doFilter
    ApplicationFilterChain.java:207
    org.springframework.web.filter.RequestContextFilter.doFilterInternal
    RequestContextFilter.java:99
    org.springframework.web.filter.OncePerRequestFilter.doFilter
    OncePerRequestFilter.java:107
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    ApplicationFilterChain.java:240
    org.apache.catalina.core.ApplicationFilterChain.doFilter
    ApplicationFilterChain.java:207
    org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal
    HttpPutFormContentFilter.java:87
    org.springframework.web.filter.OncePerRequestFilter.doFilter
    OncePerRequestFilter.java:107
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    ApplicationFilterChain.java:240
    org.apache.catalina.core.ApplicationFilterChain.doFilter
    ApplicationFilterChain.java:207
    org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal
    HiddenHttpMethodFilter.java:77
    org.springframework.web.filter.OncePerRequestFilter.doFilter
    OncePerRequestFilter.java:107
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    ApplicationFilterChain.java:240
    org.apache.catalina.core.ApplicationFilterChain.doFilter
    ApplicationFilterChain.java:207
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal
    CharacterEncodingFilter.java:121
    org.springframework.web.filter.OncePerRequestFilter.doFilter
    OncePerRequestFilter.java:107
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    ApplicationFilterChain.java:240
    org.apache.catalina.core.ApplicationFilterChain.doFilter
    ApplicationFilterChain.java:207
    org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal
    MetricsFilter.java:103
    org.springframework.web.filter.OncePerRequestFilter.doFilter
    OncePerRequestFilter.java:107
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    ApplicationFilterChain.java:240
    org.apache.catalina.core.ApplicationFilterChain.doFilter
    ApplicationFilterChain.java:207
    org.apache.catalina.core.StandardWrapperValve.invoke
    StandardWrapperValve.java:212
    org.apache.catalina.core.StandardContextValve.invoke
    StandardContextValve.java:106
    org.apache.catalina.authenticator.AuthenticatorBase.invoke
    AuthenticatorBase.java:502
    org.apache.catalina.valves.RemoteIpValve.invoke
    RemoteIpValve.java:676
    org.apache.catalina.core.StandardHostValve.invoke
    StandardHostValve.java:141
    org.apache.catalina.valves.ErrorReportValve.invoke
    ErrorReportValve.java:79
    org.apache.catalina.core.StandardEngineValve.invoke
    StandardEngineValve.java:88
    org.apache.catalina.connector.CoyoteAdapter.service
    CoyoteAdapter.java:522
    org.apache.coyote.http11.AbstractHttp11Processor.process
    AbstractHttp11Processor.java:1095
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process
    AbstractProtocol.java:672
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
    NioEndpoint.java:1500
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run
    NioEndpoint.java:1456
    java.util.concurrent.ThreadPoolExecutor.runWorker
    ThreadPoolExecutor.java:1149
    java.util.concurrent.ThreadPoolExecutor$Worker.run
    ThreadPoolExecutor.java:624
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run
    TaskThread.java:61
    java.lang.Thread.run
    Thread.java:748
    

0 个答案:

没有答案