commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/jelly HttpTag.java
Date Fri, 12 Jul 2002 04:24:19 GMT
dion        2002/07/11 21:24:19

  Modified:    latka/src/java/org/apache/commons/latka/jelly HttpTag.java
  Log:
  Use strict mode if defined, and add the user agent defined on the session tag if available
and not specified locally
  
  Revision  Changes    Path
  1.14      +15 -4     jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/HttpTag.java
  
  Index: HttpTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/HttpTag.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HttpTag.java	9 Jul 2002 17:43:02 -0000	1.13
  +++ HttpTag.java	12 Jul 2002 04:24:19 -0000	1.14
  @@ -99,6 +99,8 @@
       private List _parameters;
       /** list of headers as name value pairs */
       private List _requestHeaders;
  +    /** the header name for the user agent */
  +    private static final String HEADER_NAME_USER_AGENT = "User-Agent";
       
       /**
        * Creates a new instance of HttpTag
  @@ -161,7 +163,16 @@
           // find the multi client and use it to execute the method
           SessionTag sessionTag = (SessionTag) findAncestorWithClass(
               SessionTag.class);
  +        // add the default user agent to the list
  +        if (urlMethod.getRequestHeader(HttpTag.HEADER_NAME_USER_AGENT) 
  +            == null) {
  +            if (sessionTag.getUserAgent() != null) {
  +                urlMethod.addRequestHeader(HttpTag.HEADER_NAME_USER_AGENT, 
  +                    sessionTag.getUserAgent());
  +            }
  +        }
           HttpMultiClient client = sessionTag.getHttpClient();
  +        client.setStrictMode(sessionTag.isStrictMode());
           long start = System.currentTimeMillis();
           client.executeMethod(urlMethod);
           long end = System.currentTimeMillis();
  
  
  

--
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