use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class ServletPathZuulProxyApplicationTests method setTestRequestContext.
@Before
public void setTestRequestContext() {
RequestContext context = new RequestContext();
RequestContext.testSetCurrentContext(context);
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class SimpleZuulServerApplication method setTestRequestContext.
@Before
public void setTestRequestContext() {
RequestContext context = new RequestContext();
RequestContext.testSetCurrentContext(context);
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class RibbonRoutingFilter method run.
@Override
public Object run() {
RequestContext context = RequestContext.getCurrentContext();
this.helper.addIgnoredHeaders();
try {
RibbonCommandContext commandContext = buildCommandContext(context);
ClientHttpResponse response = forward(commandContext);
setResponse(response);
return response;
} catch (ZuulException ex) {
throw new ZuulRuntimeException(ex);
} catch (Exception ex) {
throw new ZuulRuntimeException(ex);
}
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class SimpleHostRoutingFilter method run.
@Override
public Object run() {
RequestContext context = RequestContext.getCurrentContext();
HttpServletRequest request = context.getRequest();
MultiValueMap<String, String> headers = this.helper.buildZuulRequestHeaders(request);
MultiValueMap<String, String> params = this.helper.buildZuulRequestQueryParams(request);
String verb = getVerb(request);
InputStream requestEntity = getRequestBody(request);
if (request.getContentLength() < 0) {
context.setChunkedRequestBody();
}
String uri = this.helper.buildZuulRequestURI(request);
this.helper.addIgnoredHeaders();
try {
CloseableHttpResponse response = forward(this.httpClient, verb, uri, request, headers, params, requestEntity);
setResponse(response);
} catch (Exception ex) {
throw new ZuulRuntimeException(ex);
}
return null;
}
use of com.netflix.zuul.context.RequestContext in project spring-cloud-netflix by spring-cloud.
the class AbstractRibbonCommand method run.
@Override
protected ClientHttpResponse run() throws Exception {
final RequestContext context = RequestContext.getCurrentContext();
RQ request = createRequest();
RS response;
boolean retryableClient = this.client instanceof AbstractLoadBalancingClient && ((AbstractLoadBalancingClient) this.client).isClientRetryable((ContextAwareRequest) request);
if (retryableClient) {
response = this.client.execute(request, config);
} else {
response = this.client.executeWithLoadBalancer(request, config);
}
context.set("ribbonResponse", response);
//
if (this.isResponseTimedOut()) {
if (response != null) {
response.close();
}
}
return new RibbonHttpResponse(response);
}
Aggregations