Search in sources :

Example 1 with TransportProtocolVersionNegotiator

use of org.apache.nifi.remote.client.http.TransportProtocolVersionNegotiator in project nifi by apache.

the class DataTransferResource method initiateServerProtocol.

private HttpFlowFileServerProtocol initiateServerProtocol(final HttpServletRequest req, final Peer peer, final Integer transportProtocolVersion) throws IOException {
    // Switch transaction protocol version based on transport protocol version.
    TransportProtocolVersionNegotiator negotiatedTransportProtocolVersion = new TransportProtocolVersionNegotiator(transportProtocolVersion);
    VersionNegotiator versionNegotiator = new StandardVersionNegotiator(negotiatedTransportProtocolVersion.getTransactionProtocolVersion());
    final String dataTransferUrl = req.getRequestURL().toString();
    ((HttpCommunicationsSession) peer.getCommunicationsSession()).setDataTransferUrl(dataTransferUrl);
    HttpFlowFileServerProtocol serverProtocol = getHttpFlowFileServerProtocol(versionNegotiator);
    HttpRemoteSiteListener.getInstance(nifiProperties).setupServerProtocol(serverProtocol);
    serverProtocol.handshake(peer);
    return serverProtocol;
}
Also used : TransportProtocolVersionNegotiator(org.apache.nifi.remote.client.http.TransportProtocolVersionNegotiator) VersionNegotiator(org.apache.nifi.remote.VersionNegotiator) TransportProtocolVersionNegotiator(org.apache.nifi.remote.client.http.TransportProtocolVersionNegotiator) StandardVersionNegotiator(org.apache.nifi.remote.StandardVersionNegotiator) HttpCommunicationsSession(org.apache.nifi.remote.io.http.HttpCommunicationsSession) StandardHttpFlowFileServerProtocol(org.apache.nifi.remote.protocol.http.StandardHttpFlowFileServerProtocol) HttpFlowFileServerProtocol(org.apache.nifi.remote.protocol.http.HttpFlowFileServerProtocol) StandardVersionNegotiator(org.apache.nifi.remote.StandardVersionNegotiator)

Aggregations

StandardVersionNegotiator (org.apache.nifi.remote.StandardVersionNegotiator)1 VersionNegotiator (org.apache.nifi.remote.VersionNegotiator)1 TransportProtocolVersionNegotiator (org.apache.nifi.remote.client.http.TransportProtocolVersionNegotiator)1 HttpCommunicationsSession (org.apache.nifi.remote.io.http.HttpCommunicationsSession)1 HttpFlowFileServerProtocol (org.apache.nifi.remote.protocol.http.HttpFlowFileServerProtocol)1 StandardHttpFlowFileServerProtocol (org.apache.nifi.remote.protocol.http.StandardHttpFlowFileServerProtocol)1