Results 1 to 8 of 8
  1. #1
    xt57 is offline Member
    Join Date
    Jun 2015
    Posts
    6
    Rep Power
    0

    Question Does Java (not 3rd-party) have async/event-driven support for client-side HTTP POSTs?

    Core Reason for This Post

    Recent convert to Java is porting from C++ and needs to achieve client-side, async, event-driven HTTP POST support. My solution must include an event that triggers the execution of code which is to "digest" each chunk of newly-arrived data.

    As further description of the process, the (server-side) vendor replies to my (singular, early-day) HTTP POST request by sending me many variably-sized chunks of data at various times throughout the remainder of the business day (all resulting from the same, original POST dialog). I usually receive a "heartbeat chunk" of data, every 20 - 30 seconds, if no other meaningful new data is available at that time. I should state for clarity that this is not a "file download," but rather a day-long, read-when-data-is-available proposition.

    If possible, the "read" technique I employ needs to have the simplicity of the "wake me up, when data arrives" elegance of the Qt (C++) framework's QNetworkManager and QNetworkRequest classes. Do you know of an existing post/blog that provides a simple, working example of this type of event-driven read technique for Java? Thank you for your time!


    Background and Thank You

    Hello! I am new to Java. As I move through my early phases of learning Java, I am responsible for porting a few C++ classes and programs to Java. I am only a few thousand lines of code into the process, but so far, things are going very well. I really like Java, so far.

    I am guessing that many of you Java veterans handle the event-driven I/O concept easily (I have been spoiled by how easy this is to achieve in Qt/C++). I have searched for a solution for many days, but I am not recognizing one. Also, I want to use the core/standard classes of Java, if possible. The Java 8 examples I have found that include CompletableFuture and Lambda examples may be a bit beyond my Java skills at this time. I am studying them, but I think the examples I am finding may not directly address my specific need and, in the process, are complicating my comprehension.

    Thank you very much for any help you can provide!

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Does Java (not 3rd-party) have async/event-driven support for client-side HTTP PO

    Well, I am not sure since I don't do much web stuff. But I am pretty sure that if there is a way to check incoming data availability then you could use the Java event mechanism to grow your own event handler.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    xt57 is offline Member
    Join Date
    Jun 2015
    Posts
    6
    Rep Power
    0

    Default Re: Does Java (not 3rd-party) have async/event-driven support for client-side HTTP PO

    Thanks for your reply. You mention "the Java event mechanism to grow your own event handler." Are you referring to "inner classes," or "lambda" syntax, as the event mechanism? Either way, do you have any code examples, or links to examples, that you can post for me? I am very new to Java and completely stuck in my port of C++ and C# code (to Java) that currently relies upon Qt's signals/slots and C#'s delegate event management features. Thank you for your time!!!

    Best wishes,
    xt

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    26

    Default Re: Does Java (not 3rd-party) have async/event-driven support for client-side HTTP PO

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    xt57 is offline Member
    Join Date
    Jun 2015
    Posts
    6
    Rep Power
    0

    Default Re: Does Java (not 3rd-party) have async/event-driven support for client-side HTTP PO

    Hi. Does your prefix of "Cross posted:" mean that posting on two different forums is not allowed here? If so, can I post here, if I remove/reject the post at Java Ranch? Thanks for any details you can provide.

    xt

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    26

    Default Re: Does Java (not 3rd-party) have async/event-driven support for client-side HTTP PO

    Read all about it on the other site: Be Forthright When Cross Posting To Other Sites at JavaRanch

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    xt57 is offline Member
    Join Date
    Jun 2015
    Posts
    6
    Rep Power
    0

    Default Re: Does Java (not 3rd-party) have async/event-driven support for client-side HTTP PO

    Hi db. Thanks for the reference. I read the info you suggested at JavaRanch. I probably disagree with 90% of the takeaway points made there, but that is for another discussion. After 32 years of programming, I am not very happy with the lack of overall progress made in our industry. Our industry is usually about as effective as the general human condition, which is really pretty poor, from the perspective of how well we prepare each other to succeed with the fruits of our labor. If (and I emphasize if) anyone ever responds with anything close to a resolution to my porting dilemma, I will fully apply a working example as a resolution on both sites.

    Thanks, again, for suggesting the already-documented coverage at the JavaRanch site.

    xt

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    26

    Default Re: Does Java (not 3rd-party) have async/event-driven support for client-side HTTP PO

    Quote Originally Posted by xt57 View Post
    I will fully apply a working example as a resolution on both sites.
    Thank you. In the meantime, please be sure to inform participants on all forums about any cross posts on other sites.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 0
    Last Post: 10-06-2013, 03:30 PM
  2. Client-side or server-side XML parsing?
    By noodle_variation_187-X in forum JavaServer Pages (JSP) and JSTL
    Replies: 11
    Last Post: 05-31-2012, 09:06 AM
  3. Event-Driven Painting With Data Model
    By ThatJavaGuy in forum Java 2D
    Replies: 6
    Last Post: 02-15-2011, 03:58 PM
  4. async client with Soap Header (jax-wsi 2.0)
    By micpie in forum Advanced Java
    Replies: 0
    Last Post: 01-25-2011, 01:36 PM
  5. Replies: 0
    Last Post: 09-20-2010, 09:25 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •