类org.eclipse.jetty.server.HttpOutput源码实例Demo

下面列出了怎么用org.eclipse.jetty.server.HttpOutput的API类实例代码及写法,或者点击链接到github查看源代码。

@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()));
	}

}
 
@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;
}
 
@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;
}
 
源代码4 项目: ignite   文件: ResourceHandler.java
/**
 * @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));
    }
}
 
源代码5 项目: ignite   文件: ResourceHandler.java
/**
 * @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);
    }
}
 
源代码6 项目: cxf   文件: JettyHTTPDestination.java
private OutputStream wrapOutput(OutputStream out) {
    try {
        if (out instanceof HttpOutput) {
            out = new JettyOutputStream((HttpOutput)out);
        }
    } catch (Throwable t) {
        //ignore
    }
    return out;
}
 
源代码7 项目: cxf   文件: JettyHTTPDestination.java
JettyOutputStream(HttpOutput o) {
    super(o);
    out = o;
}
 
 类所在包
 类方法
 同包方法