dcsimg
viewing HTML page saved on the server from the browser
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   penumutchu_bhaskar
Posted On:   Friday, January 6, 2006 05:19 AM

Hi all In my application i am having some HTML pages saved on the server. I had given an option to the user to view the HTML page from my application. behind the scene what i am doing is that the view request will get handled by a servlet and from that servlet iam locating the HTML page on the server directory and sending the HTML page to browser by using the Servlet OutputStream. The HTML page is shown on the browser but the attached images are not shown. The images are also there in the server directory and are refered in the HTML file correctly. When i directly open the HTML file then the images are shown correctly. Can anyone suggest wat's wrong there.    More>>
			
Hi all


In my application i am having some HTML pages saved on the
server. I had given an option to the user to view the
HTML page from my application. behind the scene what i
am doing is that the view request will get handled by a
servlet and from that servlet iam locating the HTML page on the server directory and sending the HTML page to browser by using the Servlet OutputStream. The HTML page is
shown on the browser but the attached images are not
shown. The images are also there in the server directory and are refered in the HTML file correctly. When i
directly open the HTML file then the images are shown correctly.

Can anyone suggest wat's wrong there.


The code i m using is


ServletOutputStream out=response.getOutputStream();

if(format.equalsIgnoreCase("pdf"))

{

logger.info("Seleted format is pdf..
");

response.setContentType("application/pdf");

}

else

{

logger.info("Seleted format is html..
");

response.setContentType("text/html");

}

String file = ReportingConstants.URL_GENERATEDREPORTS+reportPath+itemName;

// file : HTML file absolute path as string.

URL url=new URL(file);

BufferedInputStream bis=new BufferedInputStream(url.openStream());

BufferedOutputStream bos=new BufferedOutputStream(out);

byte[] buff = new byte[2048];

int bytesRead;


while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {

bos.write(buff, 0, bytesRead);

bos.flush();

}
   <<Less
About | Sitemap | Contact