001 /*
002 * Created on 12-Aug-2005
003 */
004 package org.activemq.transport.https;
005
006 import java.io.IOException;
007 import java.net.HttpURLConnection;
008 import java.net.MalformedURLException;
009
010 import javax.net.ssl.HttpsURLConnection;
011
012 import org.activemq.io.TextWireFormat;
013 import org.activemq.transport.http.HttpTransportChannel;
014 import org.apache.commons.logging.Log;
015 import org.apache.commons.logging.LogFactory;
016
017 public class HttpsTransportChannel extends HttpTransportChannel {
018
019 private static final Log log = LogFactory.getLog( HttpsTransportChannel.class );
020
021 public HttpsTransportChannel( TextWireFormat wireFormat, String remoteUrl ) throws MalformedURLException {
022 super( wireFormat, remoteUrl );
023 }
024
025 protected synchronized HttpURLConnection createSendConnection() throws IOException {
026 HttpsURLConnection conn = (HttpsURLConnection) getRemoteURL().openConnection();
027 conn.setDoOutput( true );
028 conn.setRequestMethod( "POST" );
029 configureConnection( conn );
030 conn.connect();
031 return conn;
032 }
033
034 protected synchronized HttpURLConnection createReceiveConnection() throws IOException {
035 HttpsURLConnection conn = (HttpsURLConnection) getRemoteURL().openConnection();
036 conn.setDoOutput( false );
037 conn.setDoInput( true );
038 conn.setRequestMethod( "GET" );
039 configureConnection( conn );
040 conn.connect();
041 return conn;
042 }
043
044 }