DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23562>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23562

getHeaderManager()/setHeaderManager() on HTTPSampler from within preprocessor is broken

           Summary: getHeaderManager()/setHeaderManager() on HTTPSampler
                    from within preprocessor is broken
           Product: JMeter
           Version: 1.9.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: HTTP
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Original post to list:

I have written a pre-processor that modifies headers on an HTTPSampler (I need 
to do this because the header is dynamically derived), but the call 
getHeaderManager() on the HTTPSampler object always returns null.  Even if I 
have actually created a HeaderManager in the test configuration.  Creating a 
new HeaderManager object and programmatically calling setHeaderManager on the 
HTTPSampler object in my preprocessor doesn't do anything either.  Is there a 
way to dynamically modify outgoing request headers?

----

<code>
public void process() {
   ...
 
   Header header = new Header("Authorization", authstring);
   HeaderManager manager = sampler.getHeaderManager();
   if (manager != null) {
     manager.add(header);
   } else {
     log.error("No header manager configured for sampler: " + sampler);
     manager = new HeaderManager();
     manager.add(header);
     sampler.setHeaderManager(manager);
     System.out.println("manager size: " + manager.size());
     for (int i = 0; i < manager.size(); i++) {
       System.out.println("header: " + manager.get(i));
     }
     System.out.println("manager: " + sampler.getHeaderManager());
   }
</code>

----

 I moved the manager.add(header) call up above 
sampler.setHeaderManager() to ensure that the manager being set in fact 
has at least one header already in it.  The manager object subsequently 
retrieved is indeed the same object (object hashcode) that was set (I 
checked just for sanity).  But the header is still not coming through.  

----

Posting this as a bug as I have not had time to look further into it myself, 
and it should be noted.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to