1 18 package org.apache.activemq.transport.https; 19 20 import org.apache.activemq.transport.http.HttpTransport; 21 import org.apache.activemq.transport.util.TextWireFormat; 22 23 import javax.net.ssl.HttpsURLConnection; 24 25 import java.io.IOException ; 26 import java.net.HttpURLConnection ; 27 import java.net.MalformedURLException ; 28 import java.net.URI ; 29 30 public class HttpsTransport extends HttpTransport { 31 32 public HttpsTransport(TextWireFormat wireFormat, URI remoteUrl) throws MalformedURLException { 33 super(wireFormat, remoteUrl); 34 } 35 36 protected synchronized HttpURLConnection createSendConnection() throws IOException { 37 HttpsURLConnection conn = (HttpsURLConnection) getRemoteURL().openConnection(); 38 conn.setDoOutput(true); 39 conn.setRequestMethod("POST"); 40 configureConnection(conn); 41 conn.connect(); 42 return conn; 43 } 44 45 protected synchronized HttpURLConnection createReceiveConnection() throws IOException { 46 HttpsURLConnection conn = (HttpsURLConnection) getRemoteURL().openConnection(); 47 conn.setDoOutput(false); 48 conn.setDoInput(true); 49 conn.setRequestMethod("GET"); 50 configureConnection(conn); 51 conn.connect(); 52 return conn; 53 } 54 55 } 56 | Popular Tags |