Not sure if this will help, but I hope so. This is code I found in an
application my research group is working on, and it is under apache v2
license.

Thanks,
Hamy


                Log.v(LOG_LABEL, LOG_MSG_PREFIX + "Entering
HTTPPoster.doAccidentPost");
                final HttpClient c = new DefaultHttpClient();
                final HttpPost post = new HttpPost(SERVER + PATH);
                post.addHeader("Content-Type", 
"application/x-www-form-urlencoded");

                StringBuffer params = new StringBuffer();

                // Create the parameter string
                params.append("type=accident&user="+androidid+"&time="+ timeStr
+"&speed="+speedStr+"&dec="+decStr+"&lat="
                                + lat + "&lon="+lon);


                // Add the parameters
                Log
                                .v(LOG_LABEL, LOG_MSG_PREFIX + "Created 
parameter string: "
                                                + params);
                post.setEntity(new 
ByteArrayEntity(params.toString().getBytes()));

                // Do it
                Log.i(LOG_LABEL, LOG_MSG_PREFIX + "Executing post to " + SERVER 
+
PATH);
                Log.d(LOG_LABEL, LOG_MSG_PREFIX + "Spawning thread for HTTP 
post");
                new Thread(new Runnable() {

                        public void run() {
                                HttpResponse resp = null;
                                try {
                                        resp = c.execute(post);
                                        ByteArrayOutputStream bao = new 
ByteArrayOutputStream();
                                        resp.getEntity().writeTo(bao);
                                        Log.d(LOG_LABEL, LOG_MSG_PREFIX + 
"Response from server: "
                                                        + new 
String(bao.toByteArray()));
                                } catch (ClientProtocolException e) {
                                        Log.e(LOG_LABEL, LOG_MSG_PREFIX
                                                        + 
"ClientProtocolException executing post: "
                                                        + e.getMessage());
                                } catch (IOException e) {
                                        Log.e(LOG_LABEL, LOG_MSG_PREFIX
                                                        + "IOException writing 
to ByteArrayOutputStream: "
                                                        + e.getMessage());
                                } catch (Exception e) {
                                        Log.e(LOG_LABEL, LOG_MSG_PREFIX
                                                        + "Other Exception of 
type:" + e.getClass());
                                        Log.e(LOG_LABEL, LOG_MSG_PREFIX + "The 
message is: "
                                                        + e.getMessage());
                                }

                                if (resp != null && 
resp.getStatusLine().getStatusCode() == 200) {
                                        okRun.run();
                                }
                        }

                }).start();
                Log.d(LOG_LABEL, LOG_MSG_PREFIX + "Thread for HTTP post 
started");


On Jun 19, 10:34 am, psaltamontes <[email protected]> wrote:
> Do you know/think if this option will be in the future?
>
> Now, I'm trying to do something with a webview and webviewclient. But
> I don't know how to send a "RAW HTTP request" using these classes.
>
> I can send/receive RAW HTTP with sockets, but I don't know how to link
> these sockets with the webview.
>
> Any idea?
>
> Thanks.
>
> On 19 jun, 17:14, "Mark Murphy" <[email protected]> wrote:
>
> > > Yes, I want to say request :), sorry , I need improve my English.
>
> > > I don't want my application modify the settings of the browser, the
> > > idea is that the user configure the proxy of the browser and install
> > > my application. This application is a service that listen the HTTP
> > > requests and send to the Internet.
>
> > Hmmm...I do not see where users can set their proxy server, either.
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to