File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Content-type

 
iceman
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to set the content type in this code:
but the remote server say's the content type is not being set? any Idea's
note:
XMLDATA contains a correctly formated XML file
---- Snip code
BufferedReader in = new BufferedReader( new InputStreamReader(socket.getInputStream()));
Writer out = new OutputStreamWriter(socket.getOutputStream());
out.write ("POST https://www.domain.com/apps/Urel\r\n");
out.write("Content-type: text/xml"\r\n);
out.write("XMLDAT"\r\n");
out.write("\r\n");
out.flush();

----- Snip code
I have also try out.write(Content-Type, text/xml\r\n");

Thanks for any help


 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are writing headers "by hand" remember there needs
to be a blank line between the headers and the content. Looks to me like you are writing XMLDAT directly after the headers.
 
iceman
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm.. Thanks for the help, But I still get the same error.
This is what I have for the headers
String header = "Content-Type:, text/xml\r\n";
 
Ray Smilgius
Ranch Hand
Posts: 120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to do the following
In a doPost use the request parameter
such as

request.setContent("Content-Type", "text/html");
etc
etc
Good luck
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic