Results 1 to 11 of 11

Thread: Http request

  1. #1
    arthik_babu is offline Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0

    Default Http request

    Hi,
    I am building a request using URL connection. Before making a connection to the server I need to check if the URL requested server is same server. If it is same then I need to call locally Instead of making URL connection.

    Please help me.

    Thanks in advance.

    Arthik

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    10

  3. #3
    arthik_babu is offline Member
    Join Date
    Nov 2007
    Posts
    5
    Rep Power
    0

    Default

    Thanks fr your reply. Is it not possible to check the server name , port , and servlet name in the mapping and calling the method directly?

    please help me out.

    Arthik

  4. #4
    ark
    ark is offline Senior Member
    Join Date
    Apr 2015
    Posts
    287
    Rep Power
    3

    Default Re: Http request

    I have such question relating Http requests in Java-fx.
    What is recomended way to request Rest services on Spring Boot by using JSON transfering.
    Should I use typical java.io options as (HttpUrlconnection. Apache httpclient), or Resttemplate
    or standart Java-fx request class.
    The last one is - javafx.io.http.HttpRequest -- indeed it has some groovy-like syntax as using def, var keywords and
    is some not standart way. Are there any plain (pure) Java version of that HttpRequest Java-fx class?
    What is advantages of using of it comparably with another two options?
    Whether its is better to use Nio-netty connections for it? As I need to provide about possibility of
    thousand or two thousand concurrent connections from java-fx clients?
    I will be thankfull for advices.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,532
    Rep Power
    24

    Default Re: Http request

    That FX class is old (FX 1)...indeed, it's also (I think) a Javascript one, from when FX was intended as another web gui thing.
    It's not part of desktop FX, at least as far as I can see.

    Since you're using SpringBoot then RestTemplate is probably the easiest fit.
    Indeed, here's Spring's handy guide on consuming REST services.

    Using HttpURLConnection will involve doing all this stuff by hand, which you ought to try and avoid.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    ark
    ark is offline Senior Member
    Join Date
    Apr 2015
    Posts
    287
    Rep Power
    3

    Default Re: Http request

    If the reason is in 151 version, but 144 or earlier could help I will try to find this jdk version.
    Indeed I have installed Win7 and java 1.8 environment that doesn't provide this error -- although I seldom use this OS,
    and it has some deficiency with modem i-net conection and even audio-driver could not be installed appropriately.

  7. #7
    ark
    ark is offline Senior Member
    Join Date
    Apr 2015
    Posts
    287
    Rep Power
    3

    Default Re: Http request

    1.Relating to https://docs.oracle.com/cd/E17802_01...tpRequest.html
    I did not find that is obsolete as there are different versions of it.
    But why it uses such JS or Groovy-like syntax - why it was designed so.
    Indeed as the Java-Fx has special class for requests, and so expanded one, it should has some benefits over other types of requests.
    2.What staff relating to HttpURLConnection I need to do?
    3.One of the most unclear moment is how should I convert my Java-fx textfields etc (forms properties) to Json, as
    on sever side it is enough to put Jackson lib on classpath. But what about on client side?
    How bind form properties to json more simply?
    Should I use convertion of Java-Fx properties to some intermediate java class objects (for example Login class with username, password fields), and just then convert that objects to Json.
    I did not find any info about that -- indeed reviewed most of resourced (https://spring.io/guides/gs/consuming-rest/ -- is just one of the hundred I have looked through).
    4. Relating using Resttemplate -- it doesnt provide Put and Delete responde code - but using exchange() should be more complicated. Anyway the general issue arise as there should be possibility of deleting some objects with http-requests and appropriate service, but response code should be the same (200,204) when first deleted and when not deleted as it was deleted earlier.
    And as I have seen the better choice for Resttemplate is using ResponseEntity, indeed created service provide just list of object or object return type.
    Last edited by ark; 12-01-2017 at 05:34 PM.

  8. #8
    ark
    ark is offline Senior Member
    Join Date
    Apr 2015
    Posts
    287
    Rep Power
    3

    Default Re: Http request

    Just one question, at least - "How should I convert my Java-fx textfields etc (forms properties) to Json", should I bind fxml properties to controller class properties and then just to json - or it could be made automatically?

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,532
    Rep Power
    24

    Default Re: Http request

    JavaFX 1 is ancient.
    It was fairly quickly replaced by 2, and now 8.

    And half of it was designed for browsers, not a desktop GUI.

    So, no, that class is not something you want to be looking at.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    ark
    ark is offline Senior Member
    Join Date
    Apr 2015
    Posts
    287
    Rep Power
    3

    Default Re: Http request

    Should it means that https://docs.oracle.com/cd/E17802_01...tpRequest.html is obsolete technology for just web-requests, created when java-fx was not desktop in its essence?

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,532
    Rep Power
    24

    Default Re: Http request

    It is ancient.
    And you seem to be using JavaFX 8 (based on your other questions) so yes, it's obsolete.
    Even the title-link to the JavaFX docs at the top of that page is redirected to the JavaFX 2 API, which does not have that package, let alone that class.

    And FX2 is out of date now as well.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 7
    Last Post: 11-11-2009, 09:29 PM
  2. Replies: 0
    Last Post: 06-01-2009, 12:11 PM
  3. [SOLVED] http request
    By Eranga in forum Advanced Java
    Replies: 30
    Last Post: 11-27-2008, 05:35 AM
  4. Replies: 1
    Last Post: 10-21-2008, 10:21 AM
  5. Redirecting HTTP request to another webserver
    By barunva in forum Networking
    Replies: 0
    Last Post: 10-21-2008, 09:50 AM

Posting Permissions

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