Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpPost.releaseConnection()


                post.setEntity(new UrlEncodedFormEntity(parameters));
                client.execute(post);
            } catch (Exception e) {
                LOGGER.warn("Error posting to HipChat", e);
            } finally {
                post.releaseConnection();
                HttpClientUtils.closeQuietly(client);
            }
        }
    }
   
View Full Code Here


    } catch (ClientProtocolException e) {
      throw new SocialException(e);
    } catch (IOException e) {
      throw new SocialException(e);
    } finally {
      request.releaseConnection();
    }
  }

  /**
   * 获取登录用户的照片列表。
 
View Full Code Here

    } catch (ClientProtocolException e) {
      throw new SocialException(e);
    } catch (IOException e) {
      throw new SocialException(e);
    } finally {
      request.releaseConnection();
    }
  }

  /**
   * 根据微博ID删除指定微博。
 
View Full Code Here

                } else {
                    System.out.println(response.getEntity().getContent());
                    throw new RuntimeException("Callout to Google Charts API failed.");
                }
            } finally {
                post.releaseConnection();
                if (in != null) {
                    in.close();
                }
                if (fw != null) {
                    fw.close();
View Full Code Here

        HttpPost post = obtainPostMethod("/aura", params);
        HttpResponse httpResponse = perform(post);
        int statusCode = getStatusCode(httpResponse);
        String response = getResponseBody(httpResponse);
        post.releaseConnection();

        if (HttpStatus.SC_OK != statusCode) {
            fail(String.format("Unexpected status code <%s>, expected <%s>, response:%n%s", statusCode,
                    HttpStatus.SC_OK, response));
        }
View Full Code Here

        HttpPost post = obtainPostMethod("/aura", params);
        HttpResponse httpResponse = perform(post);
        int statusCode = getStatusCode(httpResponse);
        String response = getResponseBody(httpResponse);
        post.releaseConnection();

        if (HttpStatus.SC_OK != statusCode) {
            fail(String.format("Unexpected status code <%s>, expected <%s>, response:%n%s", statusCode,
                    HttpStatus.SC_OK, response));
        }
View Full Code Here

        HttpPost post = getPostMethod(ctx, true);
        HttpResponse httpResponse = perform(post);                                                        // days
        int statusCode = getStatusCode(httpResponse);
        String response = getResponseBody(httpResponse);
        post.releaseConnection();
        assertTrue("Aura servlet should return 200.", statusCode == HttpStatus.SC_OK);
        assertOutdated(response);
    }

    /**
 
View Full Code Here

        AuraContext ctx = startContext("auratest:test_TokenValidation", ComponentDef.class);
        HttpPost post = getPostMethod(ctx, false);
        HttpResponse httpResponse = perform(post);
        int statusCode = getStatusCode(httpResponse);
        String response = getResponseBody(httpResponse);
        post.releaseConnection();

        if (HttpStatus.SC_OK != statusCode) {
            fail(String.format("Unexpected status code <%s>, expected <%s>, response:%n%s", statusCode,
                    HttpStatus.SC_OK, response));
        }
View Full Code Here

                Aura.getConfigAdapter().getAuraFrameworkNonce()));
        HttpPost post = obtainPostMethod("/aura", params);
        HttpResponse httpResponse = perform(post);
        int statusCode = getStatusCode(httpResponse);
        String response = getResponseBody(httpResponse);
        post.releaseConnection();
        assertNotNull(response);
        if (statusCode != HttpStatus.SC_OK || !response.endsWith("/*ERROR*/")) {
            fail("Should not be able to post to aura servlet without a valid CSRF token");
        }
        if (response.startsWith(AuraBaseServlet.CSRF_PROTECT)) {
View Full Code Here

        params.put("aura.context", "{\"mode\":\"FTEST\"}");
        HttpPost post = obtainPostMethod("/aura", params);
        HttpResponse httpResponse = perform(post);
        int statusCode = getStatusCode(httpResponse);
        EntityUtils.consume(httpResponse.getEntity());
        post.releaseConnection();
        if (statusCode != HttpStatus.SC_NOT_FOUND) {
            fail("Should not be able to post to aura servlet with an invalid CSRF token");
        }
    }
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.