Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/transport/https/HttpsTransportChannel.java


1   /*
2    * Created on 12-Aug-2005
3    */
4   package org.activemq.transport.https;
5   
6   import java.io.IOException;
7   import java.net.HttpURLConnection;
8   import java.net.MalformedURLException;
9   
10  import javax.net.ssl.HttpsURLConnection;
11  
12  import org.activemq.io.TextWireFormat;
13  import org.activemq.transport.http.HttpTransportChannel;
14  import org.apache.commons.logging.Log;
15  import org.apache.commons.logging.LogFactory;
16  
17  public class HttpsTransportChannel extends HttpTransportChannel {
18  
19    private static final Log log = LogFactory.getLog( HttpsTransportChannel.class );
20  
21    public HttpsTransportChannel( TextWireFormat wireFormat, String remoteUrl ) throws MalformedURLException {
22      super( wireFormat, remoteUrl );
23    }
24    
25    protected synchronized HttpURLConnection createSendConnection() throws IOException {
26      HttpsURLConnection conn = (HttpsURLConnection) getRemoteURL().openConnection();
27      conn.setDoOutput( true );
28      conn.setRequestMethod( "POST" );
29      configureConnection( conn );
30      conn.connect();
31      return conn;
32    }
33  
34    protected synchronized HttpURLConnection createReceiveConnection() throws IOException {
35      HttpsURLConnection conn = (HttpsURLConnection) getRemoteURL().openConnection();
36      conn.setDoOutput( false );
37      conn.setDoInput( true );
38      conn.setRequestMethod( "GET" );
39      configureConnection( conn );
40      conn.connect();
41      return conn;
42    }
43    
44  }