use of org.springframework.http.server.ServerHttpResponse in project spring-boot by spring-projects.
the class HttpRestartServerHandlerTests method handleDelegatesToServer.
@Test
public void handleDelegatesToServer() throws Exception {
HttpRestartServer server = mock(HttpRestartServer.class);
HttpRestartServerHandler handler = new HttpRestartServerHandler(server);
ServerHttpRequest request = mock(ServerHttpRequest.class);
ServerHttpResponse response = mock(ServerHttpResponse.class);
handler.handle(request, response);
verify(server).handle(request, response);
}
use of org.springframework.http.server.ServerHttpResponse in project spring-boot by spring-projects.
the class DispatcherFilter method doFilter.
private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
ServerHttpRequest serverRequest = new ServletServerHttpRequest(request);
ServerHttpResponse serverResponse = new ServletServerHttpResponse(response);
if (!this.dispatcher.handle(serverRequest, serverResponse)) {
chain.doFilter(request, response);
}
}
use of org.springframework.http.server.ServerHttpResponse in project spring-framework by spring-projects.
the class WebSocketHttpRequestHandler method handleRequest.
@Override
public void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
ServerHttpRequest request = new ServletServerHttpRequest(servletRequest);
ServerHttpResponse response = new ServletServerHttpResponse(servletResponse);
HandshakeInterceptorChain chain = new HandshakeInterceptorChain(this.interceptors, this.wsHandler);
HandshakeFailureException failure = null;
try {
if (logger.isDebugEnabled()) {
logger.debug(servletRequest.getMethod() + " " + servletRequest.getRequestURI());
}
Map<String, Object> attributes = new HashMap<>();
if (!chain.applyBeforeHandshake(request, response, attributes)) {
return;
}
this.handshakeHandler.doHandshake(request, response, this.wsHandler, attributes);
chain.applyAfterHandshake(request, response, null);
response.close();
} catch (HandshakeFailureException ex) {
failure = ex;
} catch (Throwable ex) {
failure = new HandshakeFailureException("Uncaught failure for request " + request.getURI(), ex);
} finally {
if (failure != null) {
chain.applyAfterHandshake(request, response, failure);
throw failure;
}
}
}
use of org.springframework.http.server.ServerHttpResponse in project spring-framework by spring-projects.
the class SockJsHttpRequestHandler method handleRequest.
@Override
public void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException {
ServerHttpRequest request = new ServletServerHttpRequest(servletRequest);
ServerHttpResponse response = new ServletServerHttpResponse(servletResponse);
try {
this.sockJsService.handleRequest(request, response, getSockJsPath(servletRequest), this.webSocketHandler);
} catch (Throwable ex) {
throw new SockJsException("Uncaught failure in SockJS request, uri=" + request.getURI(), ex);
}
}
Aggregations