Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpMethodBase.releaseConnection()


            res.setResponseMessage(e.getMessage());
            return res;
        } finally {
            JOrphanUtils.closeQuietly(instream);
            if (httpMethod != null) {
                httpMethod.releaseConnection();
                return res;
            }
        }
    }
View Full Code Here


      Streams.copy(method.getResponseBodyAsStream(), response.getOutputStream());
    } catch (IOException e) {
      response.setStatus(HttpServletResponse.SC_BAD_GATEWAY);
      e.printStackTrace(response.getWriter());
    } finally {
      method.releaseConnection();
    }
  }

  private boolean isStatusCodeSuppressed(final HttpServletRequest request) {
    return Iterators.contains(
View Full Code Here

    } catch (Exception ex) {
      _log.error("Failed to request from URL: ["+queryURL+"]", ex);
      return null;
    } finally {
      try {
        httpMethodBase.releaseConnection();
      } catch (Exception ignored) {
      }
    }
  }
}
View Full Code Here

                 * connection left open, we go ahead and release the it to free
                 * up resources.
                 */
                if (!leaveHttpConnectionOpen) {
                    try {method.getResponseBodyAsStream().close();} catch (Throwable t) {}
                    method.releaseConnection();
                }
            }
        }
    }

View Full Code Here

                                             method.getResponseBodyAsString()));
                    fault.addFaultDetail(Constants.QNAME_FAULTDETAIL_HTTPERRORCODE,
                                         Integer.toString(returnCode));
                    throw fault;
                } finally {
                    method.releaseConnection(); // release connection back to pool.
                }
            }
           
            // wrap the response body stream so that close() also releases
            // the connection back to the pool.
View Full Code Here

            }

            // always release the connection back to the pool if
            // it was one way invocation
            if (msgContext.isPropertyTrue("axis.one.way")) {
                method.releaseConnection();
            }
           
        } catch (Exception e) {
            log.debug(e);
            throw AxisFault.makeFault(e);
View Full Code Here

                 * connection left open, we go ahead and release the it to free
                 * up resources.
                 */
                if (!leaveHttpConnectionOpen) {
                    try {method.getResponseBodyAsStream().close();} catch (Throwable t) {}
                    method.releaseConnection();
                }
            }
        }
    }

View Full Code Here

                try {
                    fault.setFaultDetailString(Messages.getMessage("return01",
                    "" + returnCode, method.getResponseBodyAsString()));
                    throw fault;
                } finally {
                    method.releaseConnection(); // release connection back to pool.
                }
            }

            // wrap the response body stream so that close() also releases the connection back to the pool.
            InputStream releaseConnectionOnCloseStream = createConnectionReleasingInputStream(method);
View Full Code Here

        } catch (IllegalArgumentException e) {
            // thrown by HttpClient to indicate the URL is not valid, this happens for instance
            // when trying to download a dynamic version (cfr IVY-390)
        } finally {
            if (method != null) {
                method.releaseConnection();
            }
        }
        return UNAVAILABLE;
    }
View Full Code Here

                 * connection left open, we go ahead and release the it to free
                 * up resources.
                 */
                if (!leaveHttpConnectionOpen) {
                    try {method.getResponseBodyAsStream().close();} catch (Throwable t) {}
                    method.releaseConnection();
                }
            }
        }
    }

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.