How to use mutex in uploading file

Hi, All
I used myfaces upload component. It works all right for me. Because I had a lot of process for the uploaded file and it might take long. So I'd like page to return (tell users that the file is in process) after successfully upload the file and let another "thread" or something else continue to work on the file.
Is this possible to do? and how? Any code will be very welcome.
Thx

Just spawn a new Thread? Read on the Thread and Runnable API's.
Thread API: http://java.sun.com/javase/6/docs/api/java/lang/Thread.html
Runnable API: http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html
Cuncurrency tutorial: http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html

Similar Messages

  • How can i do the upload file function using tomcat library??

    how can i do the upload file function using tomcat library??

    Did you read the document for the library?
    If you can't figure it out, why don't you ask the people who provide the library?
    This has nothing to do with JavaMail.

  • How do I delete my uploaded files? I am on an Ipad.

    How do i delete my uploaded files? There is no trash button

    you must run the official iOS5 version, no developer version which likely is a beta . Use itunes 10.5 , connect your device, let it make the backups and then hit the "restore" button in itunes. This will download and install the one and only supported OS for your device.
    Once you have this on it, you can install all apps, including garageband.

  • How to get InputStream of uploaded file from request?

    The situation:
    Client is uploading xml file to server.
    <form METHOD=POST ENCTYPE = "multipart/form-data" action="SendFile" accept="text/xml">
              <input type="file" name="SentFile" />
              <input type="submit" value="go"/>
    </form>Then I need to parse data from file.
    I want to use method javax.xml.parsers.DocumentBuilder.parse(InputStream is)
    But, how to get InputStream of uploaded file from request?

    You cannot get the InputStream of the uploaded file directly. The InputStream you can obtain from request.getInputStream() contains a lot of other data as well as the uploaded file. You will have to parse the data in the InputStream to find the data that belongs to the file.
    A short cut is to use the HTTP Multipart File Upload available from www.jenkov.com. It simplifies file upload and makes it easy to obtain an InputStream for only the uploaded file. It also handles upload of multiple files. It is free, open source, Apache license, so if it doesn't fit your needs, you can always read the code and see how it works. Then write your own upload servlet.

  • How to use javap with jar files ?

    how to use javap with jar files ?
    thanks

    As long as the jar is on the class path, your gold. So,
    javap -classpath myjar.jar mypackage.MyClass
    Chuck

  • How to use a Windows Help File (.hlp) - URGENT

    Hello!
    Can anybody tell me how to use a windows help file (.hlp) in my Java application? Is there any possiblity to reference a specific topic (by Help Context-ID)?
    Thanks in advance,
    Phil

    try calling the Runtime.exec() method
    pass the paramter String as <filename>.hlp
    i donno about the context
    regards
    rohan

  • I use FireFTP to upload files. This past week the profilesuddenly stopped connecting. Ideas?

    I manage two Websites and use FireFTP to upload files for both of them due to FireFTP's ease of use. I've never had a problem connecting before last week. The files on the host (my computer) show, but there is no response when I click on the "Connect" button. These were already established profiles and have worked before, and I have made no changes. I've tried to make the connection fairly frequently over the past week (this has been going on for a full week now), and tried a few minutes ago to confirm there was still a problem. There is. Did I have only a limited time to use FireFTP? If so, I don't recall being advised of that when I downloaded and installed it. I'd gladly pay a nominal fee just to not have to learn another FTP app, although there are many free FTP apps available on the Internet. Further, Firefox itself is not working -- I can not see any Webpages using Firefox, although in using IE or Chrome, the Webpages I seek come up. In fact, I had to find your Website and fill out this support ticket via IE. What is going on with Firefox and FireFTP? Thx.

    If Firefox won't connect, as well as FireFTP not connecting, the most common reason would be a firewall block after the update. That and other reasons are discussed in the following support articles:
    * [[Fix problems connecting to websites after updating Firefox]]
    * [[Firefox can't load websites but other browsers can]]
    Anything there help?

  • Using jquery to upload files

    Hi
    I have uploaded files before but not using jquery but now am trying to use jquery so that my files uploads without page refreshing.
    This is my Jquery code. and below is the html code. Can any one help me with the jquery code so that I can get the data to the php script that process
    the variables.
    JQUERY:
    <script type="text/javascript">
    $(document).ready(function() {
       $("#photoform").submit(function() {
                                var phototitle = $("phototitle").val();
                                var photogenre = $("photogenre").val();
                                var photodesc = $("photodesc").val();
                                var photofield = $("photofield").val();
        $.post("Uploadfix.php", { phototitle: phototitle,
         photogenre: photogenre, photodesc: photodesc, photofield: photofield}, function(data) {
         $("#allresult").html(data);
       return false;
    //-->
    </script>
    PHP CODE:
    $phototitle=addslashes(strip_tags($_POST['phototitle']));
    $photogenre=addslashes(strip_tags($_POST['photogenre']));
    $photodesc=addslashes(strip_tags($_POST['photodesc']));
    $photo=$_FILES["photofield"]["name"];
    $type=$_FILES["photofield"]["type"];
    $size=$_FILES["photofield"]["size"];
    $temp_name=$_FILES["photofield"]["tmp_name"];
    $error=$_FILES["photofield"]["error"];
    echo "$phototitle";
    echo "<br/>";
    echo "$photo";
    echo "<br/>";
    echo "$type";
    echo "<br/>";
    html:
    <form id="photoform" method="post" enctype="multipart/form-data" action=''>
    //id variables:
    </form>
    How can I read in the file from jquery to the php sucessfully. NO SUCESS YET!
    Thanks.

    Hi Gramps
    Thank for the reply. If I use form action like the code below it works but I can not do validation.
    <script type="text/javascript" >
    /* $(document).ready(function() {
                $("#photoform").submit(function(e)         {
                $("#allresult").html('');
                $("#allresult").html('<img src="PHOTOTEST/loader.gif" alt="Uploading...."/>');
                $("#photoform").ajaxForm({
                            target: '#allresult'
            }).submit();
    </script>
    HTML:
    <form id='photoform' enctype='multipart/form-data' method='post' action='process.php'>
    </form>
    PHP:
    $example=$_POST['INPUT'];
    if($example>5)
    echo "input greater than 5 sorry.";
    else
    //process data
    The problem is this is echoed in a new page which is process.php. Instead of on a div on the page that is submitting the form. I know this is
    because of the form action. how can I make the validation appear on a div on same page?
    cheers.

  • How to change name of uploaded file

    I am using the a multi-part form and the pl/sql gateway to enable users to upload files to portal. The files automatically get stored in the wwdoc_document$ table. The key to the file is a column called "name" which consists of a sequence number and the file type e.g. 4747.gif.. I want to change this name to a different value.
    When I change it using the standard sql Update statement, none of the pdk apis work on the record; they all return errors. I am able to change this value as long as I use a unique value, I just can't run any of the wwdoc apis against the row after that.
    Does anyone know how to change this value for a given row???
    Mike Kleiman

    See Upload taglib in Coldtags suite:
    http://www.servletsuite.com/servlets/uptag.htm

  • How to use a packaged Jar File?

    Greetings to everyone reading this post!
    I have a query about a thing that seems to be basic but I don't know how to accomplish, here it goes:
    I have packaged a Simple application into a Jar file. this application contains a package like this:
    lib.demo, inside this package I have a Class named MyClass with some simple methods like this one:
    public void sayHi(String name){
    //implementation here
    }Now, I would like to Know how to use the Method sayHI(String name) from an entirely different Project. I have successfully included the Jar File as a Library(in the new Project), but I have I no Clue on How to invoke a Class inside my Jar library, and more Importantly, a method.
    Could anybody help me?

    if the "project" (not a Java-related system, it's IDE-specific) already includes the JAR file in its classpath (library), then all you need is to import the package/class and invoke the method, as such:
    // in your client code:
    import lib.demo.*;         // or, import lib.demo.MyClass;
    public class Test {
      public void inAMethod() {
        MyClass myC = new MyClass();
        myC.sayHi("say hi"); 
    }simple.

  • How to use Sharepoint 2013 img file

    Hi,
    I downloaded Sharepoint 2013 as an img file. I am trying to install it on VMWare 5.1 which only accepts ISO files. How can I convert the img file to ISO or what other workarounds are available?
    I already tried renaming the file to ISO, but it didn't work.
    Thanks

    Hi WaelS,
    If you want to use img file in VMWare, you may need to convert the img file to ISO, as VMWare doen't support img file.
    Please do as the followings to convert the img file to iso:
     1. Unzip the files
     2. Open a command prompt (Start > Run > type cmd, press Enter)
     3. Browse to the folder where the unzipped files are (cd "c:\Windows ISO Files")
     4. Considering that you are in the folder containing the files command prompt, type
           copy /b file1+file2+file3+file4+file5 file.iso
     4a. Check that the files have no extension. If they have, the command changes to something like:
           copy /b file1.ext+file2.ext+file3.ext+file4.ext+file5.ext file.iso
     4b. If there aren't *any* other files in the folder, typing this should be enough:
           copy /b *.* dvd_file.iso
    If you still have question about the issue, I suggest you can post a thread in corresponding forum, you will get more helpful information from there.
    Best Reagrds
    Zhengyu Guo
    TechNet Community Support

  • Plz suggest me How to use Third party jar files in ODI

    Hi all,
    I need to know how to use the third party jar files or our own customised jar file in ODI.
    regards
    palash

    Hi all,
    I am unable to implement..................
    I have one question, if I add any type 4 coneection supported jar file in my ODI_CLASSPATH can I use them in writing procedure to connect Databases
    I am trying to connect Oracle database by putting Ojdbc14.jar in the class path of ODI_CLASSPATH so that in my procedure I can use it .............but failed I dont know how to solve this problem.
    another thing Open Tools are delivered as a Java package (.zip or .jar) containing several files:
    A compiled Java .class file
    Other resources, such as icon files is it so ..............Then I can use full java apllication by preparing required bunch of classes and by set them appropriately in open tool
    need ur suggestion....
    regards
    palash

  • How to use webui ui:upload in eclipse 3.2

    Hi,
    I would like to use file upload using sun products.
    I tried with <ui:upload> but i am not able to render that component.
    my jsf:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://www.sun.com/web/ui" prefix="ui"%>
    <f:view>
    <html>
    <head>
    <title>Portfolio Analyzer</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="css/menu.css" />
    <link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
    </head>
            <ui:page id="page1">
                <ui:html id="html1">
                    <ui:body id="body1">
                        <ui:form id="form1">
                            <ui:upload id="fileUpload1" />
                        </ui:form>
                    </ui:body>
                </ui:html>
            </ui:page>
    </html>
    </f:view>my web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
         <display-name>
         GPJ</display-name>
         <context-param>
            <param-name>javax.faces.CONFIG_FILES</param-name>
            <param-value>/WEB-INF/faces-config.xml</param-value>
        </context-param>
          <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>server</param-value>
        </context-param>
        <context-param>
            <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
            <param-value>true</param-value>
            <!-- <description>
                This parameter tells MyFaces if javascript code should be allowed in the
                rendered HTML output.
                If javascript is allowed, command_link anchors will have javascript code
                that submits the corresponding form.
                If javascript is not allowed, the state saving info and nested parameters
                will be added as url parameters.
                Default: "true"
            </description>-->
        </context-param>
         <!-- Filter needed for File Upload component  -->
        <filter>
          <filter-name>UploadFilter</filter-name>
          <filter-class>com.sun.rave.web.ui.util.UploadFilter</filter-class>
          <init-param>
            <description>
              The maximum allowed upload size in bytes.  If this is set
              to a negative value, there is no maximum.  The default
              value is 1000000.
            </description>
            <param-name>maxSize</param-name>
            <param-value>1000000</param-value>
          </init-param>
          <init-param>
            <description>
              The size (in bytes) of an uploaded file which, if it is
              exceeded, will cause the file to be written directly to
              disk instead of stored in memory.  Files smaller than or
              equal to this size will be stored in memory.  The default
              value is 4096.
            </description>
            <param-name>sizeThreshold</param-name>
            <param-value>4096</param-value>
          </init-param>
    </filter>
        <filter-mapping>
          <filter-name>UploadFilter</filter-name>
          <servlet-name>Faces Servlet</servlet-name>
        </filter-mapping>
    <!--
    Where this servlet refer to the faces context
    -->
    <servlet>
         <servlet-name>Faces Servlet</servlet-name>
         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
         <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <!--
    This gives the welcome page as First.jsp
    -->
    <welcome-file-list>
            <welcome-file>faces/addCampaignGroup.jsp</welcome-file>
    </welcome-file-list>
    <!-- Faces Servlet Mapping -->
      <!--<servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
          --><login-config>
      <auth-method>BASIC</auth-method>
    </login-config>
    <!--
    either this servlet or the listener can be given to refer the application context
    -->
    <!--<servlet>
                 <servlet-name>context</servlet-name>
                 <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>      
                <load-on-startup>1</load-on-startup>
    </servlet>
    -->
    <!--
    This listener is to get the first jsp page   
    -->
    <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>
    </web-app>I think i have some problem with my web.xml
    Could anyone pls help me regarding.
    Thanks,
    Ambika.

    I just tested it at my Eclipse environment. It was set to UTF-8 and the following line was not allowed:
    String &#35430;&#39443; = "&#35430;&#39443;";When I set the encoding to UTF-16, it was accepted. If you still fails in this somehow, consult the eclipse boys, as said before.
    However. In name of reusability I don't recommend to use other languages than English thoroughout the whole Java code. Maybe only in javadocs. But still, English is preferred over all other languages. The core Java API itself is also all in English.

  • How do I update 128kbs uploaded files?

    I have a bunch of CDs the were previously in 128kbs when I first ran iTunes Match but I've now re-ripped my whole collection in AAC Lossless and I'd like to replace the lower quality versions in the cloud with the new high quality versions or at least the auto 256kbs version that gets sent instead of the lossless file.
    I've looked all over and can't find anyone who has tried and thing similar. It would be a huge pain to manually delete albums from iTunes Match and then reimport.

    iTunes Match does not actually upload ALL of your songs.  It only uploads the ones that are NOT matched.  In other words, if a song that you have is matched to a song in the iTunes Store catalog, the file that is already stored on Apple server is used.  That song file is 256 kbps AAC.  Your song file is not uploaded.
    That's one reason the service only costs $25 per year, because most of the songs people have are already collectively stored on Apple's servers, because the same song is sold by the iTunes Store.  Only songs that do NOT match are uploaded and stored in iCloud individually, per user.
    Also, this article says that song files that are in ALAC (Apple Lossless) format are "transcoded" to AAC 256 kbps locally, before they are uploaded to iCloud.
    http://support.apple.com/kb/HT4914
    So, whether your songs match or not, they are not going to be stored in Apple Lossless format in iCloud.

  • How to use/configure JAVA beans file in Forms10g?

    Hi!
    I'm using Forms10g. I need to use few java beans file in my forms. How do i call it and configure it. So, that i can access all the features of this file in Forms.
    Regards.
    Satyaki De.

    Hello,
    Java Beans Integration
    http://forms.pjc.bean.over-blog.com/article-4018331.html
    Hope it helps,
    Jose.

Maybe you are looking for

  • Commercail invoice qty should not be greater than PO qty.

    Hi, We have a requirement where, system should check for the commercial qty with PO qty and if commercial invoice qty exceeds than PO qty, system should give an error. This is required to avoid duplicate payment of customs duties. This functionality

  • My computer crashed and sn doesn't work

    My computer crashed last week but when I try to redownload the CS5 from my external harddrive it does not work and when I try to download from adobe.com it tells me my serial number is invalid but is from the box.  What can I do to reinstall this on

  • Re: (forte-users) loadbalancing a service object

    Hi, If you need to share the values between your So, you can find a sample on http://perso.club-internet.fr/dnguyen It was designed to show how to manage shared states between replicates using fail over. It could also be used for load-bancing. A bett

  • Applying parent keywords

    How do I automatically apply parent keywords in Lightroom 3? Apparently there's a setting in Keyword Preferences, but I can't locate Keyword Preferences anywhere in the Library module.

  • Entourage data transfer from old computer

    Firewired Entourage Microsoft User info from my PowerBook G4 to the new MacBook Pro>Documents then launched Entourage expecting the old data to transfer. Didn't happen. Even tried to put a copy in hard drive. Anyone know the answer?