Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.URI


        this.pathFactory = pathFactory;
        this.qValueFactory = qValueFactory;
        this.itemInfoCacheSize = itemInfoCacheSize;

        try {
            URI repositoryUri = new URI((uri.endsWith("/")) ? uri : uri+"/", true);
            hostConfig = new HostConfiguration();
            hostConfig.setHost(repositoryUri);

            nsCache = new NamespaceCache();
            uriResolver = new URIResolverImpl(repositoryUri, this, DomUtil.createDocument());
View Full Code Here


      HttpException {
    JsonArray docsJson;
    GetMethod getMethod = new GetMethod();
    HttpClient httpClient = new HttpClient();
    try {
      getMethod.setURI(new URI(solrQuery, false));
      int statusCode = httpClient.executeMethod(getMethod);
      docsJson = function.apply(new InputStreamReader(getMethod.getResponseBodyAsStream()));
      if (statusCode != HttpStatus.SC_OK) {
        LOG.warning("Failed to execute query: " + solrQuery);
        throw new IOException("Search request status is not OK: " + statusCode);
View Full Code Here

  private void sendRequestToDeleteSolrIndex() {
    GetMethod getMethod = new GetMethod();
    try {
      getMethod
      .setURI(new URI(solrBaseUrl + "/update?wt=json"
          + "&stream.body=<delete><query>" + SolrSearchProviderImpl.Q + "</query></delete>",
          false));

      HttpClient httpClient = new HttpClient();
      int statusCode = httpClient.executeMethod(getMethod);
      if (statusCode == HttpStatus.SC_OK) {
        getMethod.setURI(new URI(solrBaseUrl + "/update?wt=json"
            + "&stream.body=<commit/>", false));

        httpClient = new HttpClient();
        statusCode = httpClient.executeMethod(getMethod);
        if (statusCode != HttpStatus.SC_OK) {
View Full Code Here

        }

        //
        HostConfiguration hc = new HostConfiguration();
        try {
            hc.setHost(new URI(url));
        } catch(URIException e) {
            throw new RuntimeException(e.toString());
        }

        //start a session with the webserver
View Full Code Here

        if ( sWikiUser != null && sWikiPass != null && xContext != null )
        {
            HostConfiguration aNewHostConfig = new HostConfiguration();

            URI aURI = new URI( aMainURL.toString() + "index.php?title=Special:Userlogin" );
            GetMethod aGetCookie = new GetMethod( aURI.getEscapedPathQuery() );

            ExecuteMethod( aGetCookie, aNewHostConfig, aURI, xContext, true );

            int nResultCode = aGetCookie.getStatusCode();
            aGetCookie.releaseConnection();
           
            if ( nResultCode == 200 )
            {
                PostMethod aPost = new PostMethod();
                URI aPostURI = new URI( aMainURL.getPath() + "index.php?title=Special:Userlogin&action=submitlogin" );
                aPost.setPath( aPostURI.getEscapedPathQuery() );

                aPost.addParameter( "wpName", sWikiUser );
                aPost.addParameter( "wpRemember", "1" );
                aPost.addParameter( "wpPassword", sWikiPass );
                String[][] pArgs = GetSpecialArgs( xContext, aMainURL.getHost() );
View Full Code Here

      // creating a special configuration that allows connections to non-trusted HTTPS hosts
      // see the javadoc to EasySSLProtocolSocketFactory for details
      Protocol easyHttps = new Protocol("https", (ProtocolSocketFactory)new EasySSLProtocolSocketFactory(), 443);
      HostConfiguration hc = new HostConfiguration();
      hc.setHost(host, 443, easyHttps);
      String relativeUri = new URI(uri.getPathQuery(), false).getURI();
      // it is important to use relative URI here, otherwise our custom protocol won't work.
      // we have to recreate the method, because HttpMethod#setUri won't overwrite the host,
      // and changing host by hands (HttpMethodBase#setHostConfiguration) is deprecated.
      HttpMethod method = methodCreator.convert(relativeUri);
      client.executeMethod(hc, method);
View Full Code Here

      try {
        StringBuilder sb = new StringBuilder();
        sb.append("http://");
        sb.append(cluster.lastHost);
        sb.append(path);
        URI uri = new URI(sb.toString());
        return executeURI(method, headers, uri.toString());
      } catch (IOException e) {
        lastException = e;
      }
    } while (++i != start && i < cluster.nodes.size());
    throw lastException;
View Full Code Here

   * @throws IOException
   */
  @SuppressWarnings("deprecation")
  public int executeURI(HttpMethod method, Header[] headers, String uri)
      throws IOException {
    method.setURI(new URI(uri));
    if (headers != null) {
      for (Header header: headers) {
        method.addRequestHeader(header);
      }
    }
View Full Code Here

        this.pathFactory = pathFactory;
        this.qValueFactory = qValueFactory;
        this.itemInfoCacheSize = itemInfoCacheSize;

        try {
            URI repositoryUri = new URI((uri.endsWith("/")) ? uri : uri+"/", true);
            hostConfig = new HostConfiguration();
            hostConfig.setHost(repositoryUri);

            nsCache = new NamespaceCache();
            uriResolver = new URIResolverImpl(repositoryUri, this, DomUtil.createDocument());
View Full Code Here

    protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws MessagingException {
        PostMethod method = new PostMethod(url);
        try {
            marshaler.fromNMS(method, exchange, in);
            if (url != null) {
                hostConfiguration.setHost(new URI(url, false));
            }
            int response = httpClient.executeMethod(hostConfiguration, method);

            if (response != HttpStatus.SC_OK) {
                throw new InvalidStatusResponseException(response);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.URI

Copyright © 2018 www.massapicom. 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.