本文整理汇总了Java中javax.servlet.WriteListener类的典型用法代码示例。如果您正苦于以下问题:Java WriteListener类的具体用法?Java WriteListener怎么用?Java WriteListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WriteListener类属于javax.servlet包,在下文中一共展示了WriteListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
final ServletOutputStream outputStream = d.getOutputStream();
return new ServletOutputStream() {
@Override
public void write(int b) throws IOException {
respBody.write(b);
outputStream.write(b);
}
@Override
public void setWriteListener(WriteListener writeListener) {
outputStream.setWriteListener(writeListener);
}
@Override
public boolean isReady() {
return outputStream.isReady();
}
};
}
示例2: setWriteListener
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public void setWriteListener(final WriteListener writeListener) {
if (writeListener == null) {
throw UndertowServletMessages.MESSAGES.paramCannotBeNull("writeListener");
}
if (listener != null) {
throw UndertowServletMessages.MESSAGES.listenerAlreadySet();
}
listener = writeListener;
channel.getWriteSetter().set(new WriteChannelListener());
state |= FLAG_READY;
ioExecutor.execute(new Runnable() {
@Override
public void run() {
channel.resumeWrites();
}
});
}
示例3: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
return new ServletOutputStream() {
@Override
public boolean isReady() {
return false;
}
@Override
public void setWriteListener(WriteListener writeListener) {
}
private TeeOutputStream tee = new TeeOutputStream(ResponseWrapper.super.getOutputStream(), bos);
@Override
public void write(int b) throws IOException {
tee.write(b);
}
};
}
示例4: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
return new ServletOutputStream() {
@Override
public void write(int b) throws IOException {
baos.write(b);
}
@Override
public boolean isReady() {
// TODO Auto-generated method stub
return false;
}
@Override
public void setWriteListener(WriteListener listener) {
// TODO Auto-generated method stub
}
};
}
示例5: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
return new ServletOutputStream() {
@Override
public void write(int b) throws IOException {
builder.append(new Character((char) b));
}
@Override
public void setWriteListener(WriteListener listener) {
}
@Override
public boolean isReady() {
return true;
}
};
}
示例6: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
if (servletOutputStream == null){
servletOutputStream = new ServletOutputStream() {
@Override
public void write(int b) throws IOException {
out.write(b);
}
@Override
public void setWriteListener(WriteListener wl) {
writeListener = wl;
}
@Override
public boolean isReady() {
return true;
}
};
}
return servletOutputStream;
}
示例7: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
if (out == null){
out = new ServletOutputStream() {
@Override
public void write(int b) throws IOException {
baos.write(b);
}
@Override
public void setWriteListener(WriteListener writeListener) {
}
@Override
public boolean isReady() {
return false;
}
};
}
return out;
}
示例8: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
return new ServletOutputStream() {
private TeeOutputStream tee = new TeeOutputStream(ResponseWrapper.super.getOutputStream(), bos);
@Override
public boolean isReady() {
return true;
}
@Override
public void setWriteListener(WriteListener writeListener) {
}
@Override
public void write(int b) throws IOException {
tee.write(b);
}
};
}
示例9: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public synchronized ServletOutputStream getOutputStream() {
checkState(writer == null, "getWriter() already called");
if (outputStream == null) {
outputStream =
new ServletOutputStream() {
@Override
public void write(int c) throws IOException {
actualBody.write(c);
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setWriteListener(WriteListener listener) {
throw new UnsupportedOperationException();
}
};
}
return outputStream;
}
示例10: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
return new ServletOutputStream() {
@Override
public void write(int b) throws IOException {
outputStream.write(b);
}
@Override
public void setWriteListener(WriteListener arg0) {}
@Override
public boolean isReady() {
return true;
}
};
}
示例11: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
public ServletOutputStream getOutputStream() throws IOException {
// return instace.getOutputStream();
if (os == null) {
os = new ByteArrayOutputStream();
sos = new ServletOutputStream() {
@Override
public void write(int b) throws IOException {
os.write(b);
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setWriteListener(WriteListener writeListener) {
}
};
}
return sos;
}
示例12: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() {
return new ServletOutputStream() {
@Override
public void write(int b) {
baos.write(b);
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setWriteListener(WriteListener writeListener) {}
};
}
示例13: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
return new ServletOutputStream() {
private TeeOutputStream tee = new TeeOutputStream(ResponseWrapper.super.getOutputStream(), bos);
@Override
public void write(int b) throws IOException {
tee.write(b);
}
@Override
public boolean isReady() {
// Auto-generated method stub
return false;
}
@Override
public void setWriteListener(WriteListener listener) {
// Auto-generated method stub
}
};
}
示例14: getOutputStream
import javax.servlet.WriteListener; //导入依赖的package包/类
@Override
public ServletOutputStream getOutputStream() throws IOException {
return new ServletOutputStream(){
@Override
public boolean isReady() {
return true;
}
@Override
public void setWriteListener(WriteListener writeListener) {
}
@Override
public void write(int b) throws IOException {
out.write(b);
}
};
}
示例15: setUp
import javax.servlet.WriteListener; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
bytes = new byte[] { (byte) 0x0 };
inputStream = new ByteArrayInputStream(bytes);
outputStream = new ByteArrayOutputStream();
socketStream = new ServletOutputStream() {
@Override
public void write(int b) throws IOException {
outputStream.write(b);
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setWriteListener(WriteListener writeListener) {
}
};
when(response.getOutputStream()).thenReturn(socketStream);
}