Java Code Examples for javax.servlet.http.WebConnection#getOutputStream()

The following examples show how to use javax.servlet.http.WebConnection#getOutputStream() . 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: TestUpgrade.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void init(WebConnection connection) {
    ServletInputStream sis;
    ServletOutputStream sos;

    try {
        sis = connection.getInputStream();
        sos = connection.getOutputStream();
    } catch (IOException ioe) {
        throw new IllegalStateException(ioe);
    }

    EchoListener echoListener = new EchoListener(sis, sos);
    sis.setReadListener(echoListener);
    sos.setWriteListener(echoListener);
}
 
Example 2
Source File: TestUpgrade.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void init(WebConnection connection) {

    try (ServletInputStream sis = connection.getInputStream();
         ServletOutputStream sos = connection.getOutputStream()){
        byte[] buffer = new byte[8192];
        int read;
        while ((read = sis.read(buffer)) >= 0) {
            sos.write(buffer, 0, read);
            sos.flush();
        }
    } catch (IOException ioe) {
        throw new IllegalStateException(ioe);
    }
}
 
Example 3
Source File: TestUpgrade.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void init(WebConnection connection) {
    ServletOutputStream sos;
    try {
        sos = connection.getOutputStream();
    } catch (IOException ioe) {
        throw new IllegalStateException(ioe);
    }
    sos.setWriteListener(null);
}
 
Example 4
Source File: TestUpgrade.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void init(WebConnection connection) {
    ServletInputStream sis;
    ServletOutputStream sos;
    try {
        sis = connection.getInputStream();
        sos = connection.getOutputStream();
    } catch (IOException ioe) {
        throw new IllegalStateException(ioe);
    }
    sos.setWriteListener(new NoOpWriteListener());
    ReadListener rl = new NoOpReadListener();
    sis.setReadListener(rl);
    sis.setReadListener(rl);
}
 
Example 5
Source File: TestUpgrade.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void init(WebConnection connection) {
    ServletInputStream sis;
    ServletOutputStream sos;
    try {
        sis = connection.getInputStream();
        sos = connection.getOutputStream();
    } catch (IOException ioe) {
        throw new IllegalStateException(ioe);
    }
    sis.setReadListener(new NoOpReadListener());
    WriteListener wl = new NoOpWriteListener();
    sos.setWriteListener(wl);
    sos.setWriteListener(wl);
}
 
Example 6
Source File: TestUpgrade.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void init(WebConnection connection) {

    try {
        sis = connection.getInputStream();
        sos = connection.getOutputStream();
    } catch (IOException ioe) {
        throw new IllegalStateException(ioe);
    }

    sis.setReadListener(new NoOpReadListener());
    sos.setWriteListener(new FixedResponseWriteListener());
}
 
Example 7
Source File: PingUpgradeServlet.java    From sample.daytrader7 with Apache License 2.0 4 votes vote down vote up
private Listener(final WebConnection connection) throws IOException  {
    this.connection = connection;
    this.input = connection.getInputStream();
    this.output = connection.getOutputStream();
}