Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpGet.abort()


                } catch (RuntimeException ex) {

                    // In case of an unexpected exception you may want to abort
                    // the HTTP request in order to shut down the underlying
                    // connection and release it back to the connection manager.
                    httpget.abort();
                    throw ex;

                } finally {

                    // Closing the input stream will trigger connection release
View Full Code Here


            try {
                System.out.println("----------------------------------------");
                System.out.println(response.getStatusLine());
                // Do not feel like reading the response body
                // Call abort on the request object
                httpget.abort();
            } finally {
                response.close();
            }
        } finally {
            httpclient.close();
View Full Code Here

    try {
      httpClient.execute(httpGet, context);
      this.successCount++;
    } catch (Exception e) {
      this.abortCount++;
      httpGet.abort();
    }
    Thread.yield();
  }
 
  public int getSuccessCount() {
View Full Code Here

             } catch (RuntimeException ex) {
        
                 // In case of an unexpected exception you may want to abort
                 // the HTTP request in order to shut down the underlying
                 // connection and release it back to the connection manager.
                 httpget.abort();
                 throw ex;
                
             } finally {
        
                 // Closing the input stream will trigger connection release
View Full Code Here

                } catch (RuntimeException ex) {

                    // In case of an unexpected exception you may want to abort
                    // the HTTP request in order to shut down the underlying
                    // connection and release it back to the connection manager.
                    httpget.abort();
                    throw ex;

                } finally {

                    // Closing the input stream will trigger connection release
View Full Code Here

          }
        }
        finally
        {
          // Consumes and closes the stream, releasing the connection
          method.abort();
        }

      }
      catch (Throwable e)
      {
View Full Code Here

 
  public void abort(String address) {
    if(address == null || address.trim().length() == 0) return;
    if(!currentGets.containsKey(address)) return;
    HttpGet httpGet = currentGets.remove(address);
    if(httpGet != null) httpGet.abort();
  }

  public byte[] loadContent(String referer, String address) throws Exception {
    URLEncoder urlEncoder = new URLEncoder();
   
View Full Code Here

          }
        }
        finally
        {
          // Consumes and closes the stream, releasing the connection
          method.abort();
        }

      }
      catch (Throwable e)
      {
View Full Code Here

        throw new Exception("API http error; expected "+Integer.toString(expectedResponse)+", saw "+Integer.toString(responseCode)+": "+responseString);
      return responseString;
    }
    finally
    {
      method.abort();
    }
  }

  /** Perform an json API DELETE operation.
  *@param apiURL is the operation.
View Full Code Here

            } catch (RuntimeException ex) {

                // In case of an unexpected exception you may want to abort
                // the HTTP request in order to shut down the underlying
                // connection and release it back to the connection manager.
                httpget.abort();
                throw ex;
               
            } finally {

                // Closing the input stream will trigger connection release
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.