You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by bu...@apache.org on 2004/06/16 02:52:43 UTC

DO NOT REPLY [Bug 29588] New: - Allow polymorphic use of addParameter

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: commons-httpclient-dev@jakarta.apache.org
        ReportedBy: rjbodkin@hotmail.com


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: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org