Android Open Source - Swinedroid Web Transport






From Project

Back to project page Swinedroid.

License

The source code is released under:

GNU General Public License

If you think the Android project Swinedroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.legind.web.WebTransport;
/* w ww  .j a  v  a2 s .c  om*/
import java.net.MalformedURLException;
import java.net.URL;

public class WebTransport{
  private String rHost;
  private int rPort;
  private boolean rSsl;
  /* INFO: Don't allow changing socket specifications if rLocked is true */
  private boolean rLocked;

  /** Initialize the WebTransport object
   * @param urlString the url string for the WebTransport
   * @throws WebTransportException - If the protocol is not http or https
   * @throws MalformedURLException - If the URL is malformed. */
  public WebTransport(String urlString) throws WebTransportException, MalformedURLException{
    URL url = new URL(urlString);
    InitializeWebTransport(url);
  }

  /** Initialize the WebTransport object
   * @param url the url object for the WebTransport
   * @throws WebTransportException - If the protocol is not http or https */
  public WebTransport(URL url) throws WebTransportException{
    InitializeWebTransport(url);
  }

  /** Helper method for the WebTransport constructor */
  private void InitializeWebTransport(URL url) throws WebTransportException{
    if(url.getProtocol().equalsIgnoreCase("http")){
      rSsl = false;
    } else if(url.getProtocol().toUpperCase().equalsIgnoreCase("https")) {
      rSsl = true;
    } else {
      throw new WebTransportException("Invalid protocol type: " + url.getProtocol());
    }
    rHost = url.getHost();
    rPort = url.getPort();
  }
  
  /** Create a new WebTransportConnection and return it
   * @return WebTransportConnection */
  public WebTransportConnection getConnection(){
    WebTransportConnection webtransportconnection = new WebTransportConnection(this);
    return webtransportconnection;
  }
  
  public boolean getLocked(){
    return rLocked;
  }
  
  protected void setLocked(boolean locked){
    rLocked = locked;
  }
  
  public String getHost(){
    return rHost;
  }
  
  public void setHost(String host){
    if(!rLocked)
      rHost = host;
  }
  
  public int getPort(){
    return rPort;
  }
  
  public void setPort(int port){
    if(!rLocked)
      rPort = port;
  }
  
  public boolean getSsl(){
    return rSsl;
  }
  
  public void setSsl(boolean ssl){
    if(!rLocked)
      rSsl = ssl;
  }
}




Java Source Code List

com.legind.Dialogs.ErrorMessageHandler.java
com.legind.Dialogs.MessageHandler.java
com.legind.sqlite.AlertDbAdapter.java
com.legind.sqlite.DbAdapter.java
com.legind.sqlite.ServerDbAdapter.java
com.legind.ssl.CertificateInspect.CertificateInspect.java
com.legind.ssl.SSLHandler.SSLHandler.java
com.legind.ssl.TrustManagerFactory.TrustManagerFactory.java
com.legind.swinedroid.AlertList.java
com.legind.swinedroid.AlertSearch.java
com.legind.swinedroid.AlertView.java
com.legind.swinedroid.ServerEdit.java
com.legind.swinedroid.ServerHashDialog.java
com.legind.swinedroid.ServerView.java
com.legind.swinedroid.Swinedroid.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnableBindRequires.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnableManager.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnableRequires.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnableUniqueRequires.java
com.legind.swinedroid.NetworkRunnable.NetworkRunnable.java
com.legind.swinedroid.RequestService.RequestElement.java
com.legind.swinedroid.RequestService.Request.java
com.legind.swinedroid.xml.AlertListXMLElement.java
com.legind.swinedroid.xml.AlertListXMLHandler.java
com.legind.swinedroid.xml.AlertXMLElement.java
com.legind.swinedroid.xml.AlertXMLHandler.java
com.legind.swinedroid.xml.OverviewXMLElement.java
com.legind.swinedroid.xml.OverviewXMLHandler.java
com.legind.swinedroid.xml.XMLHandlerException.java
com.legind.swinedroid.xml.XMLHandler.java
com.legind.web.WebTransport.WebTransportConnection.java
com.legind.web.WebTransport.WebTransportException.java
com.legind.web.WebTransport.WebTransport.java
org.achartengine.chartlib.AbstractChart.java
org.achartengine.chartlib.AlertChart.java