This page (revision-5) was last changed on 16-Dec-2012 22:05 by Albrecht Striffler

This page was created on 16-Dec-2012 21:57 by Albrecht Striffler

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
5 16-Dec-2012 22:05 2 KB Albrecht Striffler to previous
4 16-Dec-2012 22:02 2 KB Albrecht Striffler to previous | to last
3 16-Dec-2012 22:00 2 KB Albrecht Striffler to previous | to last
2 16-Dec-2012 22:00 2 KB Albrecht Striffler to previous | to last
1 16-Dec-2012 21:57 1 KB Albrecht Striffler to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 added 34 lines
!Miniapp sending a file or a string via a HTTP POST
%%prettify
{{{
import java.io.File;
import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.DefaultHttpClient;
public class Uploader {
public static void main(String[] args) throws IOException {
HttpClient httpclient = new DefaultHttpClient();
HttpPost post = new HttpPost(
"http://localhost:8080/KnowWE/action/ReceiveJenkinsFileAction ");
MultipartEntity entity = new MultipartEntity();
entity.addPart("file", new FileBody(new File("newfile.xml")));
// entity.addPart("test", new StringBody("huhu"));
post.setEntity(entity);
HttpResponse response = httpclient.execute(post);
}
}
}}}
/%