Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.URI


        qryStrList = addSelectField(qryStrList, select);
      }

      for (int i=0; i<qryStrList.size(); i++) {
          HttpMessage msg = null;
        URI uri = null;
        String qryStr = (String) qryStrList.elementAt(i);
        if (form.getMethod().equalsIgnoreCase(Form.GET)) {
            String action = (form.getAction().indexOf(QUESTION) <0) ? form.getAction()+QUESTION+qryStr : form.getAction()+AMPERSAND+qryStr;           
          uri = new URI(baseURI, action, true);
          reqHeader = new HttpRequestHeader(form.getMethod().trim().toUpperCase(), uri, HttpHeader.HTTP11);
          msg = new HttpMessage(reqHeader);
        } else if (form.getMethod().equalsIgnoreCase(Form.POST)) {
                   
                    if (!parent.getParent().getSpiderParam().isPostForm()) {
                        continue;
                    }
            uri = new URI(baseURI, form.getAction(), true);
            reqHeader = new HttpRequestHeader(form.getMethod().trim().toUpperCase(), uri, HttpHeader.HTTP11);
            reqBody = new HttpBody(qryStr);
            reqHeader.setContentLength(reqBody.length());
            msg = new HttpMessage(reqHeader, reqBody);
        } else {
View Full Code Here


    {
        HttpMethod httpMethod = mock(HttpMethod.class);
        when(httpMethod.getName()).thenReturn(method);
        when(httpMethod.getStatusLine()).thenReturn(new StatusLine("HTTP/1.1 200 OK"));
        when(httpMethod.getStatusCode()).thenReturn(HttpConstants.SC_OK);
        when(httpMethod.getURI()).thenReturn(new URI("http://localhost/services/Echo", false));
        when(httpMethod.getResponseHeaders()).thenReturn(HEADERS);
        when(httpMethod.getResponseBodyAsStream()).thenReturn(body);
       
        return httpMethod;
    }
View Full Code Here

   
    public void testSetHostViaUri() throws Exception
    {
        HostConfiguration hostConfig = createHostConfiguration();
       
        URI uri = new URI("http://www.mulesoft.org:8080", false);
        hostConfig.setHost(uri);
       
        assertMockSocketFactory(hostConfig);
        assertEquals("www.mulesoft.org", hostConfig.getHost());
        assertEquals(8080, hostConfig.getPort());
View Full Code Here

        {
            protected void doTest() throws Exception
            {
                HostConfiguration hostConfig = createHostConfiguration();
               
                URI uri = new URI("httpx://www.mulesoft.org:8080", false);
                hostConfig.setHost(uri);
               
                assertTrue(hostConfig.getProtocol().getSocketFactory() instanceof DefaultProtocolSocketFactory);
                assertEquals("www.mulesoft.org", hostConfig.getHost());
                assertEquals(8080, hostConfig.getPort());
View Full Code Here

    httpRequest.getProtocol();
    hostConfiguration.getParams().setParameter(
        SoapUIHostConfiguration.SOAPUI_SSL_CONFIG,
        settings.getString( SecurityTabForm.SSLTUNNEL_KEYSTOREPATH, "" ) + " "
            + settings.getString( SecurityTabForm.SSLTUNNEL_KEYSTOREPASSWORD, "" ) );
    hostConfiguration.setHost( new URI( this.prot + sslEndPoint, true ) );

    hostConfiguration = ProxyUtils.initProxySettings( settings, httpState, hostConfiguration, prot + sslEndPoint,
        new DefaultPropertyExpansionContext( project ) );

    if( sslEndPoint.indexOf( "/" ) < 0 )
View Full Code Here

      {
        url.append( "?" + httpRequest.getQueryString() );
        method.setPath( httpRequest.getServletPath() + "?" + httpRequest.getQueryString() );
      }
    }
    hostConfiguration.setHost( new URI( url.toString(), true ) );

    // SoapUI.log("PROXY to:" + url);

    monitor.fireBeforeProxy( request, response, method, hostConfiguration );
View Full Code Here

    strURL = PropertyExpander.expandProperties( context, strURL );
    try
    {
      if( StringUtils.hasContent( strURL ) )
      {
        URI uri = new URI( strURL, request.getSettings().getBoolean( HttpSettings.ENCODED_URLS ) );
        context.setProperty( BaseHttpRequestTransport.REQUEST_URI, uri );
        httpMethod.setURI( uri );
      }
    }
    catch( Exception e )
View Full Code Here

    {
      try
      {
        // URI(String) automatically URLencodes the input, so we need to
        // decode it first...
        URI uri = new URI( path, false );
        context.setProperty( BaseHttpRequestTransport.REQUEST_URI, uri );
        httpMethod.setURI( uri );
      }
      catch( Exception e )
      {
        e.printStackTrace();
      }
    }
    else if( StringUtils.hasContent( path ) )
    {
      try
      {
        // URI(String) automatically URLencodes the input, so we need to
        // decode it first...
        URI uri = new URI( path, false );
        httpMethod.setPath( uri.toString() );
      }
      catch( Exception e )
      {
        e.printStackTrace();
        httpMethod.setPath( path );
View Full Code Here

  }

  public void filterRequest( SubmitContext context, Request wsdlRequest )
  {
    HttpMethod httpMethod = ( HttpMethod )context.getProperty( BaseHttpRequestTransport.HTTP_METHOD );
    URI uri = ( URI )context.getProperty( BaseHttpRequestTransport.REQUEST_URI );
    if( uri == null )
    {
      try
      {
        uri = httpMethod.getURI();
      }
      catch( URIException e )
      {
        SoapUI.logError( e,
            "Error for path: " + httpMethod.getPath() + ", QueryString: " + httpMethod.getQueryString() );
        return;
      }
    }

    EndpointDefaults def = defaults.get( uri.toString() );

    if( def == null )
    {
      synchronized( defaults )
      {
        for( String ep : defaults.keySet() )
        {
          try
          {
            URL tempUri = new URL( PropertyExpander.expandProperties( context, ep ) );
            if( tempUri.toString().equals( uri.toString() ) )
            {
              def = defaults.get( ep );
              break;
            }
          }
View Full Code Here

      // dump file?
      httpMethod.setDumpFile( PathUtils.expandPath( httpRequest.getDumpFile(),
          ( AbstractWsdlModelItem<?> )httpRequest, submitContext ) );

      // fix absolute URIs due to peculiarity in httpclient
      URI uri = ( URI )submitContext.getProperty( BaseHttpRequestTransport.REQUEST_URI );
      if( uri != null && uri.isAbsoluteURI() )
      {
        hostConfiguration.setHost( uri.getHost(), uri.getPort() );
        String str = uri.toString();
        int ix = str.indexOf( '/', str.indexOf( "//" ) + 2 );
        if( ix != -1 )
        {
          uri = new URI( str.substring( ix ), true );
          String qs = httpMethod.getQueryString();
          httpMethod.setURI( uri );
          if( StringUtils.hasContent( qs ) )
            httpMethod.setQueryString( qs );
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.