Package org.apache.http.client.methods

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


        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();
        assertEquals("Failed to post to aura servlet", HttpStatus.SC_OK, statusCode);
    }
}
View Full Code Here


            .setContext(getAuraTestingUtil().getContext(Mode.DEV, Format.JSON, app, ApplicationDef.class, false))
            .getPostMethod();
        HttpResponse httpResponse = perform(post);
        int statusCode = getStatusCode(httpResponse);
        String response = getResponseBody(httpResponse);
        post.releaseConnection();
        assertTrue("Failed to reach aura servlet", statusCode == HttpStatus.SC_OK);
        assertFalse("Got error response "+response, response.endsWith("/*ERROR*/"));
        return response;
    }
   
View Full Code Here

            .setContext(newctx)
            .getPostMethod();
        HttpResponse httpResponse = perform(post);
        int statusCode = getStatusCode(httpResponse);
        String response = getResponseBody(httpResponse);
        post.releaseConnection();
        assertTrue("Failed to reach aura servlet", statusCode == HttpStatus.SC_OK);
        assertFalse("Got error response "+response, response.endsWith("/*ERROR*/"));
        return response;
    }
   
View Full Code Here

        HttpResponse response = client.execute(request);
        responseBytes = IOUtils.toByteArray(response.getEntity().getContent());
       
      } finally {
        // release any connection resources used by the method
        request.releaseConnection();
      }
 
      if (responseBytes != null) {
        try {
          ByteArrayInputStream in = new ByteArrayInputStream(responseBytes);
View Full Code Here

    } catch (IOException ioex) {
      throw new SWORDClientException(ioex.getMessage(), ioex);
    } catch (UnmarshallException uex) {
      throw new SWORDClientException(uex.getMessage() + "(<pre>" + messageBody + "</pre>)", uex);
    } finally {
      httppost.releaseConnection();
    }
  }

  /**
   * Read a response from the stream and return it as a string.
View Full Code Here

            YandexSpellerResponse[] variants = mapper.readValue(json, YandexSpellerResponse[].class);
            if (variants.length>0){
                req.setAttribute("variants", variants[0].getS());
            }
        } finally {
            post.releaseConnection();
        }
        final RequestDispatcher rd = getServletContext().getRequestDispatcher("/index.jsp");
        rd.forward(req, resp);
    }
   
View Full Code Here

            .addTextBody("appkey", appKey).addTextBody("timeout", "60");
    request.setEntity(builder.build());
    try {
      HttpResponse response = Http.CLIENT.execute(request);
      String json = IOUtils.toString(response.getEntity().getContent());
      request.releaseConnection();
      JSONObject jsonObject = new JSONObject(json);
      Integer ret = Result.parseInteger(jsonObject.get("ret"));
      if (ret == 0) {
        String url =
            "http://api.yundama.com/api.php?method=result&cid="
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.