Custom tag or help in reading an image file into the HTTP stream

Since under WL we do not deploy our app physically there is no physical
          directory to write our dynamic images to (via kavachart).
          I can call their bean with:
          response.setContentType("image/png");
          ServletOutputStream output = response.getOutputStream();
          but that only allows the image back not the housing page. I can use an
          iframe but there are other issues and was wondering if anyone has idea on a
          custom tag the can easily read a physical directory outside of WL's space
          and include an image file in the http stream. Our app server and webservers
          are in separate zones so I can not just write to some virtual directory on
          the webserver and then serve it up w/ a simple <img> tag.
          BTW Kavachart has some tags referred to in their thin doc but I did not have
          good luck w/ their suggestions.
          Thanks in advance.
          dmg
          [email protected]
          

Hi joe.com,
Thanks for the response. It's greatly appreciated. Actually, I'm trying to run this on an Nokia SDK (s80 emulator) and eventually a windows mobile emulator.
I was wondering if the JSR is the problem. I'm currently using jsr 62 and I'm thinking of trying to 216 to get PP 1.1. I'm wondering if 62 maybe limiting file io?
any help is appreciated.

Similar Messages

  • Problem in reading an Image file from a Output Stream.

    I am having problem reading a JPEG file. Actually i am sending JPEG file using UDP from the client. I am using this code to convert to a byte array to transmit the file:
    DataInputStream inStream = new DataInputStream(new FileInputStream("src/Bgamex.jpg"));
    String str1 = inStream.toString();
    byte[] bindata = new byte[65500];
    bindata = str1.getBytes();
    On the server side, I am using these lines to convert the bytes to a file again but it seems to be that its not working. Its making file but with a bigger size & like garbage in it, showing nothing:
    byte[] buf = new byte[65500];
    // receive request
    DatagramPacket packet = new DatagramPacket(buf, buf.length);
    socket.receive(packet);
    buf = packet.getData();
    java.io.OutputStream fos = new java.io.FileOutputStream("Bga.jpg");
    fos.write(buf);
    Could somebody lemme know the problem in converting the file.
    Thanx.

    I propose you to perform this simple test to see by yourself:     final String BIN_FILENAME = "somebytes.bin";
        byte[] bin = {5, 4, 3, 2, 1};
        FileOutputStream out = new FileOutputStream(BIN_FILENAME);
        out.write(bin);
        out.flush();
        out.close();
        byte[] bindata;
        DataInputStream in1 = new DataInputStream(new FileInputStream(BIN_FILENAME));
        String str = in1.toString();
        in1.close();
        bindata = str.getBytes();   
        System.out.print("Bytes read with in1>");
        for (int i=0; i<bindata.length; i++) System.out.print(bindata);
    System.out.println();
    FileInputStream in2 = new FileInputStream(BIN_FILENAME);
    bindata = new byte[65505];
    int bread = in2.read(bindata, 0, in2.available());
    in2.close();
    System.out.print("Bytes read with in2>");
    for (int i=0; i<bread; i++) System.out.print(bindata[i]);
    System.out.println();

  • How to read a gif file into the java file?

    i want to read an image(*.gif) file into my appication. can u plz help me in this?

    Hi
    I have made a program that display images here is the code i hope it helps
    package ImageProcessing;
    import java.awt.Image;
    import java.awt.image.ImageObserver;
    import java.awt.image.RenderedImage;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class ImageProcessing
         public static Image imRead(String imagePath)
              Image im = null;
              try
                   File imageFile = new File(imagePath);
                   im = ImageIO.read(imageFile);
              catch(Exception e)
                   e.printStackTrace();
              return im;
         public void imWrite(Image im,String fileFormat,String imagePath) throws IOException
              File outputFile = new File(imagePath);
              ImageIO.write((RenderedImage) im, fileFormat, outputFile);
         public static void imShow(String imagePath)
              ImageObserver io = null;          
              JFrame frame = new JFrame();
              Image im = imRead(imagePath);
              ShowImage imShow = new ShowImage(im);
              frame.add(imShow);          
              frame.setVisible(true);
              frame.setTitle(imagePath);
              frame.setSize(im.getWidth(io),im.getHeight(io));
              frame.setResizable(false);
              frame.show();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public static void main(String[] args) throws IOException
              imShow("D:\\My Computer\\Images\\Cash2.gif");          
    package ImageProcessing;
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.Panel;
    public class ShowImage extends Panel
           Image im;
           public ShowImage(Image inputIm)
             im = inputIm;
           public void paint(Graphics g)
             g.drawImage(im, 0, 0, null);
    }

  • How to read an excel file into the datatable in sdk code( AddonApplication)

    Hi Experts,
    Please let me know the code ,how to write an excel file to the datatable and based on the datatable it should write to the database table.
    help would be appreciated...
    Regards,
    Vijay Kumar
    Edited by: Haroon Rasheed on Oct 29, 2011 10:40 PM

    Hi,
    You may check: Read Excel File by Sheet then put it in Matrix
    Thanks,
    Gordon

  • How to read a CSV file into the portal

    hi all,
    I want to read the content of CSV file that is avaliable in my desktop.
    plz help me with suitable code
    Regards
    Savitha
    Edited by: Savitha S R on Jun 1, 2009 8:25 AM

    Please use this code for that
    REPORT  znkp_upload_csv line-size 400.
    DATA : v_filename TYPE string.
    PARAMETER : p_file LIKE rlgrap-filename DEFAULT 'C:\Documents and Settings\Administrator\Desktop\JV.csv' .
    *Types for Reading CSV file
    TYPES : BEGIN OF x_csv,
              text(400) TYPE c,
            END OF x_csv.
    *Global internal table for reading CSV file
    DATA : lt_csv TYPE TABLE OF x_csv.
    *Global work area for reading CSV file
    DATA : wa_csv LIKE LINE OF lt_csv.
    v_filename = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = v_filename
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        data_tab                      = lt_csv
    EXCEPTIONS
       file_open_error               = 1
       file_read_error               = 2
       no_batch                      = 3
       gui_refuse_filetransfer       = 4
       invalid_type                  = 5
       no_authority                  = 6
       unknown_error                 = 7
       bad_data_format               = 8
       header_not_allowed            = 9
       separator_not_allowed         = 10
       header_too_long               = 11
       unknown_dp_error              = 12
       access_denied                 = 13
       dp_out_of_memory              = 14
       disk_full                     = 15
       dp_timeout                    = 16
       OTHERS                        = 17
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    DATA : BEGIN OF item OCCURS 0 ,
            t1(20) TYPE c,
            t2(20) TYPE c,
            t3(20) TYPE c,
            t4(20) TYPE c,
            t5(20) TYPE c,
            t6(20) TYPE c,
            t7(20) TYPE c,
            t8(20) TYPE c,
           END OF item.
    DATA : txt(1) TYPE c. " 1-Header 2-Item
    LOOP AT lt_csv into wa_csv.
    split wa_csv-text at ',' into item-t1
                                  item-t2
                                  item-t3
                                  item-t4
                                  item-t5
                                  item-t6
                                  item-t7
                                  item-t8.
    append item.
    clear item.
    ENDLOOP.
    Check ITEM TABLE
    Regards
    Naresh

  • How to read and paste an image file in the Adobe Indesign document by using plugins?

    Hai i'm senthil...
    i had just now started working with Adobe Indesign plugins...
    Can any one tell me how to read an image file from the hard disk and paste that image file in a text box in the document...
    plzz send me the codings and in which file we want to attach these codings...
    thank you..
    bye
    senthil

    hai art,
    thanks for ur reply...
    i tried and developed the program for pasting the image from
    the database...
    But now i want to paste 3 images in a page...
    for this i had used while loop;
    But i'm having 6 images in the database...
    when the 4th image is in reading, automatically a new page will
    be created and the 4th image will be pasted in the newly created page.. i tried and develped for creating a new page...
    But how shall i paste the 4th image in the newly created page...
    is there methods or classes?
    plzz reply...
    thanks..
    senthil..

  • How to read and image file in a BLOB database filed

    I’m using Oracle Reprots 10g
    I have a database filed of type BLOB ( that can be BMP, GIF, JPG, PDF ..etc .. it can be any format/extension)
    From Oracle Reports how I can display this image file

    Hello,
    Extract of the Reports Builder Help :
    Selecting an image from the database
    Note: These steps, and the steps to link an image object to a file (for paper-based reports only), allow you to include images in a wide variety of formats supported by Oracle Reports, including JPEG (all types, such as Progressive JPEG and Exif JPEG), PNG, BMP, TIFF, GIF, and CGM.
    For paper-based reports, you can also use InsertImage to import an image from a file into the report layout for images in the following formats: TIFF, JFIF, BMP, TGA, PCX, PICT, GIF, CALS, RAS, OIF, PCD.
    To select an image from the database:
    Create a query that selects a column containing images or the filenames of image objects.
    In the Data Model view, double-click the image column to display the Property Inspector.
    If the column contains the filenames of image objects, rather than the images themselves:
    Under the Column node, set the Read from File property to Yes.
    In both cases (a column containing images or a column containing the filenames of image objects): under the Column node, set the File Format property to Image.
    Regards

  • Reading Tiff image files

    Can anybody help me to find out any freeware tools or api to read an image file in tiff format.
    The content of tiff file is all text and I have to convert all tiff files into .txt file.
    Any help would be appreciated.
    -R

    Try JAI. A good place to learn how to read files is at http://java.sun.com/j2se/1.4.2/docs/guide/imageio/spec/title.fm.html

  • Signed Applet can't read an image file??

    Hi my dear java folks,
    I've written a simple applet and self-signed it in order to have access
    to local machine's files.
    The applet as you see needs to read an image file (arrow.gif).
    The applet is:
    import.....
    public class MyApplet extends JApplet{
    JButton button1=new JButton("Save");
    JButton button2=new JButton(new ImageIcon("arrow.gif"));
    public void init(){
    button1.setBounds(10,70,80,20);
    button2.setBounds(10,100,80,20);
    getContentPane().setLayout(null);
    getContentPane().add(button1);
    getContentPane().add(button2);
    The java.policy file is:
    keystore ".//myworkingstore.store";
    grant codeBase "http://fin2000/htdocs/MyApplet.class" {
    permission java.io.FilePermission "<<ALL FILES>>","read";
    permission java.io.AllPermission;
    grant codeBase "." signedBy "MyName" {
    permission java.io.FilePermission "${user.home}/*.*","read,write";
    permission java.io.FilePermission "<<ALL FILES>>","read";
    permission java.io.AllPermission;
    The java.security file is on the server
    (on my server I have Oracle8.1/Apache installed):
    policy.url.1=file:d:/oracle/ora81/apache/apache/htdocs/java.policy;
    My problem is when I run my applet through a html file
    "http://myServerName/test.html" in my browser, the applet
    runs correctly except it's button2 (the iconized button), the
    button comes without it's ImageIcon on it.
    I receive no errors, no messages and no signs of error
    I am completely confused!
    Need Urgent Help
    Thank you , Jamanir

    Hi,
    this has nothing to do with a security problem.
    Change you code as follow:
      JButton button2 = new JButton(new ImageIcon(getClass().getResource("arrow.gif")) ;Pack arrow.gif in the same directory/package as MyApplet.class in the jar file and It should solve your problem...
    The problem is that when you write new ImageIcon("arrow.gif"), it works locally as a standalone application, because "arrow.gif" is mapped to the current directory where you application is started from. This has no meaning when you works online with an applet. That's the reason why your graphic was not found.
    getClass().getResource("arrow.gif") returns an URL pointing to a file "arrow.gif" located at the same location as the class. This always works either locally or online, other packed in a Jar file, or unpacked.
    Yannick

  • Want to convert  tif image file into jpg image file , pls help me

    hey coders, i want to convert a tif image file into a jpg image file , can u all help in this

    In it's simplest form, it's two lines of code.
    BufferedImage bi = ImageIO.read(/*the tif file*/);
    ImageIO.write(bi,"jpeg",/*output file*/);Though, you need to install [JAI-ImageIO|https://jai-imageio.dev.java.net/binary-builds.html] read the tif file into a BufferedImage.

  • Help reading a .txt file from the hard drive....

    Hi guys,
    Ok... I need to know how to read a .txt file from the hard drive... I have an example on how to read from a disk, but I don't have a disk drive. I could be confusing terminology, but I don't think I am. Here is the code I have for reading from a disk.. please let me know how I should change it to read from a hard drive.
    Also, when the error pops up, it says that it can't read another .txt file that is not specified in the code... any ideas how that is occuring? Please advise.
    import java.io.*;
    public class TEST {
    public static void main(String args[]) throws Exception{
    FileReader fr = new FileReader("customer.txt");
    BufferedReader bfr = new BufferedReader (fr);
    String s;
    while ((s=bfr.readLine())!= null){
    System.out.println (s);
    fr.close();
    }

    Ok... I need to know how to read a .txt file from the
    hard drive... I have an example on how to read from a
    disk, but I don't have a disk drive. I could be
    confusing terminology, but I don't think I am. Here
    is the code I have for reading from a disk.. please
    let me know how I should change it to read from a
    hard drive.The code will be the same, regardless of where the file is located. It's just the filename that will be different.
    Also, when the error pops up, it says that it can't
    read another .txt file that is not specified in the
    code... any ideas how that is occuring? Please
    advise.Probably becuase the class file (compiled version of the source code) is a different version to the source code, i.e. the source code hasn't been recompiled since the source code was changed.
    How does this relate to EJBs?

  • Reading Image File into 6i Form

    I am attempting to read an image file and display it on an Oracle Form (created in Forms 6i) using the READ_IMAGE_FILE builtin. I have tried it with the same image in several different formats: JPG, TIFF and GIF. The call reads as follows: READ_IMAGE_FILE('D:\mugshot\mug23456.gif','GIF','DESCRIPTION.IMAGE_ITEM'); The file is located in the indicated path on the application server, i.e. the same machine where the form is being run. DESCRIPTION.IMAGE_ITEM is, of course, an Item of type Image. The PL/SQL procedure containing the above call is invoked by an ON-POPULATE-DETAILS trigger defined at the block level (DESCRIPTION is the block in question). Here is the problem: after logging into my Forms 6i application via a login screen, which then runs the form which would be displaying the image item, the form does not appear; all we see is a blank screen. When I remove the DESCRIPTION.IMAGE_ITEM field from the canvas, the form runs as expected, except of course that the image is not read. Is there something special that has to be done to read or display an image, other than what I have already done as described above?

    Plz don't Reply
    i am able to do it on my own here is the sample code for that
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import javax.swing.text.*;
    // this is a function u can use it in a class
    private void addEditScroll(){
    try{
    BufferedReader infile = new BufferedReader(new FileReader("c:\\WS_FTP.log"));
    editor =new JEditorPane();
    editor.setEditable(false);
    editor.read(infile,new PlainDocument());
    editor.setSize(new Dimension(450,510));
    editorscroll = new JScrollPane(editor);
    editorscroll.setSize(new Dimension(450,510));
    }catch(Exception ex){
    ex.printStackTrace();
    -ashish

  • I need help on reading a large file, thanks.

    I try to read a txt file into an array, just like what I ususally do. But this time the file is too big (300k rows, 100 columns seperated by single space), I got the message "java.lang.OutOfMemoryError".
    I need to do some calculation for every possible row pair. Can someone help me out of this? Thanks a lot.

    Try changing your approach - don't read it into an array, process it one line at a time. Obviously any approach where you have the whole file in memory is going to exceed memory at some size of the file.

  • IO - Read two image files and put them into one file

    Hi,
    i have 3 files in all. The two image files and one text file. I need to place the image in the first image file, followed by text in the text file and then the image in the second image file, into one file.
    Can anyone tell me how do i go about doing this ?
    i tried using fileinputstream and fileoutputstream, which works fine if all the 3 files have text but when the first and the third file have image, the code doesn't give any error but the result file displays only the image from the first file and nothing else.
    i am running short of time and need to do this really soon.
    if anyone has done anything like this. please let me know,
    thanx,
    poonam

    One approach would be to programmatcally create a single zip/jar file from the three input files. You can use the java.util.zip and java.util.jar packages for this purpose.
    The other apprach would be to create a single image by drawing images and text strings on a BufferedImage object.
    I think the first approach is preferable because you can easily extract the individual files from the zip/jar file

  • How to save image files into SQL Server?

    Hello, All:
    Does anyone know how to save image files into SQL Server? Does the file type have to be changed first?? Please help me! Thank you!

    You need a BLOB field (usually)... Then you can check this tutorial out:
    http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/exercises/BLOBPut/
    There are other exercises on that site, including one on reading the images back.

Maybe you are looking for

  • My iphone is failing to turn on when i plug it into a computer

    so a couple of weeks ago i was at work and my iphone randomly went into the connect to itunes screen and i didnt know why but i turn my phone on and off and it was fine since then my iphone has slowly been dieing of batterie when i had tones of charg

  • How to create Variables(User Input Selections) in WEBI Report

    Hi Team,               My requirement is to create a WEBI Report on top of BEx query,I have created a Universe and WEBI Report on this Universe but my doubt is How to create Variables for the User to select.The Input selection should be User Iputs(Al

  • Cannot bind when using "pwdLastSet" attribute in Active Directory

    Admin resets the password & enables user has to change password at next logon, when i try to change user password, I couldn't able to bind the user & it shows error Such as Since Authentication fails, he could able to modify the attribute[pwdLastSet]

  • How to invoke a bean in WLS from a servlet in JWS

              Hi,           I have an application where in i am invoking an EJB in WLS from a servlet in JWS.Could any one give me the correct steps to approach this problem.Till now i was using WLS as webserver itself.can i use the same t3 protocol in m

  • San Antonio Spurs vs Portland Trail Blazers

    The Brooklyn Nets subjugated the Metropolis Turn 104-90 in Mettlesome 3 of the Asian Discussion Semifinals Saturday period down a postseason franchise-record 15 three-pointers. Metropolis now leads the broadcast 2-1. After the Emotionalism outscored