commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeri...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestWebappRedirect.java
Date Sat, 26 Oct 2002 15:38:18 GMT
jericho     2002/10/26 08:38:18

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpMethodBase.java
               httpclient/src/java/org/apache/commons/httpclient/methods
                        PostMethod.java
               httpclient/src/test/org/apache/commons/httpclient
                        TestWebappRedirect.java
  Log:
  - Apply the name-changed method in URIUtil for clearness
    (from encodeInQuery to encodeWithinQuery)
  
  Revision  Changes    Path
  1.73      +11 -10    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- HttpMethodBase.java	25 Oct 2002 10:15:51 -0000	1.72
  +++ HttpMethodBase.java	26 Oct 2002 15:38:18 -0000	1.73
  @@ -379,8 +379,8 @@
       /**
        * Sets the query string.
        * The user must ensure that the string is properly URL encoded.
  -     * URIUtil.encodeAll, URIUtil.encodeInQuery or URIUtil.encodeQuery can be
  -     * used to encode parameter names and values.
  +     * URIUtil.encodeAll, URIUtil.encodeWithinQuery or URIUtil.encodeQuery can
  +     * be used to encode parameter names and values.
        * The query string should not start with the question mark character.
        * 
        * @param queryString the query string
  @@ -408,18 +408,19 @@
                   }
                   String queryName = null;
                   try {
  -                    queryName = URIUtil.encodeInQuery(params[i].getName());
  +                    queryName = URIUtil.encodeWithinQuery(params[i].getName());
                   } catch (URIException urie) {
  -                    log.error("URI query name encoding error", urie);
  +                    log.error("encoding error within query name", urie);
                       queryName = params[i].getName();
                   }
                   buf.append(queryName).append("=");
                   if (params[i].getValue() != null) {
                       String queryValue = null;
                       try {
  -                        queryValue = URIUtil.encodeInQuery(params[i].getValue());
  +                        queryValue =
  +                            URIUtil.encodeWithinQuery(params[i].getValue());
                       } catch (URIException urie) {
  -                        log.error("URI query value encoding error", urie);
  +                        log.error("encoding error within query value", urie);
                           queryValue = params[i].getValue();
                       }
                       buf.append(queryValue);
  
  
  
  1.25      +7 -7      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/PostMethod.java
  
  Index: PostMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/PostMethod.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- PostMethod.java	25 Oct 2002 12:46:58 -0000	1.24
  +++ PostMethod.java	26 Oct 2002 15:38:18 -0000	1.25
  @@ -769,17 +769,17 @@
   
               String queryName = null;
               try {
  -                queryName = URIUtil.encodeInQuery(parameter.getName());
  +                queryName = URIUtil.encodeWithinQuery(parameter.getName());
               } catch (URIException urie) {
  -                log.error("URI query name encoding error", urie);
  +                log.error("encoding error within query name", urie);
                   queryName = parameter.getName();
               }
               buff.append(queryName).append("=");
               String queryValue = null;
               try {
  -                queryValue = URIUtil.encodeInQuery(parameter.getValue());
  +                queryValue = URIUtil.encodeWithinQuery(parameter.getValue());
               } catch (URIException urie) {
  -                log.error("URI query value encoding error", urie);
  +                log.error("encoding error within query value", urie);
                   queryValue = parameter.getValue();
               }
               buff.append(queryValue);
  
  
  
  1.10      +16 -9     jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappRedirect.java
  
  Index: TestWebappRedirect.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestWebappRedirect.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestWebappRedirect.java	23 Oct 2002 01:39:39 -0000	1.9
  +++ TestWebappRedirect.java	26 Oct 2002 15:38:18 -0000	1.10
  @@ -171,9 +171,10 @@
   
           String qs = "http://" + host + ":" + port + "/" + context + "/params?foo=bar&bar=foo";
           for(int i=0;i<2;i++) {
  -            qs = "http://" + host + ":" + port + "/" + context + "/redirect?to=" + URIUtil.encodeInQuery(qs);
  +            qs = "http://" + host + ":" + port + "/" + context +
  +                "/redirect?to=" + URIUtil.encodeWithinQuery(qs);
           }
  -        method.setQueryString("to=" + URIUtil.encodeInQuery(qs));
  +        method.setQueryString("to=" + URIUtil.encodeWithinQuery(qs));
           method.setUseDisk(false);
           try {
               client.executeMethod(method);
  @@ -209,7 +210,9 @@
           HttpClient client = new HttpClient();
           client.startSession(host, port);
           PostMethod method = new PostMethod("/" + context + "/redirect");
  -        method.setQueryString("to=" + URIUtil.encodeInQuery("http://" + host + ":" + port
+ "/" + context + "/params?foo=bar&bar=foo"));
  +        method.setQueryString("to=" + URIUtil.encodeWithinQuery("http://" +
  +                    host + ":" + port + "/" + context +
  +                    "/params?foo=bar&bar=foo"));
           method.setRequestBody(new ByteArrayInputStream(body.getBytes()));
           method.setRequestContentLength(body.length());  //unbuffered request
           method.setFollowRedirects(true);
  @@ -224,7 +227,9 @@
           assertEquals(HttpStatus.SC_MOVED_TEMPORARILY,method.getStatusCode());
   
           method = new PostMethod("/" + context + "/redirect");
  -        method.setQueryString("to=" + URIUtil.encodeInQuery("http://" + host + ":" + port
+ "/" + context + "/params?foo=bar&bar=foo"));
  +        method.setQueryString("to=" + URIUtil.encodeWithinQuery("http://" +
  +                    host + ":" + port + "/" + context +
  +                    "/params?foo=bar&bar=foo"));
           method.setRequestBody(new ByteArrayInputStream(body.getBytes()));
           method.setRequestContentLength(PostMethod.CONTENT_LENGTH_AUTO); //buffered request
           method.setFollowRedirects(true);
  @@ -244,7 +249,9 @@
           HttpClient client = new HttpClient();
           client.startSession(host, port);
           PutMethod method = new PutMethod("/" + context + "/redirect");
  -        method.setQueryString("to=" + URIUtil.encodeInQuery("http://" + host + ":" + port
+ "/" + context + "/body?foo=bar&bar=foo"));
  +        method.setQueryString("to=" + URIUtil.encodeWithinQuery("http://" +
  +                    host + ":" + port + "/" + context +
  +                    "/body?foo=bar&bar=foo"));
           method.setRequestBody("This is data to be sent in the body of an HTTP PUT.");
           try {
               client.executeMethod(method);
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message