How to synchronize if one servlet read a file and anothe servlet update the

How to synchronize if one servlet read a file and anothe servlet update the file at a time?

Create a class that holds the reference to the file and do the whole file manipulation just in that class. than synchronize the read and write methodes. A reference to this file handler class can be stored to the servlet context in one servlet and read out from the servlet context in the other servlet.

Similar Messages

  • After reinstalling CS6 the bridge photo downloader isn't able to read raw files and fails to convert the raw files to DNG. Previously downloaded raw files, now DNG, open up successfully in Camera Raw 7. How do I get the photo downloader to read and conver

    After reinstalling CS6 the bridge photo downloader isn't able to read raw files and fails to convert the raw files to DNG. Previously downloaded raw files, now DNG, open up successfully in Camera Raw 7. How do I get the photo downloader to read and convert raw files. MacBook Pro with Snow Leopard. No such problem before this reinstallation.

    You should install Camera Raw 4.6.
    Visit this page and follow the instructions carefully:
    PC:    http://www.adobe.com/support/downloads/detail.jsp?ftpID=4040
    Mac:  http://www.adobe.com/support/downloads/detail.jsp?ftpID=4039
    -Noel

  • How to make blank copies of a PDF file and put it into the printer tray.

    Dear experts,
    Before you try printing the data from the FM, How tomake several blank copies of the PDF file  and  put it in the printer tray so that you can print just the data from the function module on it??????
    Please reply.

    Hi drredwood,
    When you open your PDF file a yellow bar will appear on the top of the screen.
    Click on 'Enable All Features'.
    Then you will be able to copy the content from your pdf and to paste in any of the file.
    Regards,
    Florence

  • How can I protect a PDF file to where when I am editing the file and another user opens the file, it is only a read-only file?

    I work for an auditing firm and we have recently gone paperless with our audit documentation. We have our files saved on a server and multiple people can access the same file at one time. We noticed that Acrobat does not give an message notifying a user that someone else is in that file, nor does Acrobat make that PDF file a read only file when someone else is in it editing the document. Is there a way to notify someone that another user is in the same PDF file? Or is there a way to make a PDF read only when someone else is working with the document?

    Hi ashleyr1936858
    You can restrict editing of a pdf by setting the password, such that anyone who wants to edit the pdf would need to input that password. This would make the pdf a read-only file.
    Here's a Link for more information : Acrobat Help | Securing PDFs with passwords
    Regards,
    Rahul

  • Read Zip File and output it to the Stream

    Hi,
    I really need help with this topic. I need to write a function which as input read the zip file (inside: jpeg, mp3, xml)
    and as output provide the output Stream of this zip file.
    public OutputStream readZipToStream(String sourceZipFile) { ....}
    I've tried something....
    public static OutputStream    readZipToStream(String src, HttpServletResponse response) throws Exception {
            File fsrc = null;
            ZipOutputStream out = null;
            byte buffer [] = null;
            FileInputStream in = null;
            try {
                buffer = new byte[BUFFER_CREATE];
                fsrc = new File(src);
                out = new ZipOutputStream(response.getOutputStream());
                ZipEntry zipAdd = new ZipEntry(fsrc.getName());
                zipAdd.setTime(fsrc.lastModified());
                out.putNextEntry(zipAdd);
                // Read input & write to output
                in = new FileInputStream(fsrc);
                while (true) {
                    int nRead = in.read(buffer, 0, buffer.length);
                    if (nRead <= 0)
                        break;
                    out.write(buffer, 0, nRead);
                out.flush();
                in.close();
            } catch (IOException ioe) {
                logger.error("Zip Exception: " + ioe.getMessage());
                ioe.printStackTrace();
                throw ioe;
            return out;
        } But the problem with this code when it returns ( I called from servlet: bellow)
    it ask user to save the file as servlet.jsp file. So I would have to rename it to zip file later.
    What I want to achive is it would ask to save zip file from the stream as name of the original zip file (if that is possible)
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%
    OutputStream stream = null;
    response.setContentType("application/zip");
    target = mount_media + File.separator + "test_swf.zip";       
    try {
    stream = ZipUtil.readZipToStream(target, response);
    } catch (Exception ex) {
            System.out.println(ex.getMessage());
        } finally {
    if(stream != null) {
                stream.close();
    %>
    <%@page import="java.io.File" %>
    <%@page import="java.io.OutputStream" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    </body>
    </html>

    Hi oleg_s ,
    There's a contradiction of content in your JSP :
    response.setContentType("application/zip");
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">The html part of your JSP seems useless for what you mean to do. Therefore, instead of a JSP, you should use a simple servlet to send your zip file.

  • How to synchronize just one folder with bookmarks?

    Is there any way how to synchronize just one particular folder with bookmarks between different PC? I have found a several options how to synchronize all bookmarks between PCs, but none of them has the option to pick just one particular folder.
    Can you help?

    No, it is all or nothing. You can't select which bookmarks folders to sync.

  • I use i-tunes for backing tracks with an acoustic band...how can I get a playlist to play one song at a time and not go to the next one until I manually select it?

    I use i-tunes for backing tracks. How can I set up a play list to play only one song at a time and not go to the next one until I manually select it?
    Thanks

    Uncheck all the songs in the playlist. iTunes will then play one song and stop.
    Regards.

  • How can we call a class file of one package for class file of another

    How can we call a class file of one package from class file of another package and both packages exist in a same folder

    How can we call a class file of one package from
    class file of another package and both packages exist
    in a same folder
    Luckily they don't so it's really not a problem after all.

  • HT4914 How to  synchronize my own produced Video between iPad and iPhone

    How to  synchronize my own produced Video between iPad and iPhone

    First, both your devices shoulde be using the same Apple ID account.
    Second make sure that the "Documents and Data" option under iCloud settings are set ON for both devices.
    That should make it work.

  • How to read  *.pdf files and store them in a database?

    Dear programmers,
    I have problem with reading *.pdf files and store them in a database.
    can any one help me, please!
    Is it possible to read more than one file from the local system and store them in a database.
    thnaks in advance.
    bye

    What "problem" are you encountering?
    Depending on your choice of database software, it may or may not support the storage of binary large objects (BLOBs).

  • I have two apple id's because my hotmail account is no longer active. How can I delete the old one and use or update the new one?  Every time I try it won't allow me and now my iPad thinks there are two accounts and they are arguing with each other. Help!

    I have two apple id's because my hotmail account is no longer active. How can I delete the old one and use or update the new one?  Every time I try it won't allow me and now my iPad thinks there are two accounts and they are arguing with each other. Help!

    You can't merge accounts or copy content to a different account, so anything that you bought or downloaded via the old account is tied to that account - so any updates that those apps get you will only be able to download via that account. You can change which account is logged in on the iPad via Settings > Store

  • I have dragged 2 files to the trash bin but I cannot delete them from the trash bin. It keeps telling me these files are in use when they are not. How do I delete these files? One is a txt file and the other is an xls file

    I have dragged 2 files to the trash bin but I cannot delete them from the trash bin. It keeps telling me these files are in use when they are not. How do I delete these files? One is a txt file and the other is an xls file

    From the Finder menu select 'Secure Empty Trash'. If this or the suggestion above doesn't resolve the problem take a look at the various suggestions in this link:
    http://www.thexlab.com/faqs/trash.html

  • I have multiple email accounts.  One is a google email and another aol.  I have the aol going into my google.  I Now Go Lead Generate! Am using outlook on my pc.  How can I get my outlook to share with my ipad?

    I have multiple email accounts.  One is a google email and another aol.  I have the aol going into my google.  I Now Go Lead Generate! Am using outlook on my pc.  How can I get my outlook to share with my ipad?

    In Mail Preferences/Accounts/each GMail account, set up the SMTP Outgoing Server for each account separately, going into SMTP name/edit/Advanced and specify the Username of each account.  The Outgoing servers must be two different servers, authenticated by the Username and Password of each.
    Otherwise, the GMail SMTP server will change the from address to that of the account where the SMTP server was setup.
    Ernie

  • How can I remove one page from adobe file

    How can I remove one page from adobe file, when I try to remove the page a dialgue box say "some pages are being used, so they can not be ereased"?

    Tools>Pages>Delete pages

  • How can I input read a line from a file and output it into the screen?

    How can I input read a line from a file and output it into the screen?
    If I have a file contains html code and I only want the URL, for example, www24.brinkster.com how can I read that into the buffer and write the output into the screen that using Java?
    Any help will be appreciate!
    ======START FILE default.html ========
    <html>
    <body>
    <br><br>
    <center>
    <font size=4 face=arial color=#336699>
    <b>Welcome to a DerekTran's Website!</b><br>
    Underconstructions.... <br>
    </font> </center>
    <font size=3 face=arial color=black> <br>
    Hello,<br>
    <br>
    I've been using the PWS to run the website on NT workstation 4.0. It was working
    fine. <br>
    The URL should be as below: <br>
    http://127.0.0.1/index.htm or http://localhost/index.htm
    <p>And suddently, it stops working, it can't find the connection. I tried to figure
    out what's going on, but still <font color="#FF0000">NO CLUES</font>. Does anyone
    know what's going on? Please see the link for more.... I believe that I setup
    everything correctly and the bugs still flying in the server.... <br>
    Thank you for your help.</P>
    </font>
    <p><font size=3 face=arial color=black>PeerWebServer.doc
    <br>
    <p><font size=3 face=arial color=black>CannotFindServer.doc
    <br>
    <p><font size=3 face=arial color=black>HOSTS file is not found
    <br>
    <p><font size=3 face=arial color=black>LMHOSTS file
    <br>
    <p><font size=3 face=arial color=black>How to Setup PWS on NT
    <BR>
    <p><font size=3 face=arial color=black>Issdmin doc</BR>
    Please be patient while the document is download....</font>
    <font size=3 face=arial color=black><br>If you have any ideas please drop me a
    few words at [email protected] </font><br>
    <br>
    <br>
    </p>
    <p><!--#include file="Hits.asp"--> </p>
    </body>
    </html>
    ========= END OF FILE ===============

    Hi!
    This is a possible solution to your problem.
    import java.io.*;
    class AddressExtractor {
         public static void main(String args[]) throws IOException{
              //retrieve the commandline parameters
              String fileName = "default.html";
              if (args.length != 0)      fileName =args[0];
               else {
                   System.out.println("Usage : java AddressExtractor <htmlfile>");
                   System.exit(0);
              BufferedReader in = new BufferedReader(new FileReader(new File(fileName)));
              StreamTokenizer st = new StreamTokenizer(in);
              st.lowerCaseMode(true);
              st.wordChars('/','/'); //include '/' chars as part of token
              st.wordChars(':',':'); //include ':' chars as part of token
              st.quoteChar('\"'); //set the " quote char
              int i;
              while (st.ttype != StreamTokenizer.TT_EOF) {
                   i = st.nextToken();
                   if (st.ttype == StreamTokenizer.TT_WORD) {          
                        if (st.sval.equals("href")) {               
                             i = st.nextToken(); //the next token (assumed) is the  '=' sign
                             i = st.nextToken(); //then after it is the href value.               
                             getURL(st.sval); //retrieve address
              in.close();
         static void getURL(String s) {     
              //Check string if it has http:// and truncate if it does
              if (s.indexOf("http://") >  -1) {
                   s = s.substring(s.indexOf("http://") + 7, s.length());
              //check if not mailto: do not print otherwise
              if (s.indexOf("mailto:") != -1) return;
              //printout anything after http:// and the next '/'
              //if no '/' then print all
                   if (s.indexOf('/') > -1) {
                        System.out.println(s.substring(0, s.indexOf('/')));
                   } else System.out.println(s);
    }Hope this helps. I used static methods instead of encapsulating everyting into a class.

Maybe you are looking for

  • In iTunes, I cannot drag and drop music into my Ipod.

    Correction: I can drag and drop a music file, but then on the iPod, the music file shows up in gray, unplayable, and just doesn't end up transferring. I have dragged and dropped music files on two different computers, now it doesn't work on either on

  • Intermittent problem with Personal Hotspot

    Hello All I think either my iPad 2 or my iPhone 4 is mental.  Can anyone convince me otherwise? For some months now I have been experiencing an intermittent problem with tethering my iPad 2 to my iPhone 4 Personal Hotspot.  Sometimes it works without

  • Captured photos are not being saved - occasionally...

    Hi, I own a month-old Lumia 830. It took me a while before finding out that many of my photos that I took on many occasions are not saving, even though the screen is showing the word 'saving'. I usually do not necessarily preview the photos each time

  • Is the reception of iPhone 5c better than 5s.

    Was advised at a Telstra store that the reception of the iPhone 5s was worse than that of the 5c. Am thinking of upgrading from 4s. Has anyone experienced this?

  • How do I export an elements organiser album to iPhoto or hard drive?

    I have created albums on my elements organizer using the brilliant 'search for duplicates' feature thereby sorting out all unwanted repeated photos.  I now would like to export these newly organized albums to either iphoto or hard drive from the elem