Saving images from applet back to the host

Hi,
I am trying to save an image (or a buffered image) from an applet back to its original host . Is there a way to do this without using a servlet at the server's end?
An earliest response would be appreciated.
Thanks in advance.

Thanks to all of you for your help. Your replies have been helpful to me.
Atlast I'm done with my problem. I am able to write my image to the host.
I have converted the Image(buffered image) into a byte stream
ImageIO.write(bimg,imgType,bos);
converted the stream to byte array:
byte[] b=bos.toByteArray();
and used HttpURLConnection to write the byte array to the host.
Thank you.

Similar Messages

  • How to return string from Applet back to the broser textbox

    Hi everybody , i m new to java applet .
    I have an applet running on the browser along with a text box. the applet connects to the database and in the end a string should be copied back to the textbox on the browser. I have no idea how do i do it
    if anybody can help me.
    my applet is working well. its just integration with the browser giving me hard time.
    thanks alll in advance
    reuben

    With "text box", do you mean a text field on a HTML page? If yes, you could use the JSObject class from netscape to issue a Javascript call to the page similar to window.document.form[0].textfieldname and provide the string. The Applet tag must contain the MAYSCRIPT=true argument to allow the Applet to issue Javascript commands.
    Frankl

  • How to email text from a text component in my applet on a the host server ?

    How to email text from a text component in my applet on a the host server, back to my email address ?
    Assuming I have Email Form on the host server.
    Help will be appreciated.

    You can do like below
    =REPLACE(Fields!Column.Value," " & Parameters!ParameterName.value & " ","<b>" & Parameters!ParameterName.value & "</b>")
    The select the expression and  right click and choose placeholder properties
    Inside that set Markup type as HTML 
    then it will highlight the passed parameter value in bold within the full xml string
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • I saved images from an imessage.  now when I open Imessage, the pictures will not go away. When I press "done" the pictures remain. Cannot send a message

    I saved images from an imessage.  Now when I open Imessage, the pictures are displayed on the screen.  When I click on "done" the images do not go away.
    Therefore, I cannot send a message.

    Quit the app completely and try again. Go to the home screen first by tapping the home button. Double tap the home button and the task bar will appear with all of your recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar.
    Or try this.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • Saving image in applet

    i used the following code to save a image it displays from applet.it works fine in appletviewer
    BufferedImage expImage = new BufferedImage( (int)this.getWidth(), (int)this.getHeight(), BufferedImage.TYPE_INT_RGB );
    Graphics g2d = expImage.getGraphics();
    // draftGrid.update(g2d);
    this.update(g2d);
    g2d.dispose();
    OutputStream out = new FileOutputStream( "guru.jpg");
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    encoder.encode(expImage);
    out.flush();
    out.close();
    expImage.flush();
    but when i run it in html through my web server the image does' get saved and it the exception i go is
    Status code:404 request:R( j
    ava/awt/image/BufferedImage.class + null) msg:null
    what should i go to save a image from applet throgh browser

    Hello,
    This is what I am doing through a servlet call.
    If you are just going to let the user download the image you could try the following:
    // This works if we are just going to download the image as is
    URL url = new URL(request.getParameter("imageURL"));
    response.setContentType("image/gif");
    response.setHeader("Content-Disposition", "attachment; "+
         "filename=\"image.gif\"");
    byte buf[] = new byte[1024];
    InputStream inputStream = url.openStream();
    ServletOutputStream out = response.getOutputStream();
    //Read and Write
    while(inputStream.read(buf) != -1)
    out.write(buf);
    out.flush();
    out.close();
    Or if you are going to manipulate the image a bit before they download it you could try the following:
    URL url = new URL(request.getParameter("imageURL"));
    response.setContentType("image/gif");
    response.setHeader("Content-Disposition", "attachment; "+
         "filename=\"image.gif\"");
    // use ImageIcon because we are getting the image from a
    // URL which might be slow - it has the MediaTracker built right in
    javax.swing.ImageIcon ii = new javax.swing.ImageIcon(url);
    Image image = ii.getImage(); // now the pixel data is in memory
    // get the height and width of the loaded image
    int width = image.getWidth(null);
    int height = image.getHeight(null);
    // create a rectangle as big as the image
    Rectangle drawRect = new Rectangle(10, 10, width, height);
    BufferedImage bufImage = new BufferedImage(width,
    height, BufferedImage.TYPE_INT_RGB);
    // get the graphics so you can draw on it
    Graphics2D g = bufImage.createGraphics();
    // create a nicce white background for the image
    g.setColor(Color.white);
    g.fillRect(0, 0, width, height);
    // reset the color
    g.setColor(Color.black);
    // add the image
    g.drawImage(image, 0, 0, null);
    // add any other things you want as well
    g.drawString("Just a string", 10, 10);
    // create the output stream
    ServletOutputStream out = response.getOutputStream();
    JPEGImageEncoder jpegImageEncoder = JPEGCodec.createJPEGEncode(out);
    // encode it
    jpegImageEncoder.encode(bufImage);
    out.flush();
    out.close();
    Hope that this helps.
    Mike

  • Problem in sending image from applet to servlet

    dear friends,
    i have a need to send an image from applet to servlet via HttpConnection and getting back that image from applet.
    i am struggling with this sice many hours and got tired by searching any post that would help me but haven't got yet.
    i tried using this code but it dosent make any execution sit right. i got NPE at ImageIcon.getDescription() line;
    at applet side
          jf.setContentPane(getJContentPane());
                     FileDialog fd=new FileDialog(jf,"hi");
                     fd.setMode(FileDialog.LOAD);
                     fd.setVisible(true);   
                     v=new Vector();
                     try{                                                
                               FileInputStream fis=new FileInputStream(new File(fd.getDirectory()+fd.getFile()));      
                               byte[] imgbuffer=new byte[fis.available()];
                               fis.read(imgbuffer);
                               ImageIcon imgdata=new ImageIcon(imgbuffer);
                               v.add(0,imgicon);
                                String strwp ="/UASProject/Storeimage";              
                                URL servletURL = new URL(getCodeBase(),strwp);             
                                HttpURLConnection servletCon = (HttpURLConnection)servletURL.openConnection();       
                                servletCon.setDoInput(true); 
                                servletCon.setDoOutput(true);
                                servletCon.setUseCaches(false);
                                servletCon.setDefaultUseCaches(false);   
                                servletCon.setRequestMethod("POST");     
                                servletCon.setRequestProperty("Content-Type", "application/octet-stream");   
                                servletCon.connect();            
                                ObjectOutputStream oboutStream = new ObjectOutputStream(servletCon.getOutputStream());                     
                                oboutStream.writeObject(v);
                                v.remove(0);
                                oboutStream.flush();      
                                oboutStream.close();  
                                //read back from servlet
                                ObjectInputStream inputStream = new ObjectInputStream(servletCon.getInputStream());
                                 v= (Vector)inputStream.readObject();                     
                                 imgicon=(ImageIcon)v.get(1);
                                 showimg.setIcon(imgicon);
                                 this.getContentPane().validate();
                                 this.validate();  
                                inputStream.close();                                                        
                             //  repaint();
                     }catch(Exception e){e.printStackTrace();}  and this is at servlet side
            try {       
                         Vector v=new Vector();                    
                         ObjectInputStream inputFromjsp = new ObjectInputStream(request.getInputStream());                                      
                          v = (Vector)inputFromjsp.readObject();                                                                                                          
                          imgicon=(ImageIcon)v.get(0);                     
                          inputFromjsp.close();            
                          System.out.println(imgicon.getDescription());                                      
                          v.remove(0);
                          v.add(1,imgicon);
    //sending back to applet
                           response.setContentType("application/octet-stream");
                          ObjectOutputStream oboutstream=new ObjectOutputStream(response.getOutputStream());            
                          oboutstream.writeObject(v);
                          oboutstream.flush();
                          oboutstream.close();
                   } catch (Exception e) {e.printStackTrace();}  i really need your help. please let me out of this headche
    thanks
    Edited by: san_4u on Nov 24, 2007 1:00 PM

    BalusC wrote:
    san_4u wrote:
    how can i made a HttpClient PostMethod using java applets? as i have experience making request using HttpURLConnection.POST method. ok first of all i am going make a search of this only after i will tell. please be onlineOnce again, see link [3] in my first reply of your former topic.
    yeah! i got the related topic at http://www.theserverside.com/tt/articles/article.tss?l=HttpClient_FileUpload. please look it, i am reading it right now and expecting to be reliable for me.
    well what i got, when request made by html code(stated above) then all the form fields and file data mixed as binary data and available in HttpServletRequest.getinputstream. and at servlet side we have to use a mutipart parser of DiskFileItemFactory class that automatically parse the file data and return a FileItem object cotaing the actual file data,right?.You can also setup the MultipartFilter in your environment and don't >care about it further. Uploaded files will be available as request attributes in the servlet.is the multipartfilter class file available in jar files(that u suggested to add in yours article) so that i can use it directly? one more thing the import org.apache.commons.httpclient package is not available in these jar files, so where can got it from?
    one mere question..
    i looked somewhere that when we request for a file from webserver using web browser then there is a server that process our request and after retrieving that file from database it sends back as response.
    now i confused that, wheather these webservers are like apache tomcat, IBM's webspher etc those processes these request or there is a unique server that always turned on and process all the request?
    because, suppose in an orgnisation made it's website using its own server then, in fact, all the time it will not turned on its server or yes it will? and a user can make a search for kind of information about this orgnisation at any time.
    hopes, you will have understand my quary, then please let me know the actual process
    thanks
    Edited by: san_4u on Nov 25, 2007 11:25 AM

  • Saving images from camera raw in new CC suite

    Hi Im having trouble re saving images from new adobe cc bridge camera raw, images once saved then show in bridge with no adjustments done in camera raw and the images are downsized to KB size images even from a 9.20mb raw image, Ive looked at setting or rather preferences and totally lost please help!!
    Thank you
    Jon

    This forum is actually about the Cloud, not about using individual programs
    Once your program downloads and installs with no errors, you need the program forum
    If you start at the Forums Index http://forums.adobe.com/index.jspa
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says ALL FORUMS) to open the drop down list and scroll
    http://forums.adobe.com/community/bridge

  • Saving images from internet

    how do i save images from the internet to my iphone photo library?

    Page 79 of the manual:
    "Saving Images from an Email Message or Webpage
    You can add images attached to an email message or webpage to your Photo Library.
    Add a photo to your Photo Library: Press and hold the photo, then tap Save Image.
    The image is added to the Camera Roll album. You can upload your Camera Roll
    pictures to your computer’s photo application by connecting iPhone to your computer. "
    http://manuals.info.apple.com/enUS/iPhone_UserGuide.pdf

  • How can I keep people from saving images from my website?

    How can I keep people from saving images from my website?

    Hi,
    have a look at this thread
    http://discussions.apple.com/thread.jspa?messageID=5645821&tstart=0#5645821
    and the link I posted in that thread
    However there's no way to avoid that people grab photos from your website. Nevertheless there are ways for making it a little more difficult.
    Regards,
    Cédric

  • Saving images from LR Mobile with edits.

    I'm having a bit of trouble saving images on my ipad with the current edits.
    To me it seems I have to manually sync the edited image first, otherwise Lr just saves a JPG of the original image to my photostream rather than a copy with adjustments on it.
    Am I missing something or is this the way it works?
    Thanks for any insight.

    Correct. As long your image is in Develop mode (same with presets and crop) and you would like to share from there you need to maually force sync your changes first. This is already logged as in internal bug. Thanks, Guido

  • Saving images from web on itouch?

    My itouch stopped saving images from Safari?

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Go to Settings>Safari and Clear History, Cookies and Data
    - Try a different browser like Chrome

  • How do I view multiple images from different projects at the same time?

    Hello
    I've been trying to find the answer in the user manual, but no luck so far.
    I did find how to open 2 projects at once, but I can only see one image at a time in the viewer and I have to keep going back and forth between projects to compare images. (These are scans of old photos and I want to eliminate the ones that are poorer quality, so need to compare numerous images from 2 sets of scans)
    How can I view an image from one project at the same time as an image from another? I know that it can be done in the same project by apple-clicking the second, third etc image, but this doesn't work if the images are from different projects.
    Thank you
    Elizabeth

    Thank you again Tony
    I've now created an album, independent of the projects, and dragged test images into it and it does just the job I needed. Now i just need to keep my brain sorted with which ones are which while i'm working
    Elizabeth

  • All of a sudden I cannot create virtual copies nor can I import my corrected image from PS back 2 LR

    All of a sudden I cannot create virtual copies nor can I import my corrected image from PS back 2 LR

    Thanks Terence, I rebuilt my database....I was not aware that I could access rebuild tools by holding the command and options buttons. Like I said, I'm new to Mac. I was able to recreate my missing photo's but they aren't the same pixel quality as the originals, look kind of blurry....any thoughts on this???
    iMac Core Duo 2.0 Mac OS X 10.4.6   Mac OS X (10.4.7)  

  • I have problem that changes i make wont be saved it all goes back to the same date that i had this problem for EX: when i ever change my desktop photo and reopen the macbook it goes back to the same photo that i had before.

    i have problem that changes i make wont be saved it all goes back to the same date that i had this problem for EX: when i ever change my desktop photo and reopen the macbook it goes back to the same photo that i had before.

    Might be corrupted preferences ..
    Open the Finder. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following:
    ~/Library/Preferences/com.apple.desktop.plist
    Click Go then move the com.apple.desktop.plist file to the Trash.
    Restart your Mac and try changing the desktop photo.

  • I just moved from Germany back to the USA. How can I use an German iPhone6 from T-Mobile  in the USA

    I just moved from Germany back to the USA. How can I use an German iPhone 6 from T-Mobile  in the USA?

    Was your phone locked to T-Mobile? If so, it needs to be unlocked before you can use it here. I believe you can use it with AT&T or T-Mobile here, but you won't get 4G/LTE speeds.
    ~Lyssa

Maybe you are looking for

  • I dropped my iPod Shuffle in water

    Hello, about ten minutes ago I dropped my iPod Shuffle 4th Generation in water. this is what happened: I picked up the iPod, with the headphones wrapped around it (and plugged into the device). I think I must have only picked up the headphones and th

  • ITunes won't load installation. Error message listed in post (below).

    "Error: Some installation files are corrupt. Please download fresh copy and retry the installation." I've done this three times. Please help me. I'll be back in ten minutes to check the posts. Thanks.. Ethan

  • While creating the networks under WBS it's giving error

    Hi experts, i am not able to create the network under WBS element. while creating the Networks it's asking Scheduling type under scheluling tab. I tryed giving with backwards and forwards options, after press the enter it's says"The factory calendar 

  • Changing a birth date

    My daughter set up an account and entered the wrong birth date.  How do I change her apple ID info to reflect the correct date?

  • 9.3.1 to ????

    All, At present on 9.3.1 with EPMA As Corporate is moving to IE8, I have to upgrade to Mixed Release(9.3.3 all products except SharedService/EPMA/WorkSpace to 11.1.1.3) or all products to 11.1.1.3 (11.1.1.3 IE8 included all the products we use) Which