GistLabs / mechanize

mechanize for java
http://gistlabs.com/software/mechanize-for-java/
Mozilla Public License 2.0
78 stars 21 forks source link

Parameters vs Body Content #22

Open jheintz opened 12 years ago

jheintz commented 12 years ago

We need to offer a non-multipart send. (for POST/PUT).

We currently have these post() signatures:

    public Page post(String uri, Map<String, String> params) throws ... {
    public Page post(String uri, Parameters params) {

I suggest adding the following as well:

    public Page post(String uri, Parameters params, byte[] body) {
    public Page post(String uri, Parameters params, InputStream body) {
    public Page post(String uri, Parameters params, File body) {

I anticipate the complexity will be in handling parameters (encoding and content type issues).

See for example this code, particularly the reset multipart data calls: https://github.com/sonatype/async-http-client/blob/master/api/src/main/java/com/ning/http/client/RequestBuilderBase.java#L479

jheintz commented 12 years ago

See http://stackoverflow.com/questions/1067655/how-to-upload-a-file-using-java-httpclient-library-working-with-php-strange-pr for example

jheintz commented 12 years ago

Reference to secure auth and cookies See http://easyerl.blogspot.com/2008/10/secure-cookies-for-your-web-application.html for overview for overview and http://www.cse.msu.edu/~alexliu/publications/Cookie/cookie.pdf for details

(Rails uses this strategy for "remember me")