本文整理匯總了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);
}