on 08-11-2006 9:59 AM
Hello,
I created an image with the java awt libraries in my wd application. So, I got the image in the binary format (not as file!).
Next step would be to display this jpeg on the screen but this don`t works with the "Image"-layout object. This object uses a String-Context-Attribute to reference on an image file, but my Context attribute is binary (byte[]).
What can I do, except to write this image as an file on runtime on the server file system ?
best regards
and thanks in advance
Mathias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Maksim,
Problem solved on NW 2004 Server!
Solution:
//IN MY wdDoInit()
//modifying the attribute type
ISimpleType pictureType=null;
pictureType = wdContext.nodeRoot().getNodeInfo().getAttribute("myPicture").getModifiableSimpleType();
((IWDModifiableBinaryType)pictureType).setMimeType( WDWebResourceType.JPG_IMAGE);
((IWDModifiableBinaryType)pictureType).setFileName( "picture.jpg" );
-
//IN MY EXECUTE-METHOD
//Modifying my Attribute
final byte[] pictureContent = captchaChallengeAsJpeg;
ISimpleType pictureType=null;
pictureType = wdContext.nodeRoot().getNodeInfo().getAttribute("myPicture").getModifiableSimpleType();
/* And now the trick itself */
final String pictureUrl = pictureType.format(pictureContent);
//Setting the rel. picture path in an other attribute
//...which my Image object references
wdContext.nodeRoot().currentRootElement().setMyPricturePath(pictureUrl);
best regards
Mathias
Hi Mathais,
I implemented this method but the image is still not getting displayd. The url that was generated is as follows.. is there anyway i could check if it contains the image or not,.. or there could be some other error?
context pictureUrl contains:
../../local/imagesapmple/SampleImageAppl/wd_key1B2M2Y8AsgTpgAmY7PhCfg==/image.jpg?sap.session.download=4&sap-wd-cltwndid=3b7237606a5f11db8f5d001279d06755&sap-wd-appwndid=Id3b7237606a5f11db8f5d001279d0675586&sap-wd-norefresh=true
Hi Mathias,
after some discussions we found a solution (-;
String test="Hello!";
IWDResource
res=WDResourceFactory.createCachedResource(test.getBytes(),"hello",WDWebResourceType.UNKNOWN);
wdContext.currentContextElement().setReso(res);
wdContext.currentContextElement().setUrl(res.toString());
This is a simple example for a text, but it also works for images. The context attribute "reso" is of type com.sap.ide.webdynpro.uielementdefinitions.Resource and with res.toString you get the relative URL you can take as source of your image.
See also the JavaDocs:
Kind Regards
Stefanie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.