Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes java.io. FileNotFoundException: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "java.io. FileNotFoundException: " Watch "java.io. FileNotFoundException: " New topic
Author

java.io. FileNotFoundException:

Inderveer singh
Greenhorn

Joined: Feb 08, 2005
Posts: 15
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

Joined: Feb 17, 2005
Posts: 704
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?


I think, therefore I exist -- Rene Descartes
Inderveer singh
Greenhorn

Joined: Feb 08, 2005
Posts: 15
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
 
subject: java.io. FileNotFoundException: