Examples of NameValuePair


Examples of org.apache.commons.httpclient.NameValuePair

         method.releaseConnection();
      }
      {
         GetMethod method = createGetMethod("/locating/queryParam");
         NameValuePair[] params =
                 {new NameValuePair("param", "hello world")};
         method.setQueryString(params);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpServletResponse.SC_OK, status);
         Assert.assertEquals("hello world", method.getResponseBodyAsString());
         method.releaseConnection();
View Full Code Here

Examples of org.apache.commons.httpclient.NameValuePair

      dispatcher.getRegistry().addPerRequestResource(SimpleResource.class);
      HttpClient client = new HttpClient();
      {
         PostMethod method = createPostMethod("/simple");
         NameValuePair[] params =
                 {new NameValuePair("hello", "world")};
         method.setRequestBody(params);
         try
         {
            int status = client.executeMethod(method);
            Assert.assertEquals(status, HttpResponseCodes.SC_OK);
View Full Code Here

Examples of org.apache.commons.httpclient.NameValuePair

   {
      HttpClient client = new HttpClient();
      {
         PostMethod method = createPostMethod("/simple");
         NameValuePair[] params =
                 {new NameValuePair("hello", "world")};
         method.setRequestBody(params);
         try
         {
            int status = client.executeMethod(method);
            Assert.assertEquals(status, HttpResponseCodes.SC_OK);
View Full Code Here

Examples of org.apache.commons.httpclient.NameValuePair

   {
      HttpClient client = new HttpClient();
      {
         PostMethod method = createPostMethod("/form");
         NameValuePair[] params =
                 {new NameValuePair("hello", "world")};
         method.setRequestBody(params);
         try
         {
            int status = client.executeMethod(method);
            Assert.assertEquals(status, HttpResponseCodes.SC_OK);
View Full Code Here

Examples of org.apache.commons.httpclient.NameValuePair

   {
      HttpClient client = new HttpClient();
      {
         PostMethod method = createPostMethod("/form/twoparams");
         NameValuePair[] params =
                 {new NameValuePair("hello", "world"), new NameValuePair("yo", "mama")};
         method.setRequestBody(params);
         try
         {
            int status = client.executeMethod(method);
            Assert.assertEquals(status, HttpResponseCodes.SC_OK);
View Full Code Here

Examples of org.apache.commons.httpclient.NameValuePair

         Assert.assertEquals(204, status);
         method.releaseConnection();
      }
      {
         GetMethod method = new GetMethod("http://localhost:8080/test-war/queryParam");
         NameValuePair[] params = {new NameValuePair("param", "hello world")};
         method.setQueryString(params);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("hello world", method.getResponseBodyAsString());
         method.releaseConnection();
View Full Code Here

Examples of org.apache.commons.httpclient.NameValuePair

         Assert.assertEquals(204, status);
         method.releaseConnection();
      }
      {
         GetMethod method = new GetMethod("http://localhost:8080/test-war/locating/queryParam");
         NameValuePair[] params = {new NameValuePair("param", "hello world")};
         method.setQueryString(params);
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         Assert.assertEquals("hello world", method.getResponseBodyAsString());
         method.releaseConnection();
View Full Code Here

Examples of org.apache.commons.httpclient.NameValuePair

            executeGet(getUriBuilder(PageResource.class).build(getWiki(), TestConstants.TEST_SPACE_NAME,
                TestConstants.TEST_PAGE_NAME).toString());
        Assert.assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());

        NameValuePair[] nameValuePairs = new NameValuePair[1];
        nameValuePairs[0] = new NameValuePair("tags", tagName);

        PostMethod postMethod =
            executePostForm(String.format("%s?method=PUT", getUriBuilder(PageTagsResource.class).build(getWiki(),
                TestConstants.TEST_SPACE_NAME, TestConstants.TEST_PAGE_NAME).toString()), nameValuePairs, "Admin",
                "admin");
View Full Code Here

Examples of org.apache.commons.httpclient.NameValuePair

        Link link = getFirstLinkByRelation(originalPage, Relations.SELF);
        Assert.assertNotNull(link);

        NameValuePair[] nameValuePairs = new NameValuePair[2];
        nameValuePairs[0] = new NameValuePair("title", TITLE);
        nameValuePairs[1] = new NameValuePair("content", CONTENT);

        PostMethod postMethod =
            executePostForm(String.format("%s?method=PUT", link.getHref()), nameValuePairs, "Admin", "admin");
        Assert.assertEquals(getHttpMethodInfo(postMethod), HttpStatus.SC_ACCEPTED, postMethod.getStatusCode());
View Full Code Here

Examples of org.apache.commons.httpclient.NameValuePair

        Comments comments = (Comments) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

        int numberOfComments = comments.getComments().size();

        NameValuePair[] nameValuePairs = new NameValuePair[1];
        nameValuePairs[0] = new NameValuePair("text", "Comment");

        PostMethod postMethod = executePostForm(commentsUri, nameValuePairs, "Admin", "admin");
        Assert.assertEquals(getHttpMethodInfo(postMethod), HttpStatus.SC_CREATED, postMethod.getStatusCode());

        getMethod = executeGet(commentsUri);
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.