hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalnichevski, Oleg" <oleg.kalnichev...@bearingpoint.com>
Subject RE: New method in PutMethod/HttpRequestBodyMethodBase
Date Thu, 19 Dec 2002 10:31:15 GMT
Juergen

I have already expressed my opinion a few days ago that PutMethod is in a dire need of a complete
overhaul. Currently PutMethod and PostMethod even though having significant commonalities
are not even API compatible.

This is how this problem is solved in the PostMethod

   public void setRequestBody(String body) {
        log.trace("enter PostMethod.setRequestBody(String)");

        byte[] tmp = null;
        try {
            tmp = body.getBytes(getRequestCharSet());
        } catch(UnsupportedEncodingException e) {
            if (log.isWarnEnabled()) {
                log.warn("Unsupported request body charset: " + e.getMessage());
            }
            tmp = body.getBytes();
        }
        this.requestBody = new ByteArrayInputStream(tmp);
    }

I suggest that PutMethod behaviour be consistent with that of the PostMethod class. Ideally
both PutMethod and PostMethod should be derived from a common super-class

Oleg


-----Original Message-----
From: Pill, Juergen [mailto:Juergen.Pill@softwareag.com]
Sent: Thursday, December 19, 2002 11:18 AM
To: 'Commons HttpClient Project'
Subject: New method in PutMethod/HttpRequestBodyMethodBase


Hello,

I want to suggest a new method within PutMethod/ HttpRequestBodyMethodBase
and possibly deprecate the method setRequestBody(String)



    /**
     * Set my request body content to the contents of a string with the
given encoding.
     *
     * @since 2.0
     */
    public void setRequestBody(String bodydata, String encoding) throws
java.io.UnsupportedEncodingException {
        checkNotUsed();
        setRequestBody(bodydata.getBytes(encoding));
    }


Best regards,

Juergen



 -----Original Message-----
From: 	Pill, Juergen [mailto:Juergen.Pill@softwareag.com] 
Sent:	Thursday, December 19, 2002 11.13 AM
To:	'Commons HttpClient Project'
Subject:	Seperation of PutMethod

 << File: HttpRequestBodyMethodBase.java >> << File: ATT431386.txt >>
Hello,

I want to suggest the separation of the PutMethod into two classes:

1) the class PutMethod contains all the code it contains now, except the
code of the class HttpRequestBodyMethodBase. 
2) PutMethod inherits from HttpRequestBodyMethodBase, to recive full
functionality.
3) HttpRequestBodyMethodBase is very similar (identical, except package
name) as the attached HttpRequestBodyMethodBase.java

This changes would make the implementation of the Slide WebDAV API layer
easier. Most WebDAV methods accept a body (delivered either as a String,
byte[], File, etc). Currently the class HttpRequestBodyMethodBase in Slide
is a clone of the relevant part of PutMethod within the commons project.



 <<HttpRequestBodyMethodBase.java>> 


Best regards,

Juergen



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


Mime
View raw message