User (Legacy) Posted October 29, 2004 Report Share Posted October 29, 2004 Hi, I am trying to stream a chart image back to a JSP from a Java Struts Action. To stream the data I am using the following code: response.setContentType("image/png"); _chart.getHtmlData("750", "450", "Png"); where response is an HttpServletResponse. But on the page which contains the JSP I am receiving a BMP image instead of PNG. Right-clicking and viewing the properties of the image shows no image type, I assume this is because it is being streamed. But when I right-click and choose Save Image As... Internet Explorer is trying to save the image type as a bitmap. I have also tried setting the MIME type to image/x-png instead of image/png, and I have also tried "png" and "PNG" instead of "Png" for the image type in the getHtmlData method, but it is always showing up as a bitmap. Any suggestions as to why this is happening? Thanks, Brendan Link to comment Share on other sites More sharing options...
Software FX Posted October 29, 2004 Report Share Posted October 29, 2004 Hi Brendam, Chart FX for Java does not generates BMP images, so what's is happening is that somehow the browser is not recognizing the image type, and defaulting bmp. Running the attached jsp which calls getHtmlData and running Internet Explorer, when I right-click / Save Image, I get a png extension. I've changed the image type to "JPG" and I'm getting a jpeg extension as well. Can you test this jsp in your system and let me know what you get? Regards, GA SoftwareFX "Brendan O'Brien" <brendan.obrien@appiancorp.com> wrote in message news:S9Ooh$bvEHA.3980@webserver3.softwarefx.com... > Hi, > I am trying to stream a chart image back to a JSP from a Java Struts > Action. To stream the data I am using the following code: > > response.setContentType("image/png"); > _chart.getHtmlData("750", "450", "Png"); > > where response is an HttpServletResponse. > > But on the page which contains the JSP I am receiving a BMP image instead > of > PNG. Right-clicking and viewing the properties of the image shows no > image > type, I assume this is because it is being streamed. But when I > right-click > and choose Save Image As... Internet Explorer is trying to save the image > type as a bitmap. > > I have also tried setting the MIME type to image/x-png instead of > image/png, > and I have also tried "png" and "PNG" instead of "Png" for the image type > in > the getHtmlData method, but it is always showing up as a bitmap. > > Any suggestions as to why this is happening? > > Thanks, > Brendan > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted October 29, 2004 Author Report Share Posted October 29, 2004 Outlook Express removed the attachment because it was "unsafe." Could you copy and paste the code or give it a different extension? Thanks "SoftwareFX Support" <noreply@softwarefx.com> wrote in message news:DJDBD1cvEHA.424@webserver3.softwarefx.com... > Hi Brendam, > > Chart FX for Java does not generates BMP images, so what's is happening is > that somehow the browser is not recognizing the image type, and defaulting > bmp. > > Running the attached jsp which calls getHtmlData and running Internet > Explorer, when I right-click / Save Image, I get a png extension. I've > changed the image type to "JPG" and I'm getting a jpeg extension as well. > > Can you test this jsp in your system and let me know what you get? > > Regards, > GA > SoftwareFX > > > > > > "Brendan O'Brien" <brendan.obrien@appiancorp.com> wrote in message > news:S9Ooh$bvEHA.3980@webserver3.softwarefx.com... > > Hi, > > I am trying to stream a chart image back to a JSP from a Java Struts > > Action. To stream the data I am using the following code: > > > > response.setContentType("image/png"); > > _chart.getHtmlData("750", "450", "Png"); > > > > where response is an HttpServletResponse. > > > > But on the page which contains the JSP I am receiving a BMP image instead > > of > > PNG. Right-clicking and viewing the properties of the image shows no > > image > > type, I assume this is because it is being streamed. But when I > > right-click > > and choose Save Image As... Internet Explorer is trying to save the image > > type as a bitmap. > > > > I have also tried setting the MIME type to image/x-png instead of > > image/png, > > and I have also tried "png" and "PNG" instead of "Png" for the image type > > in > > the getHtmlData method, but it is always showing up as a bitmap. > > > > Any suggestions as to why this is happening? > > > > Thanks, > > Brendan > > > > > > > Link to comment Share on other sites More sharing options...
Software FX Posted October 29, 2004 Report Share Posted October 29, 2004 <%@page import="SoftwareFX.ChartFX.*"%> <% ChartServer chart1 = new ChartServer(application,request,response); chart1.getHtmlData("400","240","PNG"); %> If you goto Tools->Options->Security then unclick the checkbox that says "Do not allow download of files that could potentially have a virus" the file will be accessible. This is what you can do in the future to get a file that you know is from what you deem is a trusted source or that you then run through a scan. -cjs "Brendan O'Brien" <brendan.obrien@appiancorp.com> wrote in message news:ENtw6AdvEHA.3408@webserver3.softwarefx.com... > Outlook Express removed the attachment because it was "unsafe." Could you > copy and paste the code or give it a different extension? > > Thanks > > "SoftwareFX Support" <noreply@softwarefx.com> wrote in message > news:DJDBD1cvEHA.424@webserver3.softwarefx.com... >> Hi Brendam, >> >> Chart FX for Java does not generates BMP images, so what's is happening >> is >> that somehow the browser is not recognizing the image type, and >> defaulting >> bmp. >> >> Running the attached jsp which calls getHtmlData and running Internet >> Explorer, when I right-click / Save Image, I get a png extension. I've >> changed the image type to "JPG" and I'm getting a jpeg extension as well. >> >> Can you test this jsp in your system and let me know what you get? >> >> Regards, >> GA >> SoftwareFX >> >> >> >> >> >> "Brendan O'Brien" <brendan.obrien@appiancorp.com> wrote in message >> news:S9Ooh$bvEHA.3980@webserver3.softwarefx.com... >> > Hi, >> > I am trying to stream a chart image back to a JSP from a Java Struts >> > Action. To stream the data I am using the following code: >> > >> > response.setContentType("image/png"); >> > _chart.getHtmlData("750", "450", "Png"); >> > >> > where response is an HttpServletResponse. >> > >> > But on the page which contains the JSP I am receiving a BMP image > instead >> > of >> > PNG. Right-clicking and viewing the properties of the image shows no >> > image >> > type, I assume this is because it is being streamed. But when I >> > right-click >> > and choose Save Image As... Internet Explorer is trying to save the > image >> > type as a bitmap. >> > >> > I have also tried setting the MIME type to image/x-png instead of >> > image/png, >> > and I have also tried "png" and "PNG" instead of "Png" for the image > type >> > in >> > the getHtmlData method, but it is always showing up as a bitmap. >> > >> > Any suggestions as to why this is happening? >> > >> > Thanks, >> > Brendan >> > >> > >> >> >> > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted October 29, 2004 Author Report Share Posted October 29, 2004 Using your JSP I also get a png or jpeg depending on which setting I choose. I wrote a struts action which has nearly identical code, and I get a bitmap. Here's the struts action code: public ActionForward main(ActionMapping arg0_, ActionForm arg1_, HttpServletRequest request, HttpServletResponse response) { ChartServer chart1 = new ChartServer(request.getSession().getServletContext(), request, response); chart1.getHtmlData("750", "450", "PNG"); return null; } The only difference between this and the JSP is that this is a Struts action whereas the JSP is a servlet. Thanks, Brendan "SoftwareFX Support" <noreply@softwarefx.com> wrote in message news:DJDBD1cvEHA.424@webserver3.softwarefx.com... > Hi Brendam, > > Chart FX for Java does not generates BMP images, so what's is happening is > that somehow the browser is not recognizing the image type, and defaulting > bmp. > > Running the attached jsp which calls getHtmlData and running Internet > Explorer, when I right-click / Save Image, I get a png extension. I've > changed the image type to "JPG" and I'm getting a jpeg extension as well. > > Can you test this jsp in your system and let me know what you get? > > Regards, > GA > SoftwareFX > > > > > > "Brendan O'Brien" <brendan.obrien@appiancorp.com> wrote in message > news:S9Ooh$bvEHA.3980@webserver3.softwarefx.com... > > Hi, > > I am trying to stream a chart image back to a JSP from a Java Struts > > Action. To stream the data I am using the following code: > > > > response.setContentType("image/png"); > > _chart.getHtmlData("750", "450", "Png"); > > > > where response is an HttpServletResponse. > > > > But on the page which contains the JSP I am receiving a BMP image instead > > of > > PNG. Right-clicking and viewing the properties of the image shows no > > image > > type, I assume this is because it is being streamed. But when I > > right-click > > and choose Save Image As... Internet Explorer is trying to save the image > > type as a bitmap. > > > > I have also tried setting the MIME type to image/x-png instead of > > image/png, > > and I have also tried "png" and "PNG" instead of "Png" for the image type > > in > > the getHtmlData method, but it is always showing up as a bitmap. > > > > Any suggestions as to why this is happening? > > > > Thanks, > > Brendan > > > > > > > Link to comment Share on other sites More sharing options...
Software FX Posted October 29, 2004 Report Share Posted October 29, 2004 Brendan, you can not get a BMP, Chart FX for Java DOES NOT generated BMPs. You are getting a PNG but somehow the browser is not recognizing the format. It may be struts related, If I do the same in a regular servlet, I get the PNG in the save as. To check what I'm saying this is what you can do, add this code to your servlet, right before the getHtmlData call: chart1.setHeight(425); chart1.setWidth(700); chart1.exportChart(FileFormat.PNG,"c:\\chart.png"); The hit the servlet, save-as the image, and compare both images, if they are the exact same size, they are both PNGs. Do it with JPG and you will see the same results. GA SoftwareFX "Brendan O'Brien" <brendan.obrien@appiancorp.com> wrote in message news:mH0EW6dvEHA.420@webserver3.softwarefx.com... > Using your JSP I also get a png or jpeg depending on which setting I > choose. > I wrote a struts action which has nearly identical code, and I get a > bitmap. > > Here's the struts action code: > > public ActionForward main(ActionMapping arg0_, ActionForm arg1_, > HttpServletRequest request, HttpServletResponse response) { > ChartServer chart1 = new > ChartServer(request.getSession().getServletContext(), request, response); > chart1.getHtmlData("750", "450", "PNG"); > return null; > } > > The only difference between this and the JSP is that this is a Struts > action > whereas the JSP is a servlet. > > Thanks, > Brendan > > "SoftwareFX Support" <noreply@softwarefx.com> wrote in message > news:DJDBD1cvEHA.424@webserver3.softwarefx.com... >> Hi Brendam, >> >> Chart FX for Java does not generates BMP images, so what's is happening >> is >> that somehow the browser is not recognizing the image type, and >> defaulting >> bmp. >> >> Running the attached jsp which calls getHtmlData and running Internet >> Explorer, when I right-click / Save Image, I get a png extension. I've >> changed the image type to "JPG" and I'm getting a jpeg extension as well. >> >> Can you test this jsp in your system and let me know what you get? >> >> Regards, >> GA >> SoftwareFX >> >> >> >> >> >> "Brendan O'Brien" <brendan.obrien@appiancorp.com> wrote in message >> news:S9Ooh$bvEHA.3980@webserver3.softwarefx.com... >> > Hi, >> > I am trying to stream a chart image back to a JSP from a Java Struts >> > Action. To stream the data I am using the following code: >> > >> > response.setContentType("image/png"); >> > _chart.getHtmlData("750", "450", "Png"); >> > >> > where response is an HttpServletResponse. >> > >> > But on the page which contains the JSP I am receiving a BMP image > instead >> > of >> > PNG. Right-clicking and viewing the properties of the image shows no >> > image >> > type, I assume this is because it is being streamed. But when I >> > right-click >> > and choose Save Image As... Internet Explorer is trying to save the > image >> > type as a bitmap. >> > >> > I have also tried setting the MIME type to image/x-png instead of >> > image/png, >> > and I have also tried "png" and "PNG" instead of "Png" for the image > type >> > in >> > the getHtmlData method, but it is always showing up as a bitmap. >> > >> > Any suggestions as to why this is happening? >> > >> > Thanks, >> > Brendan >> > >> > >> >> >> > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.