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

http://issues.apache.org/bugzilla/show_bug.cgi?id=29588

Allow polymorphic use of addParameter

           Summary: Allow polymorphic use of addParameter
           Product: Commons
           Version: 2.0 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: HttpClient
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have some common code (in a reverse proxy server) that uses addParameter on 
instances of both PostMethod and MultipartPostMethod

It would be great if either addParameter were made an abstract method on 
ExpectContinueMethod or both were made to implement a common base class. Here's 
my workaround:

    private void addPostParameter(ExpectContinueMethod method, String name, 
String value) {
        if (method instanceof PostMethod) {
            ((PostMethod)method).addParameter(name, value);
        } else if (method instanceof MultipartPostMethod) {
            ((MultipartPostMethod)method).addParameter(name, value);
        } else {
            throw new IllegalArgumentException("addPostParameter is only 
defined for PostMethod and MultipartPostMethod");
        }
        
    }
    // whoa - smells pretty bad

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

Reply via email to