Chris' Laboratory

chrislee.kr – Personal blog as bookshelves

Menu
  • Home
  • Useful Links
  • Contact Me

Tag: entity-addpart-double

Talking To Web Servers Via HTTP In Android 1.0

By Chris Lee
|
03/01/2011
| No Comments
| Android Development

Original Article:  http://brainflush.wordpress.com/2008/10/17/talking-to-web-servers-via-http-in-android-10/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
HttpClient httpClient = new DefaultHttpClient();
StringBuilder uriBuilder = new StringBuilder(SERVICE_ENDPOINT);
uriBuilder.append("?param0=" + param0);
uriBuilder.append("&param1=" + param1);
uriBuilder.append("&paramN=" + paramN);
HttpGet request = new HttpGet(uriBuilder.toString());
HttpResponse response = httpClient.execute(request);
int status = response.getStatusLine().getStatusCode();
// we assume that the response body contains the error message
if (status != HttpStatus.SC_OK) {
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
response.getEntity().writeTo(ostream);
Log.e("HTTP CLIENT", ostream.toString()));
} else {
InputStream content = response.getEntity().getContent();
// <consume response>
content.close(); // this will also close the connection
}
------
HttpClient httpClient = new DefaultHttpClient();
HttpPost request = new HttpPost(SERVICE_ENDPOINT);
MultipartEntity entity = new MultipartEntity();
entity.addPart("param0", new StringBody("value0"));
entity.addPart("param1", new StringBody(Double.toString(1.0)));
entity.addPart("paramN", new FileBody(new File("/bar/baz")));
request.setEntity(entity);
HttpResponse response = httpClient.execute(request);
int status = response.getStatusLine().getStatusCode();
if (status != HttpStatus.SC_OK) {
// see above
} else {
// see above
}

 

Read More »

Posted in Android Development Tagged -multipartentity, addpart-multipartentity, android-addpart, android-entity-addpart, android-entity-consume-http, android-filebody, android-http-client-output-stream, android-httpclient-outputstream, android-multipartentity-entity, android-multipartentity-entity-addpart, android-multipartentity-form, android-new-multipartentity-defaulthttpclient-addpart, entity-addpart, entity-addpart-double, entity-addpartandroid, httpclient-execute-android-status, multipartentity-addpart, multipartentity-android-filebody, multipartentity-example-android, multipartentity-in-android-aaps Leave a comment

Https returns 404 with DefaultHttpClient on Android?

By Chris Lee
|
03/01/2011
| No Comments
| Android Development

Reference: http://stackoverflow.com/questions/3730760/https-returns-404-with-defaulthttpclient-on-android I have an http request that worked as http://blah.com and now I have been asked to usehttps://blah.com The former works and the later fails with a Network I/O error. Are there any missing parameter settings that I need for the client? Answer Https almost always implies a different port being used (standard http=>80; standard https=>443). […]

Read More »

Posted in Android Development Tagged 1, android-defaulthttpclient, android-defaulthttpclient-404, android-defaulthttpclient-double, android-defaulthttpclient-https, android-defaulthttpclient-multiple, android-defaulthttpclient-multiple-request, android-defaulthttpclient-port, defaulthttpclient, defaulthttpclient-android, defaulthttpclient-android-port, defaulthttpclient-handles-https, defaulthttpclient-https, defaulthttpclient-port, defaulthttpclient-port-8080, entity-addpart-double, how-to-handle-ajax-requests-using-defaulthttpclient, https-request-returns-404, ifresponsepost-getstatusline-getstatuscode-httpstatus-sc_ok, responsepost-getstatusline-getstatuscode-httpstatus-sc_ok Leave a comment

Categories

  • Development (130)
    • Adobe Flex Development (1)
    • Android Development (20)
    • Arduino (2)
    • Django (2)
    • Docker (3)
    • Google App Engine (5)
    • iPhone Development (13)
    • MS SQL (1)
    • Raspberry Pi (4)
    • Samsung Smart TV (4)
    • SVN Related (9)
    • Web Development (67)
      • Angular2 (1)
      • Codeigniter (6)
      • CSS (5)
      • Javascript (11)
      • MongoDB (2)
      • PHP (16)
      • Sencha Touch (4)
      • Server Related (9)
      • WordPress (4)
      • Yii2 (2)
  • E-Commerce (8)
    • Magento (8)
  • General Documents (15)
  • Marketing (2)
  • Security (15)
  • Uncategorized (1)
April 2018
M T W T F S S
« Aug    
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Pages

  • Useful Links
  • Contact Me

Search

Recent Comments

  • Chris Lee on How to install memcache.so/memcached.so for MAMP Pro (Mac)
  • Chris Lee on Setting Up A VPN Server On OSX 10.6
  • eddie on How to install memcache.so/memcached.so for MAMP Pro (Mac)
  • Manish on TCPDF-CodeIgniter Integration with TCPDF Examples
  • ComputerUSer on How to mount Bootcamp drive

Recent Posts

  • Setup Gitlab & Jenkins on Raspberry Pi 2
  • Ziroom (즈룸)에 대한 개인적인 생각
  • [따라하기] 아두이노 기초 – 초음파센서 사용하기 by ODIY 한국과학창의재단
  • [따라하기] 아두이노 기초 – LED와 버튼 제어하기 by ODIY 한국과학창의재단
  • Time Clock Management System developed with Yii2 REST API + Angular 2 + Docker

Tags

1 ajax android android-addpart browser chrislee-kr codeigniter codeigniter-tcpdf com-apple-net-racoon CSS CSS history hack entity-addpart-double exception-printing-is-disabled-by-default-for-security-reasons ext-plugins-listpagingplugin ext-plugins-listpagingplugin-example f iphone javascript jquery-defaultchecked jquery-samsung-smart-tv krjavaskript listpagingplugin mac magento-exception-printing-is-disabled-by-default-for-security-reasons magento-sample-data-exception-printing-is-disabled-by-default-for-security-reasons mail-gdimage-com null-core-errors-confignotfound-config-mk9engine-ini php samsung-smart-tv-jquery samsung-smart-tv-sdk-ajax samsung-smart-tv-sdk-jquery samsung-tv-sdk samsung-tv-sdk-jquery samsung tv sencha-smart-tv sencha-touch-list-paging smart-tv-jquery sqlite subversion svn tcedook tcpdf-codeigniter uilinebreakmodecharacterwrap-is-deprecated uitextalignmentcenter-deprecated unknown-column-link-area

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Chris' Laboratory 2018 | All Rights Reserved. Powered by WordPress