Package org.apache.commons.httpclient

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


   {
      HttpMethodBase request = new GetMethod(HttpUtils.getBaseURL() + spec);
      client.executeMethod(request);

      String responseBody = request.getResponseBodyAsString();
      request.releaseConnection();
      return responseBody;
   }

   public static Test suite() throws Exception
   {
View Full Code Here


         public void performReleaseConnection()
         {
            try
            {
               httpMethod.releaseConnection();
            }
            catch (Exception ignored)
            {}
            try
            {
View Full Code Here

            err.setSampleLabel("Error: " + url.toString());
            return err;
        } finally {
            savedClient = null;
            if (httpMethod != null) {
                httpMethod.releaseConnection();
            }
        }
    }
   
    /**
 
View Full Code Here

                }
            } else {
                throw new ReviewboardException(RbCoreMessages.getString("ERROR_SERVER_NOT_CONFIFIGURED_0"));
            }
        } finally {
            loginRequest.releaseConnection();
            monitor.done();
        }
    }

    private String getCookie(IProgressMonitor monitor) throws ReviewboardException {
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

            // Follow redirects and download page resources if appropriate:
            res = resultProcessing(areFollowingRedirect, frameDepth, res);

            log.debug("End : sample");
            httpMethod.releaseConnection();
            return res;
        } catch (IllegalArgumentException e)// e.g. some kinds of invalid URL
        {
            res.sampleEnd();
            HTTPSampleResult err = errorResult(e, res);
View Full Code Here

            err.setSampleLabel("Error: " + url.toString());
            return err;
        } finally {
            JOrphanUtils.closeQuietly(instream);
            if (httpMethod != null) {
                httpMethod.releaseConnection();
            }
        }
    }

    private HttpMethodBase createHttpMethod(String method, String urlStr) {
View Full Code Here

                LOGGER.fine("Requesting " + m.getURI());
                int r = hc.executeMethod(m);
                if (r/100==3) {
                    // redirect?
                    String loc = m.getResponseHeader("Location").getValue();
                    m.releaseConnection();
                    m = new GetMethod(loc);
                    continue;
                }
                if (r!=200)
                    throw new IOException("Failed to request " + m.getURI() +" exit code="+r);
View Full Code Here

                    throw new IOException("Failed to request " + m.getURI() +" exit code="+r);

                if (m.getURI().getHost().equals("login.oracle.com")) {
                    LOGGER.fine("Appears to be a login page");
                    String resp = IOUtils.toString(m.getResponseBodyAsStream(), m.getResponseCharSet());
                    m.releaseConnection();
                    Matcher pm = Pattern.compile("<form .*?action=\"([^\"]*)\" .*?</form>", Pattern.DOTALL).matcher(resp);
                    if (!pm.find())
                        throw new IllegalStateException("Unable to find a form in the response:\n"+resp);

                    String form = pm.group();
View Full Code Here

                        tmp.delete();
                    }
                }
            }
        } finally {
            m.releaseConnection();
        }
    }

    private static String extractAttribute(String s, String name) {
        String h = name + "=\"";
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.