How to send an object thru "response" object

I need to send an object to a servlet thru my jsp page.
When I created an ObjectOutputStream passing response.getOutStream as parameter, I am getting an IllegalStateException. I have checked that the response object is not being used anywhere else.
Please help me out.
Thanks a ton

Try this and let me know
try {
ObjectOutputStream p = new                          ObjectOutputStream(
     response.getOutputStream() );
p.writeObject("what ever object");
p.flush();
p.close();
}catch (Exception e) {
e.printStackTrace();
I use this in my code and it works perfectly. If it still does not work, send me the entire code that you have written and I shall try to look into it and see whats going wrong.
--ramsci                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How to send data to bam data object through java code

    how to send data to bam data object through java code

    I've made a suggestion in other thread: https://forums.oracle.com/thread/2560276
    You can invoke BAM Webservices (Using Oracle BAM Web Services) or use JMS integration using Enterprise Message Sources (http://docs.oracle.com/cd/E17904_01/integration.1111/e10224/bam_ent_msg_sources.htm)
    Regards
    Luis Fernando Heckler

  • How to send a mail thru Oracle

    Hello Every one ,
    Can u plz tell me the way to send a mail thru oracle...................

    Follow the below steps..........
    INTRODUCTION:
    This bulletin explains how to programmatically send a fax/email message from a
    Forms/Reports application via Microsoft Exchange without any kind of user
    interaction. It shows the general usage of the 'Mail' package as well as a fully
    coded Forms sample application.
    The concept of OLE (Object Linking and Embedding) automation is used to control
    the OLE server application (Microsoft Exchange) using the client application.
    The client in this case may be a Developer/2000 Forms or Reports application. It
    uses the objects and methods exposed by the OLE Messaging Library which are
    much more robust than the MSMAPI OCX controls and allow access to many more MAPI
    properties.
    Oracle provides support for OLE automation in its applications by means of the
    OLE2 built-in package. This package contains object types and built-ins for
    creating and manipulating the OLE objects. Some of these built-ins for e.g.
    OLE2.create_obj, OLE2.invoke, OLE2.set_property have been extensively used in
    the code.
    GENERAL USAGE:
    The Mail package contains three procedures:
    1. Procedure Mail_pkg.logon( profile IN varchar2 default NULL);
    Use this procedure to logon to the MS Exchange mail client. The procedure
    takes a character argument which specifies the Exchange Profile to use for
    logon. Passing a NULL argument to the logon procedure brings up a dialog box
    which asks you to choose a profile from a list of valid profiles or create a new
    one if it doesn't exist.
    2. Procedure Mail_pkg.send(
    --------- Recipient IN varchar2,
    Subject IN varchar2 default NULL,
    Text IN varchar2 default NULL,
    Attachment IN varchar2 default NULL
    This is the procedure that actually sends the message and attachments, if
    any, to the recipient. The recipient may be specified directly as a valid email
    address or as an alias defined in the address book. If the message is intended
    for a fax recipient then a valid alias must be used that is defined as a fax
    address in the address book.
    3. Procedure Mail_pkg.logoff;
    This procedure closes the Exchange session and deallocates the resources used
    by the OLE automation objects.
    SAMPLE FORMS APPLICATION:
    1. Create the Mail Package using the following two Program Units:
    (a) Mail Package Spec
    (b) Mail Package Body
    Mail Package Spec:
    PACKAGE Mail_pkg IS
    session OLE2.OBJ_TYPE; /* OLE object handle */
    args OLE2.LIST_TYPE; /* handle to OLE argument list */
    procedure logon( Profile IN varchar2 default NULL );
    procedure logoff;
    procedure send( Recp IN varchar2,
    Subject IN varchar2,
    Text IN varchar2,
    Attch IN varchar2
    END;
    Mail Package Body:
    PACKAGE BODY Mail_pkg IS
    session_outbox OLE2.OBJ_TYPE;
    session_outbox_messages OLE2.OBJ_TYPE;
    message1 OLE2.OBJ_TYPE;
    msg_recp OLE2.OBJ_TYPE;
    recipient OLE2.OBJ_TYPE;
    msg_attch OLE2.OBJ_TYPE;
    attachment OLE2.OBJ_TYPE;
    procedure logon( Profile IN varchar2 default NULL )is
    Begin
    session := ole2.create_obj('mapi.session');
    /* create the session object */
    args := ole2.create_arglist;
    ole2.add_arg(args,Profile);/* Specify a valid profile name */
    ole2.invoke(session,'Logon',args);
    /* to avoid the logon dialog box */
    ole2.destroy_arglist(args);
    End;
    procedure logoff is
    Begin
    ole2.invoke(session,'Logoff');
    /* Logoff the session and deallocate the */
    /* resources for all the OLE objects */
    ole2.release_obj(session);
    ole2.release_obj(session_outbox);
    ole2.release_obj(session_outbox_messages);
    ole2.release_obj(message1);
    ole2.release_obj(msg_recp);
    ole2.release_obj(recipient);
    ole2.release_obj(msg_attch);
    ole2.release_obj(attachment);
    End;
    procedure send( Recp IN varchar2,
    Subject IN varchar2,
    Text IN varchar2,
    Attch IN varchar2
    )is
    Begin
    /* Add a new object message1 to the outbox */
    session_outbox := ole2.get_obj_property(session,'outbox');
    session_outbox_messages := ole2.get_obj_property(session_outbox,'messages');
    message1 := ole2.invoke_obj(session_outbox_messages,'Add');
    ole2.set_property(message1,'subject',Subject);
    ole2.set_property(message1,'text',Text);
    /* Add a recipient object to the message1.Recipients collection */
    msg_recp := ole2.get_obj_property(message1,'Recipients');
    recipient := ole2.invoke_obj(msg_recp,'add') ;
    ole2.set_property(recipient,'name',Recp);
    ole2.set_property(recipient,'type',1);
    ole2.invoke(recipient,'resolve');
    /* Add an attachment object to the message1.Attachments collection */
    msg_attch := ole2.get_obj_property(message1,'Attachments');
    attachment := ole2.invoke_obj(msg_attch,'add') ;
    ole2.set_property(attachment,'name',Attch);
    ole2.set_property(attachment,'position',0);
    ole2.set_property(attachment,'type',1); /* 1 => MAPI File Data */
    ole2.set_property(attachment,'source',Attch);
    /* Read the attachment from the file */
    args := ole2.create_arglist;
    ole2.add_arg(args,Attch);
    ole2.invoke(attachment,'ReadFromFile',args);
    ole2.destroy_arglist(args);
    args := ole2.create_arglist;
    ole2.add_arg(args,1); /* 1 => save copy */
    ole2.add_arg(args,0); /* 0 => no dialog */
    /* Send the message without any dialog box, saving a copy in the Outbox */
    ole2.invoke(message1,'Send',args);
    ole2.destroy_arglist(args);
    message('Message successfully sent');
    End;
    END;
    2. Create a block called MAPIOLE with the following canvas layout:
    |-------------------------------------------------------------|
    | |
    | Exchange Profile: |====================| |
    | |
    | To: |============================| |
    | |
    | Subject: |============================| |
    | |
    | Message: |============================| |
    | | | |
    | | | |
    | | | |
    | | | |
    | | | |
    | |============================| |
    | |-----| |
    | Attachment: |============================| |SEND | |
    | |-----| |
    |-------------------------------------------------------------|
    The layout contains 5 text-itmes:
    - Profile
    - To
    - Subject
    - Message (multiline functional property set to true)
    - Attach
    and a 'Send' button with the following WHEN-BUTTON-PRESSED trigger:
    mail_pkg.logon(:profile);
    mail_pkg.send(:to,:subject,:message,:attch);
    mail_pkg.logoff;

  • How to send an attachment thru mail in SAP?

    Hi all,
    I have an file which has been sent by the customer. The file type may vary each & every week (sometimes XLS, sometimes CSV & sometimes notepad). This file has to be sent to another person thru mail as an attachment.
    Is it possible to send thru the fun mod 'SO_SEND_NEW_*'.
    If so how to send as attachment. If not thru this fun mod, how to send?
    Thanks,
    Vijay.

    I am enclosing the sample code to trigger an email, The logic for this is in comments, check this I am shure yuor problem will be solved.
    *& Report ZGBL_SLA_PER
    REPORT zgbl_sla_per NO STANDARD PAGE HEADING LINE-COUNT 26(3) MESSAGE-ID
    zmsg2.
    DECLARATION OF DB TABLES
    TABLES: zncrfid, zrule_id.
    DECLARATION OF INTERNAL TABLES
    DATA: BEGIN OF ncrf OCCURS 0,
    zncrf_id(15) TYPE c,
    zncrf_l4_name(60) TYPE c,
    z9gl_sla_flag(1) TYPE c,
    zowners(30) TYPE c,
    zowners_value(30) TYPE c,
    zdate_changed(8) TYPE n,
    ztime_changed(6) TYPE n,
    END OF ncrf.
    *DATA: NCRF LIKE ZNCRFID OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF it_ruleid OCCURS 0,
    zrule_id(10) TYPE c,
    zowners(30) TYPE c,
    zowners_value(30) TYPE c,
    END OF it_ruleid.
    *data: wa like ncrf occurs 0 with header line.
    DATA: BEGIN OF itab OCCURS 0,
    zncrf_id(15) TYPE c,
    zncrf_l4_name(60) TYPE c,
    z9gl_sla_flag(1) TYPE c,
    zowners(30) TYPE c,
    zowners_value(30) TYPE c,
    zdate_changed(8) TYPE n,
    ztime_changed(6) TYPE n,
    END OF itab.
    data: file(10) type c,
    dates type date.
    EMAIL DECLARATION
    *CONSTANTS: c_subject LIKE sodocchgi1-obj_descr VALUE 'Subject',
    *c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
    *DATA: g_time TYPE char8,
    *g_email(40) TYPE c,
    *g_sent_all(1) TYPE c,
    *g_doc_data LIKE sodocchgi1,
    *g_error TYPE sy-subrc.
    *DATA: i_message LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    *i_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    *i_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
    *DATA: BEGIN OF mailid OCCURS 0,
    zemail_id TYPE zrule_id-zemail_id,
    END OF mailid.
    *data: mailid like zrule_id occurs 0 with header line.
    UPLOADING FLAT FILE TO INTERNAL TABLE NCRF
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'C:\VAMSY\file.txt'
    filetype = 'ASC'
    has_field_separator = 'X'
    HEADER_LENGTH = 0
    READ_BY_LINE = 'X'
    DAT_MODE = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    CHECK_BOM = ' '
    IMPORTING
    FILELENGTH =
    HEADER =
    TABLES
    data_tab = ncrf[]
    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.
    ELSE.
    IF sy-subrc EQ 0.
    Checking internal table ncrf is empty then
    *delete records from TABLE ZNCRF_ID ******************************
    IF ncrf[] IS INITIAL.
    MESSAGE i003(ZMSG2).
    ELSE.
    DELETE FROM zncrfid.
    ENDIF.
    *****Values are read from rule table and checking owner and owner_value
    *from zrule_id table and inserted into ZNCRFID **************
    SELECT * FROM zrule_id INTO CORRESPONDING FIELDS OF TABLE it_ruleid
    WHERE zrule_id IN ('OWNER1', 'OWNER2').
    append IT_RULEID.
    LOOP AT ncrf WHERE z9gl_sla_flag EQ 'Y'.
    READ TABLE it_ruleid WITH KEY zowners = ncrf-zowners
    zowners_value = ncrf-zowners_value.
    IF ncrf-zowners = it_ruleid-zowners AND ncrf-zowners_value =
    it_ruleid-zowners_value AND ncrf-z9gl_sla_flag ='Y'.
    itab-zncrf_id = ncrf-zncrf_id.
    itab-zncrf_l4_name = ncrf-zncrf_l4_name.
    itab-z9gl_sla_flag = ncrf-z9gl_sla_flag.
    itab-zdate_changed = sy-datum.
    itab-ztime_changed = sy-uzeit.
    itab-zowners = it_ruleid-zowners.
    itab-zowners_value = it_ruleid-zowners_value.
    APPEND itab.
    ENDIF.
    ENDLOOP.
    modify database table zncrfid FROM ITAB
    LOOP AT itab.
    WRITE:/ itab-zncrf_id, itab-zncrf_l4_name, itab-z9gl_sla_flag,
    itab-zowners, itab-zowners_value, itab-zdate_changed,
    itab-ztime_changed.
    zncrfid-zncrf_id = itab-zncrf_id.
    zncrfid-zncrf_l4_name = itab-zncrf_l4_name.
    zncrfid-z9gl_sla_flag = itab-z9gl_sla_flag.
    zncrfid-zowners = itab-zowners.
    zncrfid-zowners_value = itab-zowners_value.
    zncrfid-zdate_changed = itab-zdate_changed.
    zncrfid-ztime_changed = itab-ztime_changed.
    INSERT INTO zncrfid VALUES zncrfid.
    ENDLOOP.
    ENDIF.
    ENDIF.
    *CALL FUNCTION 'DATE_TO_DAY'
    EXPORTING
    DATE = sy-datum
    IMPORTING
    WEEKDAY = file.
    **CHECKING FOR THE FIRST MONDAY OF THE MONTH.
    dates = sy-datum.
    shift dates by 6 places left.
    if file CO 'monday' and dates < 7 and dates >= 1.
    else.
    message e004(zmsg2).
    endif.
    EMAIL SEND TO OWNERS LIST
    **Fill the mail body in i_message.
    get email id's from database into internal table et_mailid
    Fill the document data.
    *g_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
    *g_doc_data-obj_langu = sy-langu.
    *g_doc_data-obj_name = 'SAPRPT'.
    *g_doc_data-obj_descr = c_subject .
    *g_doc_data-sensitivty = 'F'.
    Describe the body of the message
    Information about structure of data tables
    *CLEAR i_packing_list.
    *REFRESH i_packing_list.
    *i_packing_list-transf_bin = space.
    *i_packing_list-head_start = 1.
    *i_packing_list-head_num = 0.
    *i_packing_list-body_start = 1.
    *DESCRIBE TABLE i_message LINES i_packing_list-body_num.
    *i_packing_list-doc_type = 'RAW'.
    *APPEND i_packing_list.
    Add the recipients email address
    *LOOP AT mailid.
    *CLEAR i_receivers.
    *i_receivers-receiver = mailid-zemail_id.
    *i_receivers-rec_type = 'U'.
    *i_receivers-com_type = 'INT'.
    *i_receivers-notif_del = 'X'.
    *i_receivers-notif_ndel = 'X'.
    *APPEND i_receivers.
    *ENDLOOP.
    Call the FM to post the message to SAPMAIL
    *CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    *EXPORTING
    *document_data = g_doc_data
    *put_in_outbox = 'X'
    *commit_work = 'X'
    *IMPORTING
    *sent_to_all = g_sent_all
    *TABLES
    *packing_list = i_packing_list
    *contents_txt = i_message
    *receivers = i_receivers
    *EXCEPTIONS
    *too_many_receivers = 1
    *document_not_sent = 2
    *document_type_not_exist = 3
    *operation_no_authorization = 4
    *parameter_error = 5
    *x_error = 6
    *enqueue_error = 7
    *OTHERS = 8.
    Store function module return code
    *g_error = sy-subrc.
    Get i_receivers return code
    *LOOP AT i_receivers.
    *ENDLOOP.
    **Instructs mail send program for SAPCONNECT to send email(rsconn01)
    *WAIT UP TO 2 SECONDS.
    *IF g_error EQ 0.
    *SUBMIT zgbl_sla_per WITH mode = 'INT'
    *WITH output = 'X'
    *AND RETURN.
    REWARD IF FOUND USEFULL,
    Cheers,

  • Sending resourceStream on a response object

    Hi all,
    i need to attach a resource stream to a servlet response in a
    chain.doFilter(httpRequest,response);
    ie i want to return this
    this.getClass().getClassLoader().getResourceAsStream(ParameterSource);
    the resource will always be an image or a style sheet so is there any need to specify mime type in the response header?
    Can anybody help me with the lcode to add the resourceStream to the response?
    Thanks in advance
    Alex

    solved the above proble and narrowed the first down to 2 solutions
    1)
    make the inputstream into an array of bytes and feed into outputstream for the response
    2)
    use request =dispatcher to forward resource needed
    requestdispatcher rd = request.getrequestdispatcher(RESOURCE);
    rd.forward(RESOURCE);
    i'm not sure if the second option will work because the resorce may be located in a .jar file?
    Has anybody else any comments or suggestions?
    Alex.

  • How to send  attachments as request/response in a webservice.

    Hi Team,
    I have created a webservice using pb.net.Now I want to pass attachments as input parameter to the webservice. And also i want to send attachments as response.So please anybody help me on this .
    Regards
    Subrat

    Hi Bruce,
    Thanks for the info.As i am new to the PB.net webservice, its very difficult for me how to add these things in the code.Can you have any sample application/programs where you have send the attachments as a request and response using pb.net webservice.
    Thanks a lot again,
    Regards
    Subrat

  • How to send a string thru UDP

    How can I send a string like this thru UDP:
    0x01 0x40 0x43 0x51
    Can I write it like this:
    data= 0x01, 0x40, 0x43, 0x51;
    Any help, please?

         InputStream in = null;
         HttpURLConnection urlConn =  null;
         int returnCode = 0;   
         try {
               URL url = new URL(URLEncoder.encode(urlStr));
               //Where urlStr is in the form "http://localhost/servlet/myServlet?param1=STRING TO BE PASSED"
              //Create the connection to the servlet url
               urlConn = (HttpURLConnection)url.openConnection();
               urlConn.setDoInput(true);
               urlConn.setDoOutput(true);
               urlConn.setUseCaches(false);
               urlConn.setRequestMethod("GET");
               urlConn.setRequestProperty("Accept-Language", "en");
               urlConn.setRequestProperty("content-type", "text/xml");
               in = urlConn.getInputStream();
               //Put code to read return string here
              } catch (Exception e) { System.out.println("Error : " + e); }
              urlConn.disconnect();

  • How to send multiple attachments thru mail?

    I haven't been able to figure out how from the mail application send docs, worksheets etc as attachment. Also how to attach multiple docs in the mail. Looking for help on this.
    Sparashar

    You need to start in the app that contains the files that you want to send as attachments and use that app's functionality to select and attach files to an email, and not start in the Mail app e.g. the GoodReader app supports multiple document types (word and excel, read only, PDFs, text files, pictures) and allows you to select one or more of them and attach/switch with them to an email.
    In the Mail app itself on iOS 6 you can now press and hold the body of the email and select photos from the Photos app to attach to it.

  • How do I get to the request object in a webflow.

    How do I get to the request object in a webflow.
    I created a input process and one function it needs to do is create a cookie.
    Problem is I don't have a response object.
    How do I create/get the response object so I can create a cookie.
    Thanks
    Michael C Ford
    ------------------ Code Line ------------------------------------
    public Object process(HttpServletRequest req, Object requestContext)
    throws ProcessingException
    // get the pipeline and namespace info for the process
    PipelineSession pSession = null;
    String namespace = null;
    String username = req.getRemoteUser();
    pSession = getPipelineSession(req);
    namespace = getCurrentNamespace(pSession);
    /* ***** DO THE INITIAL CREATE OF THE BEAN *** */
         try {
              Properties props = new Properties();
              props.put(
                   Context.INITIAL_CONTEXT_FACTORY,
                   "weblogic.jndi.WLInitialContextFactory");
              Context ctx = new InitialContext(props);
              Object homeObject = ctx.lookup("com.??.??PortalMgr");
              SeechangePortalMgrHome seechangePortalMgrHome =
              (SeechangePortalMgrHome) javax.rmi.PortableRemoteObject.narrow(
                                                      homeObject,
                                                      SeechangePortalMgrHome.class);
              SeechangePortalMgr portalMgr = seechangePortalMgrHome.create();
    /* Set the initail user */
    portalMgr.setUser(username);          
              UserRuntime userRuntime = (UserRuntime)portalMgr.getRuntimeObject();
              System.out.print("Run Time User is " + userRuntime.getUserName());
              System.out.print("Run Time User is " + userRuntime.getOrgSeq());
    // ** cookies for Actuate XXX=(customer sequence ID), YYY=ZZZ is a dummy per
    their requirement
              Cookie cCustSeqNumber = new Cookie("XXX",userRuntime.getOrgSeq());
              Cookie cPassword = new Cookie("YYY","ZZZ");
              cCustSeqNumber.setPath("/");
              cPassword.setPath("/");
              ??response.addCookie(cCustSeqNumber);
              ??response.addCookie(cPassword);          
         } catch (Exception ee) {
              System.out.print("Unable to create Portal Manager" + ee);
    // at this point we add the logic to produce the bean
    return "success";

    Thanks
    Just what I needed, except I needed to caste response.
    Michael C
    "Daniel Selman" <[email protected]> wrote:
    Michael,
    // get the HttpServletResponse from the HttpServletRequest
    HttpServletResponse response =
    equest.getAttribute( WebflowConstants.HTTP_SERVLET_RESPONSE );
    Cookie cPassword = new Cookie("YYY","ZZZ");
    cCustSeqNumber.setPath("/");
    cPassword.setPath("/");
    response.addCookie(cCustSeqNumber);
    response.addCookie(cPassword);
    You HAVE the HttpServletRequest...
    public Object process(HttpServletRequest req, ObjectrequestContext)
    throws ProcessingExceptionMake sense?
    Dan
    "michael C Ford" <[email protected]> wrote in message
    news:[email protected]...
    How can I get to the response this way ?
    this just stored the response as an attribute did it now ?
    If I don't have it, how can I use it in a setAttribute ?
    Sorry just a little slow
    I can't do this can I ?
    request.setAttribute(WebflowConstants.HTTP_SERVLET_RESPONSE,response);
    Cookie cPassword = new Cookie("YYY","ZZZ");
    cCustSeqNumber.setPath("/");
    cPassword.setPath("/");
    response.addCookie(cCustSeqNumber);
    response.addCookie(cPassword);
    "Daniel Selman" <[email protected]> wrote:
    Michael,
    I found this handy snippet in our code:
    // Put the httpServletResponse into the request, this is done
    in
    case IPs want to
    // use the response to deposit cookies. The IPs maynot howeverwrite
    // anything to the response as this will cause an
    IllegalStateException
    request.setAttribute(WebflowConstants.HTTP_SERVLET_RESPONSE,
    response);
    So, the HttpServletResponse is bound into the HttpServletRequest usingthe
    key, WebflowConstants.HTTP_SERVLET_RESPONSE.
    Magic!
    Sincerely,
    Daniel Selman
    "michael C Ford" <[email protected]> wrote in message
    news:[email protected]...
    How do I get to the request object in a webflow.
    I created a input process and one function it needs to do is create
    a
    cookie.
    Problem is I don't have a response object.
    How do I create/get the response object so I can create a cookie.
    Thanks
    Michael C Ford
    ------------------ Code Line ------------------------------------
    public Object process(HttpServletRequest req, Object
    requestContext)
    throws ProcessingException
    // get the pipeline and namespace info for the process
    PipelineSession pSession = null;
    String namespace = null;
    String username = req.getRemoteUser();
    pSession = getPipelineSession(req);
    namespace = getCurrentNamespace(pSession);
    /* ***** DO THE INITIAL CREATE OF THE BEAN *** */
    try {
    Properties props = new Properties();
    props.put(
    Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    Context ctx = new InitialContext(props);
    Object homeObject = ctx.lookup("com.??.??PortalMgr");
    SeechangePortalMgrHome seechangePortalMgrHome =
    (SeechangePortalMgrHome) javax.rmi.PortableRemoteObject.narrow(
    homeObject,
    SeechangePortalMgrHome.class);
    SeechangePortalMgr portalMgr = seechangePortalMgrHome.create();
    /* Set the initail user */
    portalMgr.setUser(username);
    UserRuntime userRuntime = (UserRuntime)portalMgr.getRuntimeObject();
    System.out.print("Run Time User is " + userRuntime.getUserName());
    System.out.print("Run Time User is " + userRuntime.getOrgSeq());
    // ** cookies for Actuate XXX=(customer sequence ID), YYY=ZZZ isa
    dummy per
    their requirement
    Cookie cCustSeqNumber = new
    Cookie("XXX",userRuntime.getOrgSeq());
    Cookie cPassword = new Cookie("YYY","ZZZ");
    cCustSeqNumber.setPath("/");
    cPassword.setPath("/");
    ??response.addCookie(cCustSeqNumber);
    ??response.addCookie(cPassword);
    } catch (Exception ee) {
    System.out.print("Unable to create Portal Manager" + ee);
    // at this point we add the logic to produce the bean
    return "success";

  • How to send multiple objects in a ObjectOutputStream

    1) I need to get more than one text field and send it to the servlet.
    2) How do I keep the Objects seperate in the servlet when they get inputed. I have to so I can sabe them to seperate variables.
    Applet Code
    URL url = new URL("http://www.mysite.com/servlet/Hello");
    URLConnection servletConnection = url.openConnection();
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    servletConnection.setUseCaches(false);
    servletConnection.setDefaultUseCaches(false);
    servletConnection.setRequestProperty("Content-Type","application/octet-stream");
    ObjectOutputStream out = new ObjectOutputStream(servletConnection.getOutputStream());
    //Gets data from text field
    out.writeObject( (Object) cusNum.getText() ); //(Object)
    // I need to get more than one text field and send it to the servlet.
    out.flush();
    out.close();Servlet Code
    ObjectInputStream inputFromApplet = new     ObjectInputStream(request.getInputStream());
    String fromApplet = (String) inputFromApplet.readObject();
    inputFromApplet.close();

    //Gets data from text fieldNo, this gets data from text field and writes it to the output.
    out.writeObject( (Object) cusNum.getText() ); //(Object)So that writes one object.
    // I need to get more than one text field and send it to the servlet. So do that.
    String fromApplet = (String) inputFromApplet.readObject();Here you have read one object. If you want to read another, do so.

  • How to send nested object collection to PL/SQL Procedure as an Input param

    How to send nested object collection to PL/SQL Procedure as an Input parameter.
    The scenario is there is a parent mapping object containing a collection(java.sql.Array) of child objects.
    I need to send the parent object collection to PL/SQL procedure as a input parameter.
    public class parent{
    String attr1;
    String attr2;
    Child[] attr3;
    public class Child{
    String attr1;
    SubChild[] attr2;
    public class SubChild{
    String attr1;
    Urgent!!!
    Edited by: javiost on Apr 30, 2008 2:09 AM

    javiost wrote:
    How to send nested object collection to PL/SQL Procedure as an Input parameter.There are a few ways to do this, all of which likely depend on the particular database you're using.
    Urgent!!!Not to me...

  • How to send object by NetStream?

    Hi, I have question about using Cirrus in real time game developed. I want to create a game in which each player will be able to move a character using the arrow keys. And here comes my question.How do I continuously transfer an object or variable via NetStream. Should I use the send() method (when a player is in motion), or maybe it's possible to send and receive an object using publish() and play().
    I spent a lot of time looking for solutions on the internet, but with no succes. Everything that I've found was about transmission of audio and video (attachAudio() and attachVideo()), I need a method such as attachObject(), which could continuously send for example player's position.
    I found P2PGameLibrary on Tom Krcha's site (www.flashrealtime.com). Unfortunately, it is in the  .swc file and when I use FlashDevelop to open it, it shows only the model of classes and methods. If I could see the entire code, I could study it and maybe it would solve my problem.
    If someone could give an example of how to send objects/variables by NetStream, I would be grateful.
    swO_orn

    Thanks for fast answer.
    Yes I have build a simple chat p2p using only NetGroup, and sending messages by method post(). The one "bad thing" I nothiced is delay. I got about 500ms. That's too much for real time games.
    I have watch some tutorials on Tom Krcha's blog and they said I should build full mesh of direct connections of all users to make P2P game.
    Let's say I want to have 6 players sending and receiving info in game. What's the best way to transfer data between them? NetGroup.post() or NetStream.send() or maybe another?
    PS: Please give me an example how to receive data in NetStream if data was transfered by send() method.
    Doc says :
    send(handlerName:String, ... arguments):void
    How do I start handler on receiver app?

  • How to send a Connection Object via CORBA

    Hi.
    I've got a question.
    How can I send a java.sql.Connection object
    using CORBA to a client? Tried to use a class
    MyConnection extending org.omg.CORBA.portable.ObjectImpl
    as a wrapper class. Didn't work.
    When a request was invoked for a Connection,
    no object was send. On client side an error occured:
    code 202 completed:maybe.
    In the IDL we used:
         typedef Object MyConnection;
         interface ConnectionPool{
              MyConnection getCon();
              void freeCon(inout MyConnection c);
    We were suggested to use structures. But ain't it
    inventing java again?
    Can anyone help us?
    Thx anyway.

    Try inserting it into an Any object and sending the any object over the IDL, the client can then extract the connection object.
    You might have to typedef the Connection object in the IDL to generate the helper class.
    /P/

  • How to send fax thru sap system

    Hi all,
    I need to send a fax thru sap system. In the given parameter I need to give email address & fax number. The result is the content I shud receive as both email & fax.
    As far as email is concerned no problem. But I am not receiving the content fax. I am getting the following error as email. Pls find below the error message.
    Your message did not reach some or all of the intended recipients.
          Subject:     000000002008
          Sent:     4/5/2007 11:47 AM
    The following recipient(s) could not be reached:
          FAX3D2B918041396976@75 on 4/6/2007 2:31 AM
                The e-mail account does not exist at the organization this message was sent to.  Check the e-mail address, or contact the recipient directly to find out the correct address.The MTS-ID of the original message is:ADR32000000006890
    < sap.corp #5.1.1 SMTP; 553 <FAX=+918041396976@75>... only FQDN names will be accepted>
    The fax number I typed is +918041396976 but the system itself is adding @75 behind it. I am not getting the fax message.
    Can anyone help me in this regard.
    Thanks in advance.
    Vijay.

    Hi Vijay,
    The fax nio. parameter can be handled thru the program. I mean remove those extra characters... and try this code below for ref (its from sap-img.com)
    The following program shows you how to send a fax from within ABAP/4. The report is delivered
    in the standard system and is used in Transaction SCOM for the function "Send test fax".
    Only the method via the call of SAPscript with DEVICE='TELEFAX', described below, ensures the
    generation of a correct transmission request, independent of the R/3 release and of the used
    fax server solution and its configuration.
    The regular printing (for example, with NEW-PAGE PRINT ON...) on an output device created in
    the spool administration of the device class 'Telefax' does generally not work!
    REPORT RSKSENDF MESSAGE-ID SK.
    Test report to send a test fax
    sends a fax to the number <TO_CNTRY>-<TO_NMBER>
    containing an automatically generated message text.
    TABLES: USR03.
    PARAMETERS: TO_CNTRY LIKE T005-LAND1 OBLIGATORY,
    TO_NMBER LIKE TSP01-RQTELENUM OBLIGATORY,
    FROM_USR(30) TYPE C DEFAULT SY-UNAME,
    TO_RECIP(30) TYPE C DEFAULT SY-UNAME.
    SAPscript content ITAB
    DATA: BEGIN OF TEST_DOC OCCURS 10.
    INCLUDE STRUCTURE TLINE.
    DATA: END OF TEST_DOC.
    SAPscript header struct
    DATA BEGIN OF HEADER.
    INCLUDE STRUCTURE THEAD.
    DATA END OF HEADER.
    INITIALIZATION.
    get county from user addres in usr03
    system->user profile->user address
    check if not empty
    SELECT SINGLE * FROM USR03 WHERE BNAME = SY-UNAME.
    IF SY-SUBRC = 0 AND USR03-LAND1 <> SPACE.
    TO_CNTRY = USR03-LAND1.
    ENDIF.
    START-OF-SELECTION.
    PERFORM FILL_UP_TEST_DOC.
    PERFORM SHOW_TEST_DOC.
    AT PF08.
    PERFORM SEND_FAX TABLES TEST_DOC USING TO_CNTRY
    TO_NMBER.
    AT SELECTION-SCREEN ON TO_NMBER.
    PERFORM CHECK_NUMBER USING TO_CNTRY TO_NMBER.
    *& Form CHECK_NUMBER
    FORM CHECK_NUMBER USING
    COUNTRY
    NUMBER.
    DATA: SERVICE LIKE TSKPA-SERVICE VALUE 'TELEFAX',
    LEN LIKE SY-FDPOS.
    FIELD-SYMBOLS <P>.
    windows GUI push the ? from mandatory input instead
    of overwriting it
    LEN = STRLEN( TO_NMBER ).
    IF LEN > 1.
    SUBTRACT 1 FROM LEN.
    ASSIGN TO_NMBER+LEN(1) TO <P>.
    IF <P> = '?'.
    <P> = SPACE.
    ENDIF.
    ENDIF.
    official check FM
    CALL FUNCTION 'TELECOMMUNICATION_NUMBER_CHECK'
    EXPORTING
    COUNTRY = COUNTRY
    NUMBER = NUMBER
    SERVICE = SERVICE.
    on old 21?/22? release you may have to handle the
    exception
    because the Function uses RAISE instead of
    MESSAGE... RAISING....
    ENDFORM. " CHECK_NUMBER
    *& Form FILL_UP_TEST_DOC
    fills test text in itab TEST_DOC *
    real life example needs to get real life data *
    FORM FILL_UP_TEST_DOC.
    DATA: DATUM(12) TYPE C,
    UZEIT(10) TYPE C.
    SAPscript initialization
    of course, you may want to set a few parameter
    (FORM,LAYOUT,....)
    CALL FUNCTION 'INIT_TEXT'
    EXPORTING
    ID = 'ST '
    LANGUAGE = SY-LANGU
    NAME = 'FOO-BAR'
    OBJECT = 'TEXT'
    IMPORTING
    HEADER = HEADER
    TABLES
    LINES = TEST_DOC
    EXCEPTIONS
    OTHERS = 1.
    IF SY-SUBRC <> 0.
    MESSAGE A400 WITH 'INIT_TEXT'.
    ENDIF.
    PERFORM ADD_EMPTY_LINE.
    WRITE: SY-DATUM TO DATUM.
    WRITE: SY-UZEIT TO UZEIT.
    PERFORM ADD_LINES USING 'This is test Telefax'(001)
    DATUM UZEIT.
    PERFORM ADD_EMPTY_LINE.
    PERFORM ADD_LINES USING 'From: &'(002) FROM_USR SPACE.
    PERFORM ADD_LINES USING 'To: &'(003) TO_RECIP SPACE.
    PERFORM ADD_LINES USING 'Fax number: & &'(004)
    TO_CNTRY TO_NMBER.
    PERFORM ADD_EMPTY_LINE.
    PERFORM ADD_LINES USING
    'This is a test fax send by Report RSKSENDF'(005)
    SPACE SPACE.
    PERFORM ADD_LINES USING 'on SAP system & '(006)
    SY-SYSID SPACE.
    PERFORM ADD_EMPTY_LINE.
    PERFORM ADD_LINES USING
    'the quick brown fox jumps over the lazy dog.'(101)
    SPACE SAPCE.
    PERFORM ADD_LINES USING
    'THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.'(102)
    SPACE SAPCE.
    PERFORM ADD_EMPTY_LINE.
    PERFORM ADD_LINES USING 'End of test'(007) SPACE
    SPACE.
    ENDFORM. " FILL_UP_TEST_DOC
    *& Form ADD_LINES
    printf a line an appends it in test_doc *
    --> cformat format.
    --> p1 param1
    --> p2 param2
    FORM ADD_LINES USING CFORMAT P1 P2.
    TEST_DOC-TDFORMAT = '/'.
    TEST_DOC-TDLINE = CFORMAT.
    IF TEST_DOC-TDLINE CA '&'.
    REPLACE '&' WITH P1 INTO TEST_DOC-TDLINE.
    IF TEST_DOC-TDLINE CA '&'.
    REPLACE '&' WITH P2 INTO TEST_DOC-TDLINE.
    ENDIF.
    ENDIF.
    APPEND TEST_DOC.
    ENDFORM. " ADD_LINES
    *& Form ADD_EMPTY_LINE
    appends an empty line to test_doc *
    FORM ADD_EMPTY_LINE.
    TEST_DOC-TDFORMAT = '/'.
    CLEAR TEST_DOC-TDLINE.
    APPEND TEST_DOC.
    ENDFORM. " ADD_EMPTY_LINE
    *& Form SHOW_TEST_DOC
    lists the test doc for aproval *
    *>>>> this is for fun only because PRINT_TEXT also
    offers a preview *
    FORM SHOW_TEST_DOC.
    FORMAT COLOR COL_BACKGROUND INTENSIFIED OFF.
    WRITE: / 'Test fax would look like this:'(020).
    ULINE.
    SKIP.
    LOOP AT TEST_DOC.
    IF TEST_DOC-TDLINE <> SPACE.
    WRITE:/ TEST_DOC-TDLINE.
    ELSE.
    SKIP.
    ENDIF.
    ENDLOOP.
    SKIP.
    ULINE.
    FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
    WRITE: 'Press PF8 to send it'(021).
    ENDFORM. " SHOW_TEST_DOC
    *& Form SEND_FAX
    send fax by calling SAPscript *
    Note: Instead of using PRINT_TEXT you may also *
    call OPEN_FORM / WRITE_FORM_LINES / CLOSE_FORM, *
    this allows you to use a similar program structure *
    as with NEW-PAGE PRINT ON / WRITE / NEW-PAGE PRINT
    OFF *
    FORM SEND_FAX
    TABLES DOC2FAX STRUCTURE TEST_DOC
    USING COUNTRY
    NUMBER.
    DATA: SID(5) TYPE N.
    DATA BEGIN OF POPT.
    INCLUDE STRUCTURE ITCPO.
    DATA END OF POPT.
    DATA BEGIN OF PRES.
    INCLUDE STRUCTURE ITCPP.
    DATA END OF PRES.
    CLEAR POPT.
    POPT-TDCOPIES = 1. " one copy
    POPT-TDDEST = " done internaly by script,
    POPT-TDPRINTER = " do not fill !!!
    POPT-TDNEWID = 'X'. " do not reuse old spool request
    POPT-TDDATASET = 'TEST'(022). " fill as you want
    POPT-TDSUFFIX1 = 'FAX'(023). " fill as you want
    POPT-TDSUFFIX2 = SY-UNAME. " fill as you want
    POPT-TDIMMED = 'X'. " send now
    POPT-TDLIFETIME = 8. " keep 8 days in spool
    POPT-TDTELENUM = NUMBER. " number without country code
    POPT-TDTELELAND = COUNTRY. " country of recipient
    POPT-TDCOVER = 'test fax'(024).
    POPT-TDCOVTITLE = 'test fax'(024).
    POPT-TDIEXIT = 'X'.
    CALL FUNCTION 'PRINT_TEXT'
    EXPORTING
    APPLICATION = 'TX'
    ARCHIVE_INDEX = ' '
    ARCHIVE_PARAMS = ' '
    DEVICE = 'TELEFAX' "<<< here we say: fax it !
    DIALOG = 'X'
    HEADER = HEADER
    OPTIONS = POPT
    IMPORTING
    RESULT = PRES
    TABLES
    LINES = DOC2FAX
    EXCEPTIONS
    OTHERS = 01.
    do not bother with exception in sample code
    CANCELED = 01
    DEVICE = 02
    FORM = 03
    OPTIONS = 04
    UNCLOSED = 05
    UNKNOWN = 06
    FORMAT = 07
    TEXTFORMAT = 08
    EXTERNAL = 09.
    IF SY-SUBRC = 0.
    arriving here means we could send:
    SID = PRES-TDSPOOLID.
    IF SID > '00000'.
    MESSAGE S433 WITH SID.
    ENDIF.
    LEAVE .
    ELSE.
    do not bother with exception in sample code
    MESSAGE A400 WITH 'PRIN_TEXT'.
    ENDIF.
    ENDFORM. " SEND_FAX

  • How to get the values of the objects inside an object??

    Hi,
    I am trying to write code to display name and memory usage of all session attributes, in a recursive way.
    I suppose reflection is needed here, but I can’t figure out how to get the values of the objects inside an object...
    private void handleIt(String attributeName, Object attributeValue) {
         boolean isPrimitiveOrNull = ((null == attributeValue) ||
              (attributeValue.getClass().isPrimitive()));                                         
         if (isPrimitiveOrNull) {
              sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "}");
         } else {
              sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "{");               
              Field[] fields = attributeValue.getClass().getDeclaredFields();
              int lim = fields.length;
              String name;
              Object value = null;
              for (int i = 0; i < lim; i++) {
                   name = fields.getName();
                   //LOOK AT THIS LINE: !!!!!!!!!!!!!!!!!!!!!!!!!!!
                   value = fields[i].get(obj); //I don´t know what 'obj' should be??
                   handleIt(name, value);
              sb.append("}");               
    Any suggestions will be greatly appreciated...

    I realized that massive int objects called MAX_VALUE, MIN_VALUE and SIZE where causing the StackOverflow, so I removed them from the analysis.
    This is the resultant code. But I think it isn’t accurate in calculating the real size of objects being got using reflexion.
    Do you or somebody have any more suggestions?
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.ObjectOutputStream;
    import java.lang.reflect.Field;
    import java.util.Enumeration;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class SessionMeasurer extends HttpServlet {
         private static final long serialVersionUID = 1470488362727841992L;
         private StringBuilder sb = new StringBuilder();
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              performTask(request, response);
         public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              performTask(request, response);
         public void performTask(HttpServletRequest request, HttpServletResponse response) {
              HttpSession     session = request.getSession(false);     
              String attributeName = "";
              Object attributeValue = null;
              for (Enumeration<?> attributeNames = session.getAttributeNames(); attributeNames.hasMoreElements();) {
                   attributeName = (String)attributeNames.nextElement();
                   attributeValue = session.getAttribute(attributeName);
                   handleIt(attributeName, attributeValue);               
              System.out.println(sb.toString());
         private void handleIt(String attributeName, Object attributeValue) {           
              if (attributeValue != null) {          
                   boolean isPrimitive = attributeValue.getClass().isPrimitive();
                   if (isPrimitive) {
                        sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "}");
                   } else {
                        sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "{");               
                        Field[] fields = attributeValue.getClass().getDeclaredFields();
                        String name;
                        Object value = null;
                        int lim = fields.length;
                        for (int i = 0; i < lim; i++) {
                             name = fields.getName();                                                                                                         
                             if (!name.endsWith("_VALUE") && !name.equals("SIZE") && !name.equals("serialVersionUID")) {
                                  try {
                                       value = fields[i].get(attributeValue);
                                  } catch(Exception e) {
                                       //PENDIENTE: Tratamiento excepción
                                  handleIt(name, value);
                        sb.append("}");               
         private int sizeOf(Object obj) {
              //Valid only for Serializables
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              ObjectOutputStream oos = null;     
              byte[] bytes = null;               
              try {          
                   oos = new ObjectOutputStream(baos);
                   oos.writeObject(obj);
                   bytes = baos.toByteArray();
              } catch(Exception e) {               
                   //PENDIENTE: Tratamiento excepción
              } finally {
                   if (oos != null) {
                        try {
                             oos.close();
                        } catch(Exception e) {
                             //PENDIENTE: Tratamiento excepción                         
                   if (baos != null) {
                        try {
                             baos.close();
                        } catch(Exception e) {
                             //PENDIENTE: Tratamiento excepción                         
              int size = -1;
              if (bytes != null) {
                   size = bytes.length;
              return size;          

Maybe you are looking for

  • Photoshop album starter edition 3.2 and kodak camera

    I have a kodak m753 digital camera and adobe photoshop album starter edition 3.2 says device not found. how do i get it to recognize the camera without deleting the kodak software. I have windows xp if that helps.

  • Wrong charachter display

    hi, i try to read in abjad alphabet but the problem is that one character is showed wrongly in the middle of the word, not at the end of it, here i submit the word that contains that letter and you can compare it with other browsers and find that wha

  • How can I remove downloaded books in iBooks with ios 8?

    There is no edit function in iBooks after updating to ios 8. Removing or moving downloaded books is impossible.

  • InDesign Crashing During Data Merge?

    Is anyone having any issues with InDesign CS3 crashing while doing a data merge with Excel?  Microsoft had some updates with the Office products and I'm wondering if one of the updates has caused a communication problem between the two?

  • HT204406 I signed up for iTunes Match and now I can't sync my Nano iPod.

    Hello, I recently signed up for I tunes Match and have succesfully added my iPhone 4 and iPad. But I can no longer sync my music into my iPod Nano. I assume it has something to do with iTunes Match??? Can anyone help me? Thanks, Pete Chatelain