Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Javascript handler not showing image
jcube
Hi,
I have a java class that returns a byte[] array that eventually becomes a jpeg image. It works fine when I invoke it within a servlet, i.e.,
GetImage imageClass = new GetImage();
byte[] imageBytes = imageClass.byteStream(LDAPServerName, LDAPBase,
ldapSearchFilter);
response.setContentType("image/jpeg");
response.setContentLength(imageBytes.length);
response.getOutputStream().write(imageBytes);
When I use the BIRT JavaScript handler onCreate method then Preview, it does not show the jpeg image. Here's the code snippet:
importPackage( Packages.java.io );
imageClass = new Packages.com.test.jndi.GetImage();
image = imageClass.byteStream("ldap.test.com:389", "dc=test,dc=com", "cn=John Doe");
bais = new ByteArrayInputStream(image);
baos = new ByteArrayOutputStream();
while(bais.available() != 0 ){
baos.write(bais.read());
}
baos.close();
this.data = baos.toByteArray();
Any idea how to solve this?
Thanks
Find more posts tagged with
Comments
There are no comments yet