Package org.apache.commons.httpclient.methods

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


            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


            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

            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

    * @param path the request path
    * @return an OptionsMethod object
    */
   public static OptionsMethod createOptionsMethod(String path)
   {
      return new OptionsMethod(generateURL(path));
   }
View Full Code Here

   @Test
   public void testOptions() throws Exception
   {
      HttpClient client = new HttpClient();
      {
         OptionsMethod method = createOptionsMethod("/options");
         try
         {
            int status = client.executeMethod(method);
            Assert.assertEquals(status, HttpResponseCodes.SC_OK);
            Header[] headers = method.getResponseHeaders("Allow");
            Assert.assertNotNull(headers);
            Assert.assertEquals(headers[0].getValue(), "GET, POST");
         }
         catch (IOException e)
         {
View Full Code Here

   @Test
   public void testDefaultOptions() throws Exception
   {
      HttpClient client = new HttpClient();
      {
         OptionsMethod method = createOptionsMethod("/stuff");
         try
         {
            int status = client.executeMethod(method);
            Assert.assertEquals(status, HttpResponseCodes.SC_OK);
            Header[] headers = method.getResponseHeaders("Allow");
            Assert.assertNotNull(headers);
            String value = headers[0].getValue();
            HashSet<String> vals = new HashSet<String>();
            for (String v : value.split(","))
               vals.add(v.trim());
View Full Code Here

    */
   @Test
   public void testOptions() throws Exception
   {
      HttpClient client = new HttpClient();
      OptionsMethod method = new OptionsMethod(TestPortProvider.generateURL("/GetTest/sub"));
      int status = client.executeMethod(method);
      Assert.assertEquals(200, status);
      Header allowHeader = method.getResponseHeader("Allow");
      Assert.assertNotNull(allowHeader);
      String allowValue = allowHeader.getValue();
      String[] allowed = allowValue.split(",");
      HashSet set = new HashSet();
      for (String allow : allowed)
View Full Code Here

            } else if (method.equals(HEAD)){
                httpMethod = new HeadMethod(urlStr);
            } else if (method.equals(TRACE)){
                httpMethod = new TraceMethod(urlStr);
            } else if (method.equals(OPTIONS)){
                httpMethod = new OptionsMethod(urlStr);
            } else if (method.equals(DELETE)){
                httpMethod = new DeleteMethod(urlStr);
            } else if (method.equals(GET)){
                httpMethod = new GetMethod(urlStr);
            } else {
View Full Code Here

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

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

        try {
            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 " + getPort()
               + " supports OPTIONS properly)",
               methodsAllowed.hasMoreElements());
View Full Code Here

    public void testMethodsHead() {

        HttpClient client = createHttpClient();

        OptionsMethod opmethod = new OptionsMethod("/");

        try {
            client.executeMethod(opmethod);
        } catch (Throwable t) {
            t.printStackTrace();
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.