How to send "processing" message to user while working

          Here is a complete example of a servlet kicking off long-running task and displaying messages about it's progress (without creating new threads and without using JMS):
          Test.java:
          import java.io.*;
          import java.util.*;
          import javax.servlet.*;
          import javax.servlet.http.*;
          import weblogic.time.common.*;
          import weblogic.common.*;
          import weblogic.jndi.*;
          import javax.naming.*;
          * execute stuff on weblogic's execute threads
          * usage:
          * <pre>
          * class Foo implements Runnable {
          * public void run() {
          * Foo foo = new Foo(...);
          * MyThread thr = new MyThread(foo);
          * thr.start();
          * </pre>
          class MyThread implements Schedulable, Triggerable {
          boolean done = false;
          Runnable runnable = null;
          ScheduledTriggerDef std;
          public void run() {
               if(runnable != null) {
               runnable.run();
          public MyThread() {
          public MyThread(Runnable runnable) {
               this.runnable = runnable;
          public boolean start() {
               boolean ok = false;
               try {
               T3ServicesDef t3 = (T3ServicesDef)(new InitialContext()).lookup("weblogic.common.T3Services");
               std = t3.time().getScheduledTrigger(this, this);
               std.schedule();
               ok = true;
               } catch(NamingException ne) {
               System.out.println(ne.getMessage());
               } catch(TimeTriggerException tte) {
               System.out.println(tte.getMessage());
               return ok;
          public void trigger(Schedulable sched) {
               try {
               run();
               } catch(Throwable t) {
               System.out.println(t);
               done = true;
          public long schedule(long time) {
               return done ? 0 : time;
          class LongTask implements Runnable {
          public int status = 0;
          public long timeStarted;
          public long timeCompleted;
          int seconds;
          LongTask(int seconds) {
               this.seconds = seconds;
          public void run() {
               status = 1;
               timeStarted = System.currentTimeMillis();
               try {
               // simulate long running process
               Thread.sleep(seconds * 1000);
               } catch(InterruptedException ie) {}
               timeCompleted = System.currentTimeMillis();
               status = 2;
          public class Test extends HttpServlet {
          public void service(HttpServletRequest req, HttpServletResponse res)
               throws ServletException, IOException {
               String msg = null;
               HttpSession session = req.getSession();
               LongTask longTask = (LongTask)session.getAttribute("longTask");
               if(longTask == null) {
               session.setAttribute("longTask", longTask = new LongTask(10));
               (new MyThread(longTask)).start();     
               switch(longTask.status) {
               case 0:
               msg = "Waiting";
               break;
               case 1:
               msg = "In progress";
               break;
               case 2:
               msg = "Done, started:" + longTask.timeStarted + " completed:" + longTask.timeCompleted;
               session.removeAttribute("longTask");
               break;
               PrintWriter out = new PrintWriter(new OutputStreamWriter(res.getOutputStream()));
               res.setContentType("text/html");
               out.println("<html><body>");
               out.println("Your request status:" + msg);
               out.println("</body></html>");
               out.flush();
               out.close();
          Dimitri
          

Cool.
          Cameron Purdy
          [email protected]
          http://www.tangosol.com
          WebLogic Consulting Available
          "Dimitri Rakitine" <[email protected]> wrote in message
          news:39e21527$[email protected]..
          >
          > That didnt look very good, so here it is:
          > http://dima.dhs.org/misc/LongRunningTask.html
          >
          > Dimitri
          

Similar Messages

  • Best Practices Question: How to send error message to SSHR web page.

    Best Practices Question: How to send error message to SSHR web page from custom PL\SQL procedure called by SSHR workflow.
    For the Manager Self-Service application we’ve copied various workflows which were modified to meet business needs. Part of this exercise was creating custom PL\SQL Package Procedures that would gather details on the WF using them on custom notification sent by the WF.
    What I’m looking for is if/when the PL\SQL procedure errors, how does one send an failure message back and display it on the SS Page?
    Writing information into a log or table at the database level works for trouble-shooting, but we’re looking for something that will provide the end-user with an intelligent message that the workflow has failed.
    Thanks ahead of time for your responses.
    Rich

    We have implemented the same kind of requirement long back.
    We have defined our PL/SQL procedures with two OUT parameters
    1) Result Type (S:Success, E:Error)
    2) Result Message
    In the PL/SQL procedure we always use below construct when we want to raise any message
    hr_utility.set_message(APPL_NO, 'FND_MESSAGE_NAME');
    hr_utility.raise_error;
    In Exception block we write below( in successful case we just set the p_result_flag := 'S';)
    EXCEPTION
    WHEN APP_EXCEPTION.APPLICATION_EXCEPTION THEN
    p_result_flag := 'E';
    p_result_message := hr_utility.get_message;
    WHEN OTHERS THEN
    p_result_flag := 'E';
    p_result_message := hr_utility.get_message;
    fnd_message.set_name('PER','FFU10_GENERAL_ORACLE_ERROR');
    fnd_message.set_token('2',substr(sqlerrm,1,200));
    fnd_msg_pub.add;
    p_result_message := fnd_msg_pub.get_detail;
    After executing the PL/SQL in java
    We have written some thing similar to
    orclStmt.execute();
    OAExceptionUtils.checkErrors (txn);
    String resultFlag = orclStmt.getString(provide the resultflag bind no);
    if ("E".equalsIgnoreCase(resultFlag)){
    String resultMessage = orclStmt.getString(provide the resultMessage bind no);
    orclStmt.close();
    throw new OAException(resultMessage, OAException.ERROR);
    It safely shows the message to the user with all the data in the page.
    We have been using this construct for a long time for all our projects. They are all working as expected.
    Regards,
    Peddi.

  • How to send error message to forms from Database Trigger

    Hi, Please help me to send error message to forms from Database Trigger?
    RgDs,
    Madesh.R.M

    You are correct, the On-Error trigger is a Forms trigger. However, if your Form is going to display the error generated by the database stored procedure or trigger - you might not see the database error in your Form unless you check the DBMS_ERROR_CODE in the On-Error trigger and manually display the Error Code and associated Text. I've see this happen with a co-worker. The Form she was working on was based on a table with an Before-Insert trigger. Because she was not explicitely handling the error from the Before-Insert trigger in the Forms On-Error trigger, her Form appeared to halt for no reason at all. Once she added code to the On-Error trigger in the Form to handle the DBMS_ERROR_CODE, she discovered the trigger was producing an error and was able to show the error to the user in the On-Error trigger.
    I understand the desire to keep as much as possbile in the database, but with that comes some extra coding in your Forms to handle this. This extra coding could easily be placed in a Forms Library, attached to a Form and called in the On-Error trigger. Your code could look like this:
    DECLARE
       /*This example assumes you have an Alert defined
          in your Form called: 'ERROR' */  
       al_id    ALERT;
       al_text  VARCHAR2(200);  /* Max text of a Forms Alert message*/
       al_btn   NUMBER;
    BEGIN
    IF DBMS_ERROR_CODE != 0 THEN
       /* Error code is ORA-00000 Normal Successful completion
           So only handle non-zero errors  */
       al_text := DBMS_ERROR_CODE||':'||DBMS_ERROR_TEXT;
       al_id := Find_Alert('ERROR');
       set_alert_property(al_id, alert_message_text, al_text);
       al_btn := show_alert(al_id);
    END IF;
    END;Your original question was "How to send error message to forms from Database Trigger?" The answer is you don't because Forms already gets the database error code and database message through the Forms DBMS_ERROR_CODE and DBMS_ERROR_TEXT functions. Look these up in the Forms help and it should clear things up for you.
    Craig...
    Edited by: CraigB on Jun 14, 2010 4:49 PM
    Edited by: CraigB on Jun 14, 2010 4:49 PM
    Edited by: CraigB on Jun 14, 2010 4:50 PM
    Edited by: CraigB on Jun 14, 2010 4:51 PM
    Edited by: CraigB on Jun 14, 2010 4:51 PM

  • Send Process Message Error

    Hi
    While sending process message (PI_PHST) to change the phase  status to finish, I get the following error:
    "Sequence of time events not adhered to => Message could not be processed by destination PI05 COCI_Confirm_Operation"
    And then on sending the same message again, it gets through without error.
    Can any one kindly suggest, why this does not work the first time and only for this phase as other phases in the same process gets through successfully.
    Thanks in advance
    -Rahul

    Dear all,
    we had the same problem and I was just searching the error message and found this blog.
    Rupesh wrote the reason of this problem, but I didn't understand this at the beginning:
    Rupesh Brahmankar wrote:
    The above-mentioned problem can only occur if process messages, which confirm the time events for the same phase, succeed each other directly and are sent together. Locking problems can occur here so that a process message cannot be sent successfully. The message then has the status 'partially sent'.
    The problem occur, because we send in PI_PHST the for start and stop the same time.
    Example
    Start message:
    PPPI_EVENT_TIME = 102700 (just a time 10:27:00)
    PPPI_PHASE_STATUS = 0001 (0001 means start)
    End Message:
    PPPI_EVENT_TIME = 102700 (just a time 10:27:00)
    PPPI_PHASE_STATUS = 0002 (0002 means stop)
    Because of same time, the message could not be processed.
    Perhaps this more detailed description could help someone. :-)
    regards
    Chris

  • Tutorial announcement :: How to send a message(s) with attachments ::

    How to send a message with attachments Using Adobe Dreamweaver CS3 and Developer Toolbox...
    - In this tutorial you will use Developer Toolbox features to build a simple contact us form with the advantage to upload file with your message and send this file via e-mail as an attachments.
    Using This application will allow to:
    * insert records into database and then send them via e-mail.
    * upload files to the server.
    * send message with uploaded files as attachments.
    This tutorial contains one part
    1. insert record, and then send it by email with (attachments).
    By following this tutorial section, you will create:
    * Page for inserting records.
    * Page for thank you when the message is sent.
    :: To View the tutorials ::
    :: Online Demo ::
    Brought t you by:
    www.developer-online.com

    Open the photo, assuming it is in Photos, and then in the lower left corner under the photo is a box with an up-pointing arrow.  Tap that box, and then the photo will have a blue circle with a checkmark in its lower right corner and the word Next at the upper right.  Tap Next, then choose how you want to send the photo, by text message, email, and so on.  Simply address the method you have chosen and put in any text you want to include.

  • How to send a message with a photo to a company?

    I AM S DISABLED SENIOR WITH SHORT-TERM MEMORY. PLEASE TELL ME HOW TO SEND A MESSAGE AND INCLUDE A PHOTO I HAVE ON MY i-PHONE 5S?
    THANK YOU IN ADVANCE FOR THE ASSISTANCE.
    FLIGHTLEADER-1

    Open the photo, assuming it is in Photos, and then in the lower left corner under the photo is a box with an up-pointing arrow.  Tap that box, and then the photo will have a blue circle with a checkmark in its lower right corner and the word Next at the upper right.  Tap Next, then choose how you want to send the photo, by text message, email, and so on.  Simply address the method you have chosen and put in any text you want to include.

  • How to send a message to a pager? URGENT

    Hi everybody
    I wanna know how to send a message (or a caller's number) to a pager from Form.

    Hi,
    if you can find a public Webservice on the Web that provides this functionality, you could use JDeveloper and the Forms Java Importer to call it from Forms.
    JDeveloper is helpful in creating the Java skeletton to communicate with the Webservice. As similar issue is covered in teh Forms9i demos by the example of a currency converter.
    Frank

  • How to send ALL message that is in Outbox without ...

    How to send ALL message that is in Outbox without doing it one by one sending?
    All status is either deferred, or failed. is there a way that can auto resend but not doing it one by one?
    I have hundred of message un-send and stuck in outbox.
    Please help.

    try select options then scroll down to mark mark all if this does not work you will either have to delete or resend,you can delete all messages via the same mark all option your best of to just remove,also keep your inbox to a minimum
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

  • How to send text messages using my Laptop

    How to send text messages written on my Laptop on my Curve8520 with Orange network?

    umm... you don't. SMS is a function of the BlackBerry, not your PC.
    There could a desktop software for SMS, but I don't know what it would be.
    **edit, well this looks like it would work.
    http://download.cnet.com/Desktop-SMS/3000-10440_4-​10340430.html
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • HT3529 how to send group messages in ios 7.0.2

    please tell me how to send group messages in iphone 5 with ios7.0.2

    Oh yeah, now I remember that.
    But I also remember that you had to go all the way to the start of the message to gain access to the current contact information. Where as in iOS7 that button you mentioned is the contact information. Personally I perfer iOS7. I don't delete my messages, so this is better for me.
    However, it wouldn't be a bad idea to add an Edit button in that sub menu that shows up when you touch the upper right button. Currently there are opitions for "Phone", "FaceTime" and "Information" on the contact.
    KOT

  • How to send picture message using J2ME sms APIs?

    Hi,
    I experiment with SMS APIs, i successfully send simple text message. now i want to send picture message, how to send picture message using J2ME APIs.
    please guide me.
    guna.

    I experienced in coding sending and receiving sms in J2ME. Besides, I also esperienced in coding reading a binary file in a applicaition jar. But I never done these both together. Hence Im not sure it works or not. Below is the example to open and read a binary file:
    InputStream oInputStream = getClass().getResourceAsStream( "/picture.png" );
    if(oInputStream == null) {
    //File does not exist;
    throw new Exception("File not found");
    //Read the binary file and copy it to a byte array
    byte[] abyPicture = new byte[oInputStream.available()];
    oInputStream.read(abyPicture );

  • How to creat Process messages automatically through PI sheet saved?

    How to creat Process messages automatically through PI sheet to the Process message destinations.

    Hi Jessie,
    When you process instruction category PROD_3 in master recipe, the process message PI_PROD is created.
    After releasing process order, you have to create control recipe. Upon successful creation of control recipe, process instructions will get generated. Check the error log for control recipe creation for error if any. 
    Note that control recipe will be generated only with order status "Released".
    You have to sent this control recipe to process control (CO53).
    Hope it is helpful.
    Regards,
    Sachin

  • How do I process messages with status = "Holding"

    Hi,
    How do I process messages with status = "Holding" from the RWB-Message Monitoring - Adapter Engine?
    I did a quick scan for records with errors in the same queue (ConversationID), but could not find any.
    I tried to cancel the one with the smallest sequential number, but I got the error - "Unable to cancel 1 of 1 messages; update the status"
    Please help.
    Thanks
    Sudheer

    Hi,
      "Holding comes into play when ur scenario is having multiple inbound interfaces and you checked "Maintained order at runtime"in interface determination in ID. Suppose  message will hit first inbound interface once it is successful then it will hit second inbound interface. If first inbound interface fails then most of the message will be in "Holding" status depends upon XI AF queues ID.
    I did a quick scan for records with errors in the same queue (ConversationID), but could not find any.
    You will not find bcoz of AE archiving settings.
    Try to check the with business guys, whether they need the order of processing. If not the case try to Uncheck the box "Maintain Order at runtime".
    Regards,
    Rao.Mallikarjuna

  • Could you some one help me how to send a message on twitter using Oracle SOA?

    Hi Team,
              I am trying to send a message from Oracle SOA to Twitter, But i am not able to do the scenario.Could you some one help me how to send a message on twitter using Oracle SOA?
    Regards,
    Kiran

    Very challenging and doubtful at the same time !
    I don't think, its going to be a straight-forward one... Read about OAuth twitter authentication, before you try to post tweets.

  • How to send text messages on iPad 2

    I just bought my iPad 2 and I can't figure out how to send text messages. Can some one help me out please

    Settings > Messages. Sign in with your Apple ID.
    Then open the green Messages app, click this to start a new conversation. Select a contact who is also running iOS 5 and has iMessage enabled and text away.

Maybe you are looking for

  • How to delete ALL contacts in Address Book 10.6.3.(1091) in Macbook?

    I made no effort ever to add the contents of my iPhone to my Macbook. Ever. Right now in my Skype app that I have only Just downloaded have I just found ALL of my iPhone contacts in it's contact list. NOT GOOD. I am looking for a way to remove my iPh

  • Can I skip "Complete Toning in Adobe Camera Raw"

    I select some pictures in Lightroom and then choose Edit In -> Photoshop HDR Pro. If I choose 32 Bit, there is an option box for "Complete Toning in Adobe Camera Raw". If I do NOT check this box, am I losing something? That is, if I want to do all of

  • Javadoc, generics and inner classes

    I have implemented a generic class DiGraph with inner classes Vertex and Edge: public class DiGraph<V,E> implements Iterable<DiGraph<V,E>.Vertex> {    public Vertex addVertex(V value) {...}    public Iterator<DiGraph<V,E>.Vertex> iterator() {... }   

  • How to Pass a GUID as a parameter to Powershell commandlet from c#

    I'm building a wrapper around custom built PowerShell command lets. I'm having difficulties in passing a GUID parameter to a command let below which requires a GUID input from c# code. Guid monid = Guid.Empty; string monruleid = txt_monRuleId.Text.To

  • Map UserID to alternate field in LDAP sync

    I've been asked by our CIO whether there is a way to map the userID field in CallManager to something other than samAccountName in the LDAP attributes...I'm seeing that it is hard-coded though.  Has anyone ever come across a similar issue and have yo