org.eclipse.jetty.server.HttpOutput Java Examples
The following examples show how to use
org.eclipse.jetty.server.HttpOutput.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RequestResponseInterceptor.java From konker-platform with Apache License 2.0 | 6 votes |
@Override public void afterCompletion( HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws java.io.IOException { String emailUser = request.getUserPrincipal().getName(); ServiceResponse<User> serviceResponse = userService.findByEmail(emailUser); String url = request.getRequestURL().toString(); HttpOutput out = (HttpOutput) response.getOutputStream(); if (serviceResponse.isOk()) { LOGGER.info(MessageFormat.format("{0} {1} {2} {3}", serviceResponse.getResult().getTenant().getDomainName(), url, response.getStatus(), out.getWritten())); } }
Example #2
Source File: JettyHttpHandlerAdapter.java From spring-analysis-note with MIT License | 5 votes |
@Override protected int writeToOutputStream(DataBuffer dataBuffer) throws IOException { ByteBuffer input = dataBuffer.asByteBuffer(); int len = input.remaining(); ServletResponse response = getNativeResponse(); ((HttpOutput) response.getOutputStream()).write(input); return len; }
Example #3
Source File: JettyHttpHandlerAdapter.java From java-technology-stack with MIT License | 5 votes |
@Override protected int writeToOutputStream(DataBuffer dataBuffer) throws IOException { ByteBuffer input = dataBuffer.asByteBuffer(); int len = input.remaining(); ServletResponse response = getNativeResponse(); ((HttpOutput) response.getOutputStream()).write(input); return len; }
Example #4
Source File: ResourceHandler.java From ignite with Apache License 2.0 | 5 votes |
/** * @param response Http response. * @param type Type. * @param path Path to file. * @throws IOException If failed. */ private static void handleRequest(HttpServletResponse response, String type, String path) throws IOException { Path path0 = Paths.get(path); response.setContentType(type); response.setHeader("Content-Disposition", "attachment; filename=\"" + path0.getFileName() + "\""); try (HttpOutput out = (HttpOutput)response.getOutputStream()) { out.sendContent(FileChannel.open(path0, StandardOpenOption.READ)); } }
Example #5
Source File: ResourceHandler.java From ignite with Apache License 2.0 | 5 votes |
/** * @param response Http response. * @param type Type. * @param stream Stream. * @param attachmentName Attachment name. * @throws IOException If failed. */ private static void handleRequest(HttpServletResponse response, String type, InputStream stream, String attachmentName) throws IOException { response.setContentType(type); response.setHeader("Content-Disposition", "attachment; filename=\"" + attachmentName + "\""); try (HttpOutput out = (HttpOutput)response.getOutputStream()) { out.sendContent(stream); } }
Example #6
Source File: JettyHTTPDestination.java From cxf with Apache License 2.0 | 5 votes |
private OutputStream wrapOutput(OutputStream out) { try { if (out instanceof HttpOutput) { out = new JettyOutputStream((HttpOutput)out); } } catch (Throwable t) { //ignore } return out; }
Example #7
Source File: JettyHTTPDestination.java From cxf with Apache License 2.0 | 4 votes |
JettyOutputStream(HttpOutput o) { super(o); out = o; }