Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.OptionsMethod


    public void testMethodsHead() {

        HttpClient client = createHttpClient();

        OptionsMethod opmethod = new OptionsMethod("/");

        try {
            client.executeMethod(opmethod);
        } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here


            break;
         case HEAD:
            request = new HeadMethod(url.toString());
            break;
         case OPTIONS:
            request = new OptionsMethod(url.toString());
            break;
         case PUT:
            request = new PutMethod(url.toString());
            break;
         case DELETE:
View Full Code Here

     * but Tomcat 3.x is not.
     */
    public void testMethodsOptions() {

        HttpClient client = new HttpClient();
        OptionsMethod method = new OptionsMethod("/");

        try {
          client.getHostConfiguration().setHost(host, port, "http");
            client.executeMethod(method);
        } catch (Throwable t) {
            t.printStackTrace();
            fail("Unable to execute method : " + t.toString());
        }

        Enumeration methodsAllowed = method.getAllowedMethods();
        // This enumeration musn't be empty
        assertTrue("No HTTP method allowed : result of OPTIONS is incorrect "
               + "(make sure the webserver running on port " + port
               + " supports OPTIONS properly)",
               methodsAllowed.hasMoreElements());
View Full Code Here

    public void testMethodsHead() {

        HttpClient client = new HttpClient();
      client.getHostConfiguration().setHost(host, port, "http");

        OptionsMethod opmethod = new OptionsMethod("/");

        try {
            client.executeMethod(opmethod);
        } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here

    } else if (method.equalsIgnoreCase("delete")) {
      return new DeleteMethod(uri);
    } else if (method.equalsIgnoreCase("head")) {
      return new HeadMethod(uri);
    } else if (method.equalsIgnoreCase("options")) {
      return new OptionsMethod(uri);
    } else {
      //throw new AuthenticationException("unsupported http method : " + method);
      return new MethodHelper.ExtensionMethod(method,uri);
    }
  }
View Full Code Here

      case DELETE:
        return new DeleteMethod(uri);
      case HEAD:
        return new HeadMethod(uri);
      case OPTIONS:
        return new OptionsMethod(uri);
      case POST:
        return new PostMethod(uri);
      case PUT:
        return new PutMethod(uri);
      case TRACE:
View Full Code Here

            case DELETE:
                method = new DeleteMethod(path);
                break;

            case OPTIONS:
                method = new OptionsMethod(path);
                break;

            case HEAD:
                method = new HeadMethod(path);
                break;
View Full Code Here

        case GET:     httpMethod = new GetMethod(uri); break;
        case POST:    httpMethod = getMethod(new PostMethod(uri), entity); break;
        case PUT:     httpMethod = getMethod(new PutMethod(uri), entity); break;
        case DELETE:  httpMethod = new DeleteMethod(uri); break;
        case HEAD:    httpMethod = new HeadMethod(uri); break;
        case OPTIONS: httpMethod = new OptionsMethod(uri); break;
        case TRACE:   httpMethod = new TraceMethod(uri); break;
        default:      httpMethod = getMethod(new ExtensionMethod(method,uri), entity);
      }
      if (actual != null) {
        httpMethod.addRequestHeader("X-HTTP-Method-Override", actual.name());
View Full Code Here

        {
            writeResponse(context);
        }
        else if (ProxyConstants.METHOD_OPTIONS.equals(method))
        {
            OptionsMethod optionsMethod = (OptionsMethod)httpMethod;
            Enumeration options = optionsMethod.getAllowedMethods();
            if (options != null)
            {
                List ops = new ArrayList();
                while (options.hasMoreElements())
                {
View Full Code Here

            PutMethod putMethod = new PutMethod(encodedPath);
            context.setHttpMethod(putMethod);
        }
        else if (ProxyConstants.METHOD_OPTIONS.equals(method))
        {
            OptionsMethod optionsMethod = new OptionsMethod(encodedPath);
            context.setHttpMethod(optionsMethod);
        }
        else if (ProxyConstants.METHOD_DELETE.equals(method))
        {
            DeleteMethod deleteMethod = new DeleteMethod(encodedPath);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.methods.OptionsMethod

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.