I am trying to execute plain vanilla login form with two text fields:
'firstname, lastname'...
I am using jetty dump info servlet which echoes request content and
enumerate all form parameters...
'HttpPost' doesn't contain any 'form parameters' handling as HttpClient3
so I concluded that I have to use some kind of 'HttpEntity'... something
like...

HttpPost request = new HttpPost("/test/dump/info");
HttpEntity requestBody =
StringEntity("firstname=cici+bella&lastname=ciccio+bello", "UTF-8");
request.setEntity(requestBody);
...execute(request, connection);

I made various attempts but nothing worked... After that I made grep in
the HttpCore4 for "application/x-www-form-urlencoded" string and there
is nothing there... After that I made dummy FormEntity which set
ContentType field and contains hard coded request params and everything
worked...

Is there some support for this kind of requests in HttpCore4 and if not
what are my alternatives ?
Maybe I can contribute some code wit your assistance ?

import java.io.*;

import org.apache.http.entity.*;

public class FormEntity extends AbstractHttpEntity {
    private String content = "firstname=cici+bella&lastname=ciccio+bello";

    public FormEntity () {
        setContentType("application/x-www-form-urlencoded");
    }

    public InputStream getContent () throws IOException, IllegalStateException {
        return new ByteArrayInputStream(content.getBytes());
    }

    public long getContentLength () {
        return content.length();
    }

    public boolean isRepeatable () {
        return true;
    }

    public boolean isStreaming () {
        return false;
    }

    public void writeTo (OutputStream outstream) throws IOException {
        outstream.write(content.getBytes());
    }
}

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

Reply via email to