Android Open Source - TumblifeForAndroid T L Browser






From Project

Back to project page TumblifeForAndroid.

License

The source code is released under:

GNU General Public License

If you think the Android project TumblifeForAndroid 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 jp.mitukiii.tumblife.util;
//from   w w w.j av  a  2 s  . c o m
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class TLBrowser
{
  protected String cookie;

  public HttpURLConnection request(String _url, String method, Map<String, String> parameters, Map<String, String> headers)
    throws MalformedURLException, IOException
  {
    HttpURLConnection con = null;

    headers.put("Cookie", cookie);

    con = TLConnection.request(_url, method, parameters, headers);

    Map<String, List<String>> _headers = con.getHeaderFields(); 
    List<String> cookieValues = _headers.get("set-cookie");
    if (cookieValues != null) {
      cookie = null;
      Iterator<String> iterator = cookieValues.iterator();
      while (iterator.hasNext()) {
        String cookieValue = iterator.next();
        if (cookie == null) {
          cookie = cookieValue;
        } else {
          cookie += ";" + cookieValue;
        }
      }
    }

    return con;
  }

  public HttpURLConnection request(String _url, String method, Map<String, String> parameters)
    throws MalformedURLException, IOException
  {
    return request(_url, method, parameters, new HashMap<String, String>());
  }

  public HttpURLConnection request(String _url, String method)
    throws MalformedURLException, IOException
  {
    return request(_url, method, new HashMap<String, String>(), new HashMap<String, String>());
  }

  public HttpURLConnection post(String _url, Map<String, String> parameters, Map<String, String> headers)
    throws MalformedURLException, IOException
  {
    return request(_url, TLConnection.POST, parameters, headers);
  }

  public HttpURLConnection post(String _url, Map<String, String> parameters)
    throws MalformedURLException, IOException
  {
    return request(_url, TLConnection.POST, parameters, new HashMap<String, String>());
  }

  public HttpURLConnection post(String _url)
    throws MalformedURLException, IOException
  {
    return request(_url, TLConnection.POST, new HashMap<String, String>(), new HashMap<String, String>());
  }

  public HttpURLConnection get(String _url, Map<String, String> parameters, Map<String, String> headers)
    throws MalformedURLException, IOException
  {
    return request(_url, TLConnection.GET, parameters, headers);
  }

  public HttpURLConnection get(String _url, Map<String, String> parameters)
    throws MalformedURLException, IOException
  {
    return request(_url, TLConnection.GET, parameters, new HashMap<String, String>());
  }

  public HttpURLConnection get(String _url)
    throws MalformedURLException, IOException
  {
    return request(_url, TLConnection.GET, new HashMap<String, String>(), new HashMap<String, String>());
  }
}




Java Source Code List

jp.mitukiii.tumblife.App.java
jp.mitukiii.tumblife.HardkeySetting.java
jp.mitukiii.tumblife.KeyCodeMap.java
jp.mitukiii.tumblife.Main.java
jp.mitukiii.tumblife.Setting.java
jp.mitukiii.tumblife.exeption.TLAuthenticationFailureException.java
jp.mitukiii.tumblife.exeption.TLFailureException.java
jp.mitukiii.tumblife.exeption.TLParserException.java
jp.mitukiii.tumblife.exeption.TLSDCardNotFoundException.java
jp.mitukiii.tumblife.model.TLModel.java
jp.mitukiii.tumblife.model.TLPost.java
jp.mitukiii.tumblife.model.TLSetting.java
jp.mitukiii.tumblife.model.TLTumblelog.java
jp.mitukiii.tumblife.model.TLUser.java
jp.mitukiii.tumblife.parser.TLParser.java
jp.mitukiii.tumblife.parser.TLPostParser.java
jp.mitukiii.tumblife.parser.TLUserParser.java
jp.mitukiii.tumblife.tumblr.TLDashboardDelegate.java
jp.mitukiii.tumblife.tumblr.TLDashboardInterface.java
jp.mitukiii.tumblife.tumblr.TLDashboard.java
jp.mitukiii.tumblife.ui.TLWebViewClientDelegate.java
jp.mitukiii.tumblife.ui.TLWebViewClient.java
jp.mitukiii.tumblife.util.TLBrowser.java
jp.mitukiii.tumblife.util.TLConnection.java
jp.mitukiii.tumblife.util.TLExplorer.java
jp.mitukiii.tumblife.util.TLLog.java
jp.mitukiii.tumblife.util.TLPostFactory.java