Multiple POST requests

Greetings everybody,
For this particular question I am not getting any help from the Java forums and Google.
Not very long ago I had to send a stream of bytes from an applet to a servlet (the applet and its helper classes are packed inside a signed jar file), but I used to fail miserably at every step.
I tried every trick in the book (for me the books were Google and Java forums!!). I set the servlet's path in the Windows CLASSPATH, I tried to call the applet from within a servlet- of course after placing the applet file in the servlets folder- (in the hope that since the applet was in the same location as the servlets the URL would get established) e.t.c but still URL url=new URL(<servlet URL>) refused to invoke the servlet.
Finally somehow I managed to get it done using the code below:
public class Xyz extends Applet
//DONT BE SURPRISED RIGHT NOW!!
Class cls=this.getClass();
ClassLoader cldr=cls.getClassLoader();
//THE ACTUAL SERVLET CONNECTING CODE
URL url=cldr.getResource("http://localhost:8000/servlet/<SomeServlet>");
/*This statement does not work........ URL url=new URL("http://localhost:8000/servlet/<SomeServlet>").A NULL URL OBJECT GETS CREATED!! */
HttpURLConnection hurlc=(HttpURLConnection)url.getConnection();
//ALL THE NECESSARY FORMALITIES TO BE PERFORMED TO WRITE THE STREAM TO THE SERVLET
hurlc.setDoInput(false);
hurlc.setDoOutput(true);
hurlc.setUseCaches(false);
hurlc.setRequestMethod("POST");
OutputStream os=hurlc.getOutputStream();
//WRITING THE STREAM
os.write(<some byte buffer>);
//NOW COMES THE TRICKY PART
hurlc.getResponseCode();
I had to do getResponseCode() because once ClassLoader.getResource(<servlet URL>) invoked the servlet using the GET method I COULD NOT INVOKE THE SERVLET AGAIN. I had to force an invokation using getResponseCode().
Well all is well now excepting for a small irritant. Instead of issuing one POST request the URLConnection is issuing multiple POST requests. In the Apache logs I get to see something like:
GET /snodx/callapplet.htm 200 116
GET /snodx/keystore_for_holding_fingerprint_for_trusted_applet 200 234
GET /snodx/applet_and_helpers.jar 200 105
HEAD /servlet/<SomeServlet> 200 187
POST /servlet/<SomeServlet> 200 312
POST /servlet/<SomeServlet> 500 604
POST /servlet/<SomeServlet> 500 604
The last 2 lines indicate that the servlet was invoked but the connection closed somehow. This is confirmed by taking a look at the Apache error logs:
Premature end of script headers.
Premature end of script headers.
In the JServ servlet engine error logs I am getting:
(500)apj12 returned an error handling request
cannot scan servlet headers.
The problem is occurring somewhere in getResponseCode().This statement is invoking the servlet using the request method set (POST) several times (2 or 3 times).
Can someone explain what's going on?
This is briefly the servlet code:
public class SomeServlet extends HttpServlet
//THE SERVICE METHOD IS CALLED BY A HEAD REQUEST TO THIS SERVLET
public void service(ServletRequest reque,ServletResponse respon) throws ServletException,IOException
this.doPost((HttpServletResponse)reque,(HttpServletResponse)respon);
//GO DIRECTLY TO THE POST METHOD
public void doPost(HttpServletRequest req,HttpServletResponse resp) throws ServletException,IOException
ServletInputStream sis=req.getInputStream();
if(sis.available()<2) //CHECK THAT THERE IS STREAM WHICH HAS AT LEAST 2 BYTES OF DATA!!
log("NO STREAM FROM APPLET");
else
//PERFORM ALL ACTIONS TO WRITE TO STREAM OF BYTES TO A LOCAL FILE
I have the servlet engine JServ 1.1.2 configured to run with Apache 1.3.19 on Windows 2000.
I compiled the Applet and the Servlet using JDK1.3 and JSDK2.0. I have JRE 1.3.1_02 installed on my Win2k machine.
Sorry for the long winded story here.
Awaiting a reply.
SNODX
(The search keywords combination getResponseCode multiple POST requests +Applet and many other related keyword combinations did not match any document in the Java forums. The search string "Multiple POST requests" "getResponseCode" and many other related search strings did not match any document in Google.I am continuing the search effort however                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

interresting the classloader solution. Well if that works, i would keep it like that so far.
But maybe this can help:
os.write(<some byte buffer>);
..and then
os.flush()//to make sure the outputstream is sent immediatly.
//i think getResponseCode() is not necsessary in that case
//but not certain, after all ...setUseCaches(false);
One thing you should do is remove the complete
service() {
...this.doPost();
the reason is that when a POST arrives at the servlet, the default service-method of the ancestor class (which is javax.servlet.Servlet) will automaticaly make a call to doPost() of the javax.servlet.http.HttpServlet subclass. You should not overide it I believe.
maybe... -try to establish an OutputStream only once in the Applet.
- receive the other end exactly once (as you did) in the doPost as an InputStream;
- eventually wrap both sides in respective Buffered(In)(Out)putStream(Reader)(Writer)
- start looping and .write() and .read() at both sides on the single and same in-and-outputStream();
(i.e avoid establishing the connection from the applet several times..., get one connection and keep it)
sorry if this story would be irrelevant,
Papyrus

Similar Messages

  • Multiple post requests using a single HttpConnection

    Hi,
    is it possible to send multiple post requests using a single Http connection.
    i am currently trying to simulate the preformance overhead because of creating HttpURLConnection to talk to my servlet. But, that made me wonder, if is there a way to send multiple post requests using a single HttpURLConnection.
    can anyone help me with this.
    thanks in advance

    Hi
    I found this article through Google. I hope it helps a little
    http://www.developer.com/tech/article.php/761521
    D

  • How to post multiple http requests using a single http connection in java

    I am using the httpurlconnection class and it allows only to post one request on a connection. I require to post multiple http requests by opening a single connection. Code examples please. Thanx in advance.

    Hi
    I found this article through Google. I hope it helps a little
    http://www.developer.com/tech/article.php/761521
    D

  • Retrieve data/files fro HTTP POST request in On-Demand process

    Hello,
    I would like to integrate https://github.com/blueimp/jQuery-File-Upload to my APEX 4.2 application inside XE11g. I would like to use this kind of jQuery component, multiple file upload, use Drag & Drop, image resize, size limit, filter extensions etc...
    This jQuery component and also others javascript uploaders sends data files to some defined URL. Developer need to build some servlet, php script or something on server side that will read files from HTTP request and stores it somewhere.
    Do you know how to do it in APEX? How can I read data from HTTP POST request in PL/SQL? Now I can only call my On-Demand application process from javascript, but I am not able to read any data from HTTP POST in it.
    Can I do it in APEX, or using MOD_PLSQL?
    I would like to implement this:
    1) some javascript uploader will call some URL of my application and sends HTTP POST with data files
    2) I will read data files from HTTP POST and store them into database
    3) I will create some HTTP response for javascript uploader
    Thank you for some tips

    I know about that existing plugin " Item Plugin - Multiple File Upload"
    But I doesn't work in IE and has only basic features. Licence for commercial use is also needed. I would like to use some existing jQuery plugin. There are many of these plugins with nice features. And only one problem is that I need to create some server side process/servlet/script.. that can recieve HTTP request, get files from it and stores them into DB.

  • Page Expire - How to keep in cach from post request !!!

    I have a big problem with the back button resulting in Page Expired message. The system framework is to call servlets from any page. A servlets will perform necessary computations and forward the request with additional objects to a jsp page, which will in turn construct the page and display it to a user. Some of the constracted pages have back button, which simply redirects to the previous page.
    The problem that I have has been described in multiple forums before, but still appears to be not solved. When I press the back button that shall display previous page, generated by the Post request, I get Page Expired message. Note that this occurs only in IE (I am using 6.0 with SP1) and not in Mozilla (I am using 1.3). I did my homework and tried the following code in different combinations, but unsuccessful:
    resp.setHeader("Cache-Control", "public");
    res.setHeader("Pragma", "Cache");
    res.setHeader("Expires", "Fri, 30 May 2003 12:00:00 GMT");
    or directly in jsp page
    <META HTTP-EQUIV="Pragma" CONTENT="cache">
    <META http-equiv="expires" CONTENT=" Fri, 30 May 2003 12:00:00 GMT ">
    None seems to work in IE. It appears that the IE refuses to cache the page generated by the post request at all times.
    The application that I am working is huge and this is a big problem for us, we need to support IE with back buttons.
    Please help.

    I believe this is a requirement of the HTTP
    specification.Yep - section 13.10 for anyone who can't sleep. I believe the idea is that methods such as POST, PUT and DELETE cause an update at the server and so caching makes no sense - the client needs to view a new copy.
    To quote the spec:
    Some HTTP methods MUST cause a cache to invalidate an entity. This is either the entity referred to by the Request-URI, or by the Location or Content-Location headers (if present). These methods are:
    - PUT
    - DELETE
    - POST

  • New Safari Update Causes Multiple Posts. SLOW

    Do Apple programmers/software engineers monitor this forum? If so- ❈❈❈ HELP ❈❈❈. Please fix this ASAP.
    June 9 (7), 2010 Safari Update Problems- Slower, Multiple Posting
    I have Mac OS X, Version 10.6.3. 2.66 GHz Intel Core 2 Duo, Memory 4 GB 1067 MHz DDR3.
    This is the first problem I’ve noticed w/ a software update.
    On June 9, 2010 I downloaded a safari update that was an automatic software update. This was probably the “Safari 5.0” update, dated June 7, 2010, but I’m not 100% sure. I downloaded it the same day I got it & I have software updates scheduled to look every day for updates.
    This update changed the menu bar to blue when loading a new address. Previously the menu bar was white & showed a grey band at the end of it that said “loading” when loading a new address. Now the grey band is absent.
    The new improvement is horrible. On a site I post & reply to posts on, It is slower in moving around a site & loading a page than before the update. I don’t care about the blue band. While the previous grey band showed immediately when it began loading, the new blue expanding bar on the address doesn’t immediately change when loading.
    When posting or replying, when pressing the “post” button it takes longer to respond than before. Now that the grey band that said “loading” isn’t present one isn’t sure if it took the command. If the “post” button is pressed more than once it now posts as many times as the button is pressed. Then extra posts have to be deleted, but w/ replies this isn’t possible. This is a awful feature. The previous address function was much more preferable.
    Before this update, when posting, even if the “post” button was pressed multiple times, it would only post once whether an original blog/post or reply. On some sites it seems to work OK.
    If Apple technicians monitor this site, please provide a correction for this asap. The improvements are awful.
    The correction should have:
    1) Replace the grey band that said “loading” even if the blue band remains.
    2) Make pressing the “post button” multiple times only post once- like before.
    3) Return the speed it previously moved around a site & posted. Removing the blue band is OK. I don't care about this.
    ❈❈❈ Can I safely remove all the Safari updates that were added on June 9, 2010 when I added this update to the trash bin? Will this return Safari safely to the previous settings? I’ve found in finder where it expands to show the exact updates that were added on June 9, 2010.
    Could just selected ones be removed to accomplish what I want? Any suggestions?

    If you want to report this issue to Apple's engineering, send a bug report or an enhancement request via its Bug Reporter system. To do this, join the Mac Developer Program—it's free and available for all Mac users and gets you a look at some development software. Since you already have an Apple username/ID, use that. Once a member, go to Apple BugReporter and file your bug report or enhancement request. The nice thing with this procedure is that you get a response and a follow-up number; thus, starting a dialog with engineering.
    Alternatively, send Feedback, but that usually goes through support and marketing, although when it'll get to engineering is anyone's guess.
    Finally, there's the Safari toolbar Report Bug tool.

  • Is it possible to have Multiple Spool requests in one batch job overview?

    Hi,
    While running one of my z program in back ground, there are two spools generated (one by write statement and one by OPEN_FORM statement and both the spools are available in SP01 Transaction), but when i see the job overview in transaction SM37, I only see one spool request (that of the last spool request). Can any body in the group please tell me is it possible to see multiple spool requests in the job overview of one Abap program and if yes, how?
    Thank you.
    Abinash

    Hi Jayanthi,
    Thank you for the link. But probably that discussion was also an unsolved one.
    Anyway, does any one in the group think that display of multiple spools per one step job is dependent on client / SAP Server setting? Because as evident from the chain of mails in the link provided by Jayanthi, some people say that they see multiple spool requests for one program in batch mode job overview (SM37)? If yes, can some body tell me the required configuration?

  • Reading POST-Request-Parameter-Values from WebDynPro now possible?

    Hello,
    in the past I always was disappointed that in WebDynPro there was no way to read POST-request-parameter-values directly after the call of a WebDynPro-Application.
    The only (documented) way to read / transfer request-data into an WebDynPro-application was via "URL query string parameters" in the request URL.
    The last week I forgot this restriction. I called my WebDynPro-application using a POST-Request-Parameter (cookie_guid) instead of an URL-parameter.
    After noticing my mistake, I was really surprised that the WebDynPro could read / shows the the POST-Request-Value.
    I didn't make any changes in the coding of my WebDynPro-Application (zvis_show_sso_cookie).
    After this cognition I built the following simple HTML-formular to analyse the behavior of the WebyDynPro by calling it with an URL-Parameter (cookie_guid=Url-GUID) together with the POST-Parameter (cookie_guid = Post-Value-GUID).
    After calling the WebyDynPro it reads / shows the "POST-Value" of the request !!!
    (Remark: If I made a simple refresh or type directly the URL "http://hg10762.vis-extranet.de:1080/sap/bc/webdynpro/sap/zvis_show_sso_cookie?sap-language=DE&cookie_guid=Url-GUID" in the browser, the same webdynpro reads / shows the URL-Parameter-Value).
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
           "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    </head>
    <body>
    <form method="post" action="http://hg10762.vis-extranet.de:1080/sap/bc/webdynpro/sap/zvis_show_sso_cookie?sap-language=DE&cookie_guid=Url-GUID">
      <table border="0" cellpadding="5" cellspacing="0" bgcolor="#E0E0E0">
        <tr>
          <td align="right">Cookie_GUID:</td>
          <td><input name="cookie_guid" type="text" size="30" maxlength="30" value="Post-Value-GUID"></td>
        </tr>
        <tr>
          <td>
            <input type="submit" value=" Absenden ">
            <input type="reset" value=" Abbrechen">
          </td>
        </tr>
      </table>
    </form>
    </body>
    </html>
    My questions:
    I there any documentation that describes the behavior of  WebDynPro after calling it by using POST-Parameter values?
    I believe in the past it wasn't possible to read POST-request-parameter-values in WD. Has SAP changed the functionality?
    Is the behavior I described in my example above mandatory?
    Regards
    Steffen

    As far as i know in general HTTP request  GET method is standard but in SAP POST is standard.  All the client request is passed as POST to the server in order to avoid the URL parameter length restriction in GET method.

  • T-code to close multiple posting periods in mm

    Is there is any t-code to close multiple posting periods in mm?
    Regards,
    Surendra babu.

    Dear Surendra,
    Open & Close Posting Periods
    FI posting periods:
    IMG->Financial Accounting->Financial Accouting Global Settings->Document->Posting Periods->Open and close posting periods.
    OB52
    MM posting periods:
    Logistics->Materials management->Material master->Other->Close period
    MMPV (to open current period)
    Logistics->Materials management->Material master->Other->Post to prev.period
    MMRV (shows what is open)
    Also check OB52 for type M
    Reward Me If Helpful

  • How to create the multiple spool requests for a single report.

    Hi gurus,
                     I have one requirement to be completed , i need to send the out put of the report via mail in pdf format. for that what i did was, iam executing report in background and creating spool request and converting it to pdf and sending the file.
    now the problem is, its a customer ledger report, for each customer i need to create a new spool request and send mail to that particular customer, now my dought is how to create multiple spool requests for a single pro and how i need to go about it.
    And one more question is can we create a spool request for a report which is running in online.
    waiting for inputs frm gurus.

    Hello,
    As per my knowledge for creating new spool id you will have to set
    output_options-tdnewid = 'X'.
    and then using
    job_output_info-spoolids
    create a pdf using
    call function 'CONVERT_OTFSPOOLJOB_2_PDF'
    Rachana.

  • Multiple leave requests on the same day

    We would like to enforce a check so that multiple leave requests of the same type cannot be submitted for the same day on ESS.
    How can this be achieved ? We are on EP 7.0 and ECC 6.0 and are using webdynpro java version of the ESS applications.
    Any configuration available for this or does this require a BADI implementation ?
    Thanks in advance.
    Thank You,
    Raj

    http://wiki.sdn.sap.com/wiki/display/ERPHCM/ValidationsforESSLeaverequest
    read here, it requies a badi implementation only, no config is available!
    You have to call backend exits from the badi of leave request
    Edited by: Siddharth Rajora on Aug 2, 2011 7:48 AM

  • Printing multiple spool requests at a time

    Hi All,
    I am using function module RSPO_OUTPUT_SPOOL_REQUEST to print the contents of the spool request. I want to print multiple spool requests at a time. We can input only one spool request number to the above function module at a time. Is there any way that I can print multiple spool requests with only single Print Popup Window ?
    Thanks.

    Hi Khanna,
    I tried that option at first place only. It results in multiple Print Popups. I want to avoid this. For all spool print requests, I want to show ONLY ONE Print Popup.
    Thanks.

  • How to find multiple transport requests for one object

    Hi all,
    Is there any function module which will fetches multiple transport requests ( if created ) for one object.I tried almost all the function modules , but i didn't got the solution.
    I need to develop a report ,   which will takes a single Task number as input and gets the Request number from table E070.
    Based on that Request Number i will fetch remaining Task numbers under it.
    Then for all the Tasks Numbers, i am fetching their  objects by using table E071.
    I need to list out  whether any of these objects are in multiple Transport Requests. Once i got all the Transport Request numbers i need to release the Request based on their Transport Request sequence.
    I tried the following FM's , but not able to get the solution.
    SVRS_DISPLAY_VERSION_LIST
    SVRS_GET_VERSION_DIRECTORY_46
    SVRS_GATHER_REQUEST_FRAGS
    Thanks..

    Hello
    I have tried with below code
    DATA list_tab TYPE TABLE OF abaplist.
    SUBMIT RSWBO040 USING SELECTION-SET 'TEST'
                    EXPORTING LIST TO MEMORY
                   AND RETURN.
    CALL FUNCTION 'LIST_FROM_MEMORY'
       TABLES
         listobject = list_tab
       EXCEPTIONS
         not_found  = 1
         OTHERS           = 2.
    IF sy-subrc = 0.
       CALL FUNCTION 'WRITE_LIST'
         TABLES
           listobject = list_tab.
    ENDIF.
    break-point.
    Submitting the program(RSWBO040) of SE03 transaction a will result in 'CNTL_ERROR' dump.
    Please try some other options
    Thanks

  • CHaRM-Is that possible to create multiple Transport Request in UC

    HI Gurus,
    Quick question on ur.gent correction using Solution Manager CHaRM in EHP1. Is it possible to create multiple transport request(TR) for single ur.gent correction (UC). DO NOT confuse with transport task.
    For example, after I created transport request and developer start working and release the task, realised to add another transport request for same UC. When I tried, it did not create any TR but checked the message found that
    Schedule Manager: Monitor
    Job Status: Processing completed, but with warnings
    Program Name: /TMWFLOW/SCMA_TRORDER_CREATE
    Action to be checked: Ur.gent Correction: Create Transport Request
    There is already an open request, XXXXXXXXXX, for this project
    So only way I can do that I released the TR and able to create another TR.
    May be wondering why I need to create another TR, why not create TASK and work on that.
    But this is the requirement at our company.
    I will appreciate the effort and time to provide me the solution of this.
    Thanks
    Ava

    Hi Ragu,
    That's really quick turn around. Unfortunately not able to found whatever you mentioned in your message. Here is detail,
    I navigate to Actions - Depending on Status, found the entry as
    Trans. Type     StatProf         UserStatus     Seq     Action in SAP Change Manager
    SDHF             SDHFHEAD   E0002            10       CREATE_HF
    SDHF             SDHFHEAD   E0002            20       CREATE_REQ
    SDHF             SDHFHEAD   E0002            30       SAVE_PARTNER
    SDHF             SDHFHEAD   E0002            40       SET BO LINKS
    Where SDHF - Ur.gent Correction
               E0002 - In Development
               CREATE_HF -        Create an Instance in SAP Change Manager
               CREATE_REQ -     Create Transport Request with Task
               SAVE_PARTNER - Save Partners in Respective Partner Roles
               SET BO LINKS -     Sets Links to Business Objects
    I don't see any OPEN_TR.
    Any other place need to make change.
    Thanks
    Ava

  • Multiple Spool Requests for BACS Payment

    Hi,
    We are running payment program F110 for BACS payment.
    When we run F110 in production system, irrespective of no. of. vendors or payment line items, only one spool request is generated.
    But when we run F110 in quality system, multiple spool requests are generated for single payment run.
    please give your valuable suggestions, why this is happening like this?
    Regards,
    Praisty

    Dear,
    please check the prnitout/data medium variant which you selected during the payment run.
    Regards,
    Panneer

Maybe you are looking for

  • AR Dunning letter

    Hi All, I have a requirement where I want to call the custom RDF from AR Dunning Letter generate program. The original concurrent program needs to be change in a way to look at the custom executable report having custom output layout. Thanks

  • Using iphone as a modem for your home PC

    I currently have a motorola slvr that I use as a modem on my home computer by connecting with the usb cable. It's the only way I can get internet at home right now. Has anyone tried this with the iphone? I want to buy one in the next few weeks, but t

  • Problem resetting user permissions- CMD R not working

    Hi, Thanks in advance to those willing to lend some help! GEAR: 2.53 GZ Core 2 Duo Mini running 10.8.5 All updates done. I believe I have a current Time Capusle backup at my disposal. New Macbook Air available to help. ISSUE: In the last couple of da

  • The video downloading is extremely slow after downloading Flash Player Active X (IE) and FP Plug-in

    I have Windows 7 on a 64-bit operating system, and have Firefox 19 and Internet Explorer 8. I tried installing Flash Player 11.6.602.171 from the Adobe Website and got an error message right at 47% download "can not contact reliable source." I also t

  • Which Data-Types can be used as Widget Parameters?

    Hi, I have been playing about with widgets (specifically widget parameters) for a while now. I've got to wondering, exactly which data-types can Captivate turn into widget parameters? So far I know that you can use: Numbers, Strings, Arrays, Objects