类javax.servlet.http.WebConnection源码实例Demo

下面列出了怎么用javax.servlet.http.WebConnection的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Tomcat8-Source-Read   文件: TestUpgrade.java
@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);
}
 
源代码2 项目: sample.daytrader7   文件: PingUpgradeServlet.java
@Override
public void init(final WebConnection wc) {
    Listener listener = null;
    try {
        listener = new Listener(wc);
      
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
      
    try {
        
        if (Log.doTrace()) {
            Log.trace("PingUpgradeServlet$Handler.init() -- Initializing Handler");
        }
  
        // flush headers if any
        wc.getOutputStream().flush();
        wc.getInputStream().setReadListener(listener);

    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
}
 
源代码3 项目: Tomcat8-Source-Read   文件: TestUpgrade.java
@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);
    }
}
 
源代码4 项目: Tomcat8-Source-Read   文件: TestUpgrade.java
@Override
public void init(WebConnection connection) {
    ServletInputStream sis;
    try {
        sis = connection.getInputStream();
    } catch (IOException ioe) {
        throw new IllegalStateException(ioe);
    }
    sis.setReadListener(null);
}
 
源代码5 项目: Tomcat8-Source-Read   文件: TestUpgrade.java
@Override
public void init(WebConnection connection) {
    ServletOutputStream sos;
    try {
        sos = connection.getOutputStream();
    } catch (IOException ioe) {
        throw new IllegalStateException(ioe);
    }
    sos.setWriteListener(null);
}
 
源代码6 项目: Tomcat8-Source-Read   文件: TestUpgrade.java
@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);
}
 
源代码7 项目: Tomcat8-Source-Read   文件: TestUpgrade.java
@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);
}
 
源代码8 项目: Tomcat8-Source-Read   文件: TestUpgrade.java
@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());
}
 
源代码9 项目: quarkus-http   文件: AsyncUpgradeServlet.java
@Override
public void init(final WebConnection wc) {
    Listener listener = new Listener(wc);
    try {
        //we have to set the write listener before the read listener
        //otherwise the output stream could be written to before it is
        //in async mode
        wc.getOutputStream().setWriteListener(listener);
        wc.getInputStream().setReadListener(listener);
    } catch (IOException e) {
        UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
    }
}
 
源代码10 项目: Tomcat8-Source-Read   文件: WsHttpUpgradeHandler.java
@Override
public void init(WebConnection connection) {
    if (ep == null) {
        throw new IllegalStateException(
                sm.getString("wsHttpUpgradeHandler.noPreInit"));
    }

    String httpSessionId = null;
    Object session = handshakeRequest.getHttpSession();
    if (session != null ) {
        httpSessionId = ((HttpSession) session).getId();
    }

    // Need to call onOpen using the web application's class loader
    // Create the frame using the application's class loader so it can pick
    // up application specific config from the ServerContainerImpl
    Thread t = Thread.currentThread();
    ClassLoader cl = t.getContextClassLoader();
    t.setContextClassLoader(applicationClassLoader);
    try {
        wsRemoteEndpointServer = new WsRemoteEndpointImplServer(socketWrapper, webSocketContainer);
        wsSession = new WsSession(ep, wsRemoteEndpointServer,
                webSocketContainer, handshakeRequest.getRequestURI(),
                handshakeRequest.getParameterMap(),
                handshakeRequest.getQueryString(),
                handshakeRequest.getUserPrincipal(), httpSessionId,
                negotiatedExtensions, subProtocol, pathParameters, secure,
                serverEndpointConfig);
        wsFrame = new WsFrameServer(socketWrapper, wsSession, transformation,
                applicationClassLoader);
        // WsFrame adds the necessary final transformations. Copy the
        // completed transformation chain to the remote end point.
        wsRemoteEndpointServer.setTransformation(wsFrame.getTransformation());
        ep.onOpen(wsSession, serverEndpointConfig);
        webSocketContainer.registerSession(serverEndpointConfig.getPath(), wsSession);
    } catch (DeploymentException e) {
        throw new IllegalArgumentException(e);
    } finally {
        t.setContextClassLoader(cl);
    }
}
 
源代码11 项目: quarkus-http   文件: AsyncUpgradeServlet.java
private Listener(final WebConnection connection) {
    this.connection = connection;
}
 
源代码12 项目: piranha   文件: DefaultHttpServletRequestTest.java
@Override
public void init(WebConnection wc) {
}
 
源代码13 项目: piranha   文件: DefaultHttpServletRequestTest.java
@Override
public void init(WebConnection wc) {
}
 
源代码14 项目: piranha   文件: NanoRequestTest.java
@Override
public void init(WebConnection webConnection) {
}
 
源代码15 项目: haven-platform   文件: ImmediateCloseConnection.java
@Override
public void init(WebConnection wc) {
    close(wc::getInputStream);
    close(wc::getOutputStream);
}
 
源代码16 项目: sample.daytrader7   文件: PingUpgradeServlet.java
private Listener(final WebConnection connection) throws IOException  {
    this.connection = connection;
    this.input = connection.getInputStream();
    this.output = connection.getOutputStream();
}