Any body have experience ,please help me.
Using java Syntax Highlighting
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- import org.apache.commons.httpclient.HostConfiguration;
- import org.apache.commons.httpclient.HttpConnection;
- import org.apache.commons.httpclient.HttpConnectionManager;
- import org.apache.commons.httpclient.HttpState;
- import org.apache.commons.httpclient.HttpURL;
- import org.apache.commons.httpclient.SimpleHttpConnectionManager;
- import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
- import org.apache.commons.httpclient.methods.PostMethod;
- import org.apache.commons.httpclient.methods.RequestEntity;
- /**
- * Connection using apache HttpComponent
- */
- public class AndroidServiceConnection implements ServiceConnection {
- private static HttpConnectionManager connectionManager = new SimpleHttpConnectionManager();
- private HttpConnection connection;
- private PostMethod postMethod;
- private java.io.ByteArrayOutputStream bufferStream = null;
- /**
- * Constructor taking the url to the endpoint for this soap communication
- * @param url the url to open the connection to.
- */
- public AndroidServiceConnection(String url) throws IOException {
- HttpURL httpURL = new HttpURL(url);
- HostConfiguration host = new HostConfiguration();
- host.setHost(httpURL.getHost(), httpURL.getPort());
- connection = connectionManager.getConnection(host);
- postMethod = new PostMethod(url);
- }
- public void connect() throws IOException {
- if (!connection.isOpen()) {
- connection.open();
- }
- }
- public void disconnect() {
- connection.releaseConnection();
- }
- public void setRequestProperty(String name, String value) {
- postMethod.setRequestHeader(name, value);
- }
- public InputStream openInputStream() throws IOException {
- RequestEntity re = new ByteArrayRequestEntity(bufferStream.toByteArray());
- postMethod.setRequestEntity(re);
- postMethod.execute(new HttpState(), connection);
- return postMethod.getResponseBodyAsStream();
- }
- public InputStream getErrorStream() {
- return null;
- }
- }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4
list of classes need changed:
- Code: Select all
HttpConnectionManager
SimpleHttpConnectionManager()
HttpConnection
PostMethod
HttpURL
HostConfiguration
RequestEntity
ByteArrayRequestEntity
Please help me convert to SDK 1.0 all these classes or give me a reference.
thanks a lot.




