Search in sources :

Example 1 with OutputStreamSinkChannel

use of org.commonjava.indy.httprox.util.OutputStreamSinkChannel in project indy by Commonjava.

the class ProxyMITMSSLServer method transferRemote.

private void transferRemote(Socket socket, String host, int port, String method, String path, final ProxyMeter meter) throws Exception {
    String protocol = "https";
    String auth = null;
    String query = null;
    String fragment = null;
    URI uri = new URI(protocol, auth, host, port, path, query, fragment);
    URL remoteUrl = uri.toURL();
    logger.debug("Requesting remote URL: {}", remoteUrl.toString());
    ArtifactStore store = proxyResponseHelper.getArtifactStore(trackingId, remoteUrl);
    try (BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream());
        HttpConduitWrapper http = new HttpConduitWrapper(new OutputStreamSinkChannel(out), null, contentController, cacheProvider)) {
        proxyResponseHelper.transfer(http, store, remoteUrl.getPath(), GET_METHOD.equals(method), proxyUserPass, meter);
        out.flush();
    }
}
Also used : OutputStreamSinkChannel(org.commonjava.indy.httprox.util.OutputStreamSinkChannel) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) HttpConduitWrapper(org.commonjava.indy.httprox.util.HttpConduitWrapper) URI(java.net.URI) BufferedOutputStream(java.io.BufferedOutputStream) URL(java.net.URL)

Aggregations

BufferedOutputStream (java.io.BufferedOutputStream)1 URI (java.net.URI)1 URL (java.net.URL)1 HttpConduitWrapper (org.commonjava.indy.httprox.util.HttpConduitWrapper)1 OutputStreamSinkChannel (org.commonjava.indy.httprox.util.OutputStreamSinkChannel)1 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)1