Code example for HttpRequest

Methods: addHeader, x 1

0
		editor.putString(PASSWORD_KEY, password);
		editor.commit();
	} 
	 
	public static void gzipify(HttpRequest request) {
		request.setHeader("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13");
		request.addHeader("Accept-Encoding", "gzip");
	} 
	 
	public static InputStream ungzip(HttpResponse response) {
		try { 
			InputStream instream = response.getEntity().getContent();
			Header contentEncoding = response.getFirstHeader("Content-Encoding");
			 
			if (contentEncoding != null && contentEncoding.getValue().equalsIgnoreCase("gzip")) {
			    instream = new GZIPInputStream(instream);
			} 
			return instream;
		} catch (Exception e) {
			if (e instanceof RuntimeException) {
Stop searching for code, let great code find you!  Add Codota to your java IDE