當前位置: 首頁>>代碼示例>>Java>>正文


Java InputStreamEntity.setChunked方法代碼示例

本文整理匯總了Java中org.apache.http.entity.InputStreamEntity.setChunked方法的典型用法代碼示例。如果您正苦於以下問題:Java InputStreamEntity.setChunked方法的具體用法?Java InputStreamEntity.setChunked怎麽用?Java InputStreamEntity.setChunked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.http.entity.InputStreamEntity的用法示例。


在下文中一共展示了InputStreamEntity.setChunked方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doUpload

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
private static void doUpload(CloseableHttpClient client, String path) throws IOException {

        String url = String.format(
                "http://%s:%s/%s",
                TestProperties.getProperty("com.guido.host"),
                TestProperties.getProperty("com.guido.port"),
                path
        );

        InputStreamEntity requestEntity = new InputStreamEntity(
                new FileInputStream(BIG_XML_FILE_PATH), -1,
                ContentType.APPLICATION_OCTET_STREAM);

        // set chunked transfer encoding ie. no Content-length
        requestEntity.setChunked(true);

        HttpPost httpPost = new HttpPost((url));
        httpPost.setEntity(requestEntity);
        HttpResponse response = client.execute(httpPost);

        assertThat(response.getStatusLine().getStatusCode(), equalTo(HttpStatus.SC_OK));

    }
 
開發者ID:guido-n,項目名稱:mule-useful-experiments,代碼行數:24,代碼來源:Tests.java

示例2: doInBackground

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
protected String doInBackground(String... urls) {
    String url = "";
    File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"/audiorecordtest.3gp");
    try {
        HttpClient httpclient = new DefaultHttpClient();

        HttpPost httppost = new HttpPost(new URI(url));

        InputStreamEntity reqEntity = new InputStreamEntity(
                new FileInputStream(file), -1);
        reqEntity.setContentType("binary/octet-stream");
        reqEntity.setChunked(true); // Send in multiple parts if needed
        httppost.setEntity(reqEntity);
        HttpResponse response = httpclient.execute(httppost);
        return response.toString();

    } catch (Exception e) {
        return e.getMessage().toString();
    }
}
 
開發者ID:Nyceane,項目名稱:HackathonPADLS,代碼行數:21,代碼來源:TriggerActivity.java

示例3: addImage

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
public static int addImage(String baseUrl, String imagePlantId, String filePath) {
	File file = new File(filePath);
	try {
		HttpClient client = getClient();

	    String url = baseUrl + imagePlantId + "/images";
	    HttpPost httppost = new HttpPost(url);
	    InputStreamEntity reqEntity = new InputStreamEntity(new FileInputStream(file), -1);
	    reqEntity.setContentType("binary/octet-stream");
	    reqEntity.setChunked(true);
	    httppost.setEntity(reqEntity);
	    HttpResponse response = client.execute(httppost);
	    return response.getStatusLine().getStatusCode();
	}
	catch (Exception e) {
		return -1;
	}
}
 
開發者ID:jayxue,項目名稱:ImageS3Android,代碼行數:19,代碼來源:ImageS3Service.java

示例4: storeObject

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
/**
 * Store a file on the server, including metadata, with the contents coming from an input stream.  This allows you to
 * not know the entire length of your content when you start to write it.  Nor do you have to hold it entirely in memory
 * at the same time.
 *
 * @param region      The name of the storage region
 * @param container   The name of the container
 * @param data        Any object that implements InputStream
 * @param contentType The MIME type of the file
 * @param name        The name of the file on the server
 * @param metadata    A map with the metadata as key names and values as the metadata values
 * @return the file ETAG if response code is 201
 * @throws GenericException Unexpected response
 */
public String storeObject(Region region, String container, InputStream data, String contentType, String name, Map<String, String> metadata) throws IOException {
    HttpPut method = new HttpPut(region.getStorageUrl(container, name));
    InputStreamEntity entity = new InputStreamEntity(data, -1);
    entity.setChunked(true);
    entity.setContentType(contentType);
    method.setEntity(entity);
    for(Map.Entry<String, String> key : this.renameObjectMetadata(metadata).entrySet()) {
        method.setHeader(key.getKey(), key.getValue());
    }
    Response response = this.execute(method, new DefaultResponseHandler());
    if(response.getStatusCode() == HttpStatus.SC_CREATED) {
        return response.getResponseHeader(HttpHeaders.ETAG).getValue();
    }
    else {
        throw new GenericException(response);
    }
}
 
開發者ID:iterate-ch,項目名稱:java-openstack-swift,代碼行數:32,代碼來源:Client.java

示例5: main

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    if (args.length != 1)  {
        System.out.println("File path not given");
        System.exit(1);
    }
    CloseableHttpClient httpclient = HttpClients.createDefault();
    try {
        HttpPost httppost = new HttpPost("http://httpbin.org/post");

        File file = new File(args[0]);

        InputStreamEntity reqEntity = new InputStreamEntity(
                new FileInputStream(file), -1, ContentType.APPLICATION_OCTET_STREAM);
        reqEntity.setChunked(true);
        // It may be more appropriate to use FileEntity class in this particular
        // instance but we are using a more generic InputStreamEntity to demonstrate
        // the capability to stream out data from any arbitrary source
        //
        // FileEntity entity = new FileEntity(file, "binary/octet-stream");

        httppost.setEntity(reqEntity);

        System.out.println("Executing request: " + httppost.getRequestLine());
        CloseableHttpResponse response = httpclient.execute(httppost);
        try {
            System.out.println("----------------------------------------");
            System.out.println(response.getStatusLine());
            System.out.println(EntityUtils.toString(response.getEntity()));
        } finally {
            response.close();
        }
    } finally {
        httpclient.close();
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:36,代碼來源:ClientChunkEncodedPost.java

示例6: httpPost

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
public static void httpPost(String serverUrl, InputStream dataStream, String type) throws ClientProtocolException, IOException, Exception  {
	DefaultHttpClient httpclient = new DefaultHttpClient();
	HttpPost httppost = new HttpPost(serverUrl);

	URL url = new URL(serverUrl);
	String userInfo = url.getUserInfo();
	if( userInfo != null ) {
		httppost.addHeader("Authorization", "Basic " + Base64.encodeToString(userInfo.getBytes(), Base64.NO_WRAP));
	}
	if (type == null) {
		type = "binary/octet-stream";
	}

	InputStreamEntity requestEntity = new InputStreamEntity(dataStream,-1);
	requestEntity.setContentType(type);
	requestEntity.setChunked(true);
	httppost.setEntity(requestEntity);

	HttpResponse response = httpclient.execute(httppost);
	response.getEntity().getContent().close();
	httpclient.getConnectionManager().shutdown();

	int status = response.getStatusLine().getStatusCode();
	if ( status < 200 || status > 299 ) {
		throw new Exception(response.getStatusLine().toString());
	}
}
 
開發者ID:matgoebl,項目名稱:Send2URL,代碼行數:28,代碼來源:SendActivity.java

示例7: main

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    if (args.length != 1)  {
        System.out.println("File path not given");
        System.exit(1);
    }
    CloseableHttpClient httpclient = HttpClients.createDefault();
    try {
        HttpPost httppost = new HttpPost("http://localhost/");

        File file = new File(args[0]);

        InputStreamEntity reqEntity = new InputStreamEntity(
                new FileInputStream(file), -1, ContentType.APPLICATION_OCTET_STREAM);
        reqEntity.setChunked(true);
        // It may be more appropriate to use FileEntity class in this particular
        // instance but we are using a more generic InputStreamEntity to demonstrate
        // the capability to stream out data from any arbitrary source
        //
        // FileEntity entity = new FileEntity(file, "binary/octet-stream");

        httppost.setEntity(reqEntity);

        System.out.println("Executing request: " + httppost.getRequestLine());
        CloseableHttpResponse response = httpclient.execute(httppost);
        try {
            System.out.println("----------------------------------------");
            System.out.println(response.getStatusLine());
            EntityUtils.consume(response.getEntity());
        } finally {
            response.close();
        }
    } finally {
        httpclient.close();
    }
}
 
開發者ID:DrInventor,項目名稱:Analogy-and-Assessment,代碼行數:36,代碼來源:ClientChunkEncodedPost.java

示例8: chunkedUploadRequest

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
/**
 * Creates a request that can upload a single chunk of data to the server via the
 * chunked upload protocol. This request reads the InputStream and advances it by
 * an amount equal to the number of bytes uploaded. For most users, the {@link ChunkedUploader}
 * object provides an easier interface to use and should provide most of the
 * functionality needed. If offset is 0 and uploadId is null, a new chunked upload is
 * created on the server.
 *
 * @param is A stream containing the data to be uploaded.
 * @param length The number of bytes to upload.
 * @param listener A ProgressListener (can be {@code null}) that will be notified of upload
 *                 progress.  The progress will be for this individual file chunk (starting
 *                 at zero bytes and ending at {@code length} bytes).
 * @param offset The offset into the file that the contents of the these bytes belongs to.
 * @param uploadId The unique ID identifying this upload to the server.
 * @return A ChunkedUploadRequest which can be used to upload a single chunk of data to Dropbox.
 */

public ChunkedUploadRequest chunkedUploadRequest(InputStream is, long length,
                                                 ProgressListener listener,
                                                 long offset, String uploadId) {
    String[] params;
    if (offset == 0) {
        params = new String[0];
    } else {
        params = new String[]{"upload_id", uploadId, "offset", ""+offset};
    }
    String url = RESTUtility.buildURL(session.getContentServer(), VERSION, "/chunked_upload/", params);
    HttpPut req = new HttpPut(url);
    session.sign(req);

    InputStreamEntity ise = new InputStreamEntity(is, length);
    ise.setContentEncoding("application/octet-stream");
    ise.setChunked(false);
    HttpEntity entity = ise;

    if (listener != null) {
        entity = new ProgressHttpEntity(entity, listener);
    }
    req.setEntity(entity);

    return new ChunkedUploadRequest(req, session);
}
 
開發者ID:timezra,項目名稱:dropbox-java-sdk,代碼行數:44,代碼來源:DropboxAPI.java

示例9: createSLOManifestObject

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
/**
 * Create a Static Large Object manifest on the server, including metadata
 *
 * @param region      The name of the storage region
 * @param container   The name of the container
 * @param contentType The MIME type of the file
 * @param name        The name of the file on the server
 * @param manifest    Set manifest content here (A JSON string describing the large object contents)
 *                    Should be an ordered list of maps with the following keys for each object segment:
 *                    - "path" the path (including container) to the object segment
 *                    - "size_bytes" the size in byes of the segment
 *                    - "etag" the etag of the segment
 * @param metadata    A map with the metadata as key names and values as the metadata values
 * @return True if response code is 201
 * @throws GenericException Unexpected response
 */
public String createSLOManifestObject(Region region, String container, String contentType, String name, String manifest, Map<String, String> metadata) throws IOException {
    String manifestEtag;
    URIBuilder urlBuild = new URIBuilder(region.getStorageUrl(container, name));
    urlBuild.setParameter("multipart-manifest", "put");
    URI url;
    try {
        url = urlBuild.build();
        InputStreamEntity manifestEntity = new InputStreamEntity(new ByteArrayInputStream(manifest.getBytes()), -1);
        manifestEntity.setChunked(true);
        manifestEntity.setContentType(contentType);
        HttpPut method = new HttpPut(url);
        method.setEntity(manifestEntity);
        for(Map.Entry<String, String> key : this.renameObjectMetadata(metadata).entrySet()) {
            method.setHeader(key.getKey(), key.getValue());
        }
        method.setHeader(Constants.X_STATIC_LARGE_OBJECT, "true");
        Response response = this.execute(method, new DefaultResponseHandler());
        if(response.getStatusCode() == HttpStatus.SC_CREATED) {
            manifestEtag = response.getResponseHeader(HttpHeaders.ETAG).getValue();
        }
        else {
            throw new GenericException(response);
        }
    }
    catch(URISyntaxException ex) {
        throw new GenericException("URI Building failed when creating Static Large Object manifest", ex);
    }
    return manifestEtag;
}
 
開發者ID:iterate-ch,項目名稱:java-openstack-swift,代碼行數:46,代碼來源:Client.java

示例10: OpenHttpConnection

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
private synchronized void OpenHttpConnection() throws IOException {
  // Let know that the connection is open
  if (!openConnection.get()) {
    final PipedInputStream in = new PipedInputStream();
    pipOutStream.connect(in);

    Callable<Integer> connectionTask = new Callable<Integer>() {
      @Override
      public Integer call() throws Exception {
        LOG.info("Invoke HTTP Put request");

        int responseCode;
        String reasonPhrase;

        InputStreamEntity entity = new InputStreamEntity(in, -1);
        entity.setChunked(true);
        entity.setContentType(contentType);
        request.setEntity(entity);

        LOG.info("HTTP PUT request {}", mUrl.toString());

        openConnection.set(true);
        try (CloseableHttpResponse response = client.execute(request)) {
          responseCode = response.getStatusLine().getStatusCode();
          reasonPhrase = response.getStatusLine().getReasonPhrase();
        }
        LOG.info("HTTP PUT response {}. Response code {}", mUrl.toString(), responseCode);
        if (responseCode == HTTP_UNAUTHORIZED) { // Unauthorized error
          mAccount.authenticate();
          request.removeHeaders("X-Auth-Token");
          request.addHeader("X-Auth-Token", mAccount.getAuthToken());
          LOG.warn("Token recreated for {}.  Retry request", mUrl.toString());
          try (CloseableHttpResponse response = client.execute(request)) {
            responseCode = response.getStatusLine().getStatusCode();
            reasonPhrase = response.getStatusLine().getReasonPhrase();
          }
        }
        if (responseCode >= HTTP_BAD_REQUEST) { // Code may have changed from retrying
          throw new IOException("HTTP Error: " + responseCode + " Reason: " + reasonPhrase);
        }
        return responseCode;
      }
    };
    futureTask = executor.submit(connectionTask);
    do {
      // Wait till the connection is open and the task isn't done
    } while (!openConnection.get() && !futureTask.isDone());
  }
}
 
開發者ID:SparkTC,項目名稱:stocator,代碼行數:50,代碼來源:SwiftOutputStream.java

示例11: main

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    if (args.length != 1)  {
        System.out.println("File path not given");
        System.exit(1);
    }
    HttpClient httpclient = new DefaultHttpClient();

    HttpPost httppost = new HttpPost("http://localhost:8080" +
            "/servlets-examples/servlet/RequestInfoExample");

    File file = new File(args[0]);

    InputStreamEntity reqEntity = new InputStreamEntity(
            new FileInputStream(file), -1);
    reqEntity.setContentType("binary/octet-stream");
    reqEntity.setChunked(true);
    // It may be more appropriate to use FileEntity class in this particular 
    // instance but we are using a more generic InputStreamEntity to demonstrate
    // the capability to stream out data from any arbitrary source
    // 
    // FileEntity entity = new FileEntity(file, "binary/octet-stream"); 
    
    httppost.setEntity(reqEntity);
    
    System.out.println("executing request " + httppost.getRequestLine());
    HttpResponse response = httpclient.execute(httppost);
    HttpEntity resEntity = response.getEntity();

    System.out.println("----------------------------------------");
    System.out.println(response.getStatusLine());
    if (resEntity != null) {
        System.out.println("Response content length: " + resEntity.getContentLength());
        System.out.println("Chunked?: " + resEntity.isChunked());
    }
    if (resEntity != null) {
        resEntity.consumeContent();
    }

    // When HttpClient instance is no longer needed, 
    // shut down the connection manager to ensure
    // immediate deallocation of all system resources
    httpclient.getConnectionManager().shutdown();        
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:44,代碼來源:ClientChunkEncodedPost.java

示例12: storeStreamedObject

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
/**
 * Store a file on the server, including metadata, with the contents coming
 * from an input stream. This allows you to not know the entire length of
 * your content when you start to write it. Nor do you have to hold it
 * entirely in memory at the same time.
 *
 * @param container The name of the container
 * @param data Any object that implements InputStream
 * @param contentType The MIME type of the file
 * @param name The name of the file on the server
 * @param metadata A map with the metadata as key names and values as the
 * metadata values
 * @param callback The object to which any callbacks will be sent (null if
 * you don't want callbacks)
 * @throws IOException There was an IO error doing network communication
 * @throws HttpException There was an error with the http protocol
 * @throws FilesException
 */
public String storeStreamedObject(String container, InputStream data,
        String contentType, String name, Map<String, String> metadata)
        throws IOException, HttpException, FilesException {
    if (this.isLoggedin()) {
        String objName = name;
        if (isValidContainerName(container) && isValidObjectName(objName)) {
            HttpPut method = new HttpPut(storageURL + "/"
                    + sanitizeForURI(container) + "/"
                    + sanitizeForURI(objName));
            method.getParams().setIntParameter("http.socket.timeout",
                    connectionTimeOut);
            method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
            InputStreamEntity entity = new InputStreamEntity(data, -1);
            entity.setChunked(true);
            entity.setContentType(contentType);
            method.setEntity(entity);
            for (String key : metadata.keySet()) {
                // logger.warn("Key:" + key + ":" +
                // sanitizeForURI(metadata.get(key)));
                method.setHeader(FilesConstants.X_OBJECT_META + key,
                        sanitizeForURI(metadata.get(key)));
            }
            method.removeHeaders("Content-Length");

            try {
                FilesResponse response = new FilesResponse(
                        client.execute(method));

                if (response.getStatusCode() == HttpStatus.SC_CREATED) {
                    return response.getResponseHeader(FilesConstants.E_TAG)
                            .getValue();
                } else {
                    logger.error(response.getStatusLine());
                    throw new FilesException("Unexpected result",
                            response.getResponseHeaders(),
                            response.getStatusLine());
                }
            } finally {
                method.abort();
            }
        } else {
            if (!isValidObjectName(objName)) {
                throw new FilesInvalidNameException(objName);
            } else {
                throw new FilesInvalidNameException(container);
            }
        }
    } else {
        throw new FilesAuthorizationException("You must be logged in",
                null, null);
    }
}
 
開發者ID:stacksync,項目名稱:java-cloudfiles,代碼行數:71,代碼來源:FilesClient.java

示例13: testPutFile

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
public void testPutFile() {
	String AUTH_URL = getAUTHURL();
        	    	  
    FilesClient client = new FilesClient(getUSER1(), "testpass");
    client.setAuthenticationURL(AUTH_URL);
       client.setConnectionTimeOut(CONNECTION_TIMEOUT);

	try {
		client.login();			
					
		HttpPut method = null;
		try {
			LinkedList<NameValuePair> parameters = new LinkedList<NameValuePair>();
			parameters.add(new BasicNameValuePair("prefix", getFile()));				
			
			String uri = makeURI(client.getStorageURL() + "/" + getContainer() + "/files", parameters);
			method = new HttpPut(uri);
			method.getParams().setIntParameter("http.socket.timeout",CONNECTION_TIMEOUT);
			method.setHeader(FilesConstants.X_AUTH_TOKEN, client.getAuthToken());				
			method.setHeader("stacksync-api", "true");
			
			File file = new File("/home/gguerrero/java0.log");						
			InputStream data = new FileInputStream(file);
			
			InputStreamEntity entity = new InputStreamEntity(data, -1);
			entity.setChunked(true);				
			method.setEntity(entity);
							
			FilesResponse response = new FilesResponse(client.getClientHTTP().execute(method));

			String text = convertStreamToString(response.getResponseBodyAsStream());
			if (response.getStatusCode() == HttpStatus.SC_OK || response.getStatusCode() == HttpStatus.SC_CREATED || response.getStatusCode() == HttpStatus.SC_ACCEPTED) {										
				System.out.println("testPutFile --> Ok -> " + text);
			}else{
				System.out.println("testPutFile --> Error -> " + text);
			}
		} finally {
			if (method != null)
				method.abort();
		}			
								
	} catch (Exception e){
		e.printStackTrace();
	}
       		
	assertTrue(true);
}
 
開發者ID:stacksync,項目名稱:java-cloudfiles,代碼行數:48,代碼來源:FilesClientTestCaseNewApi.java

示例14: main

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    if (args.length != 1)  {
        System.out.println("File path not given");
        System.exit(1);
    }
    HttpClient httpclient = new DefaultHttpClient();
    try {
        HttpPost httppost = new HttpPost("http://localhost:8080" +
                "/servlets-examples/servlet/RequestInfoExample");

        File file = new File(args[0]);

        InputStreamEntity reqEntity = new InputStreamEntity(
                new FileInputStream(file), -1);
        reqEntity.setContentType("binary/octet-stream");
        reqEntity.setChunked(true);
        // It may be more appropriate to use FileEntity class in this particular
        // instance but we are using a more generic InputStreamEntity to demonstrate
        // the capability to stream out data from any arbitrary source
        //
        // FileEntity entity = new FileEntity(file, "binary/octet-stream");

        httppost.setEntity(reqEntity);

        System.out.println("executing request " + httppost.getRequestLine());
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity resEntity = response.getEntity();

        System.out.println("----------------------------------------");
        System.out.println(response.getStatusLine());
        if (resEntity != null) {
            System.out.println("Response content length: " + resEntity.getContentLength());
            System.out.println("Chunked?: " + resEntity.isChunked());
        }
        EntityUtils.consume(resEntity);
    } finally {
        // When HttpClient instance is no longer needed,
        // shut down the connection manager to ensure
        // immediate deallocation of all system resources
        httpclient.getConnectionManager().shutdown();
    }
}
 
開發者ID:jswelker,項目名稱:LibraryH3lp-Transfer-Bot,代碼行數:43,代碼來源:ClientChunkEncodedPost.java

示例15: createNewSession

import org.apache.http.entity.InputStreamEntity; //導入方法依賴的package包/類
private static void createNewSession()
{
	String name = newSessionNameTextBox.getText();
	String grid_size = newSessionSizeTextBox.getText();
	System.out.println("New Session Name: " + newSessionNameTextBox.getText());
	closeSessionPopup();

	HttpClient httpclient = new DefaultHttpClient();
	int port = CalicoDataStore.ServerPort;
	try
	{
		HttpPost httppost = new HttpPost("http://" + CalicoDataStore.ServerHost + ":27015/api/sessions");

		String requestParams = "";

		requestParams += "name=" + URLEncoder.encode(name, "utf-8");
		requestParams += "&rows=" + URLEncoder.encode(grid_size, "utf-8");
		requestParams += "&cols=" + URLEncoder.encode(grid_size, "utf-8");

		InputStreamEntity inputEntity = new InputStreamEntity(new ByteArrayInputStream(requestParams.getBytes()), -1);
		inputEntity.setContentType("application/x-www-form-urlencoded");
		inputEntity.setChunked(false);
		httppost.setEntity(inputEntity);

		// System.out.println("executing request " + httpget.getURI());

		// Create a response handler
		ResponseHandler<String> responseHandler = new BasicResponseHandler();
		String responseBody = httpclient.execute(httppost, responseHandler);

		JSONObject sessionObj = new JSONObject(responseBody);
		port = sessionObj.getJSONObject("calico_server").getInt("port");
	}
	catch (Exception e)
	{
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	finally
	{
		// When HttpClient instance is no longer needed,
		// shut down the connection manager to ensure
		// immediate deallocation of all system resources
		httpclient.getConnectionManager().shutdown();
	}
	// reconnect(CalicoDataStore.ServerHost, port);
	showSessionPopup();
}
 
開發者ID:uci-sdcl,項目名稱:Calico,代碼行數:49,代碼來源:Calico.java


注:本文中的org.apache.http.entity.InputStreamEntity.setChunked方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。