• Post Reply Bookmark Topic Watch Topic
  • New Topic

write an object to tomcat server from http socket client

 
Nanaji Jonnadula
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
URL url = new URL(model.Upload_URL);
header.append("POST ");
System.out.println("path "+url.getPath());
header.append(url.getPath());
System.out.println("path "+url.getHost());
System.out.println("path "+url.getQuery());
if (null != url.getQuery() && !"".equals(url.getQuery())) {
header.append("?");
header.append(url.getQuery());
}
header.append(" HTTP/1.1\r\n");
// Header: General
header.append("Host: ");
header.append(url.getHost());
header.append("\r\n");
//header.append("Accept: */*\r\n");
// Header: Request
//header.append("User-Agent: Mozilla/4.0\r\n");
// Header: Entity
header.append("Content-type:multipart/form-data; boundary="); //" application/octet-stream; boundary=");
header.append(boundary.substring(2, boundary.length()) + "\r\n");
header.append("Content-length: ");
header.append(contentLength+ "\r\n");
header.append("Cookie: ");
header.append(sb1.toString());
header.append("\r\n");
// Blank line
header.append("\r\n");
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15711
73
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why did you post that?
Do you have a question?

If you're looking for code to upload a file to a web server (simulating uploading from an HTML form), have a look at the Jakarta Commons FileUpload library.
[ August 18, 2005: Message edited by: Jesper de Jong ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!