• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.io. FileNotFoundException:

 
Inderveer singh
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to attach the input stream of the html page that is being dispalyed as an HTML.
i am doing this.

String l_servletUrl = null;
URL l_serv = null;
URLConnection l_conn = null;
InputStream in = null;



strServerName= InetAddress.getByName( req.getServerName()).getHostAddress();
strServerPort = new Integer( req.getServerPort() ).toString();
strContextPath = req.getContextPath();

l_servletUrl = "http://" + strServerName + ":" + strServerPort+strContextPath + "/letterMail.jsp" ;

l_serv = new URL(l_servletUrl);
l_conn = l_serv.openConnection();
in = l_conn.getInputStream(); // will this return html stream ?

now i want to Attach the Stream as html attachment and send mail
The requirement is we can not save this as a file on disk and attach.

Or How can i directly attach the input stream.


in line
in = l_conn.getInputStream();

i am getting an error
class java.io.FileNotFoundException
java.io.FileNotFoundException: http://127.0.0.1:9080/mytWeb/letterMail.jsp
SystemErr R at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.ja va:595).

Can anyone help. Why this error is coming
 
Valentin Tanase
Ranch Hand
Posts: 704
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please make clear one thing: is this a server code (the code above runs within another servlet) or it is a client code?
 
Inderveer singh
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code above is the server code. It is part of my action class which is called when the user clicks on the button on the lettermail.jsp after entering some data fields.
Then i want that jsp as inputStream
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic