Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Can an application server(not on local computer) call itself with http://localhost?

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can an application server(not on local computer) call itself with http://localhost?

    I've been trying to resolve an issue at my new job. I still don't have access to a lot of their systems. There's an RDF report that's supposed to be called and then it is saved as a pdf file.

    Here's small part of the code -

    URL url = new URL("http://localhost:7777/reports/rwservlet?csc&report=/app/oracle/files/TCP01/reports/vp_owner/letter.rdf&P_USER=null&p_emp_id=12345");
    URLConnection conn = url.openConnection();

    (I manually inserted the URL link for readability)
    Another piece of code checks for contenttype text/html - if it is text/html it throws an exception because it was expecting binary pdf data instead.

    My main question is - Can a Production App Server call itself with an "http://localhost:7777" call?

    I'm thinking that the contenttype is text/html because a 'Page cannot be displayed' is being sent back - because it can't resolve the localhost. Would this be true?

    Is localhost only used for local machines like the application server on your desktop?

    Thanks


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Can an application server(not on local computer) call itself with http://localhos

    What status code is returned with the message: 'Page cannot be displayed'

    Are you sure the path info on the url is correct? What do you get back if you use a valid host address with the path info you show in a browser from another site?

  3. #3
    Junior Member
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can an application server(not on local computer) call itself with http://localhos

    Quote Originally Posted by Norm View Post
    What status code is returned with the message: 'Page cannot be displayed'

    Are you sure the path info on the url is correct? What do you get back if you use a valid host address with the path info you show in a browser from another site?
    I don't even have access to production(only the logs) and I can't reproduce the issue in DEV and QA. I just want to know whether or not http://localhost is supposed to loopback to the web server where the application server is installed. At my last job I was used to dealing with proxy mappings for all the servers.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Can an application server(not on local computer) call itself with http://localhos

    How/where are you seeing the error message: 'Page cannot be displayed'
    Most error messages have a status code sent with them in the first line of the response header.
    Last edited by Norm; September 19th, 2010 at 12:50 PM.

  5. #5
    Junior Member
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can an application server(not on local computer) call itself with http://localhos

    Quote Originally Posted by Norm View Post
    How/where are you seeing the error message: 'Page cannot be displayed'
    I think a page cannot be displayed is being sent back. But I'm not sure as I don't have access to production yet. The end user does not see the page because this is a background job. The saved pdf gets displayed in some other part of the application.

    I'm more curious about this localhost call as I have never seen it being used on a production server ever before - I'm used to seeing mappings used instead.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Can an application server(not on local computer) call itself with http://localhos

    I think a page cannot be displayed is being sent back.
    What is the status code that is sent with that error message?

  7. #7
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Can an application server(not on local computer) call itself with http://localhos

    I'm confused a bit about a few issues. Is your code being called from the same machine as the server? Does your server use port 7777 for its http service? What is the status code you are receiving (see HttpURLConnection.getResponseCode())?

Similar Threads

  1. Java Application Server
    By goutamdaphtari in forum Java Theory & Questions
    Replies: 0
    Last Post: July 14th, 2010, 11:53 PM
  2. Sending XML over HTTP to Another Application
    By darasgar in forum Java Servlet
    Replies: 2
    Last Post: July 14th, 2010, 01:56 PM
  3. Replies: 1
    Last Post: March 31st, 2010, 09:42 PM
  4. java application connecting to a server
    By wildheart25c in forum Java Networking
    Replies: 2
    Last Post: September 17th, 2009, 07:22 AM
  5. Replies: 0
    Last Post: May 21st, 2009, 11:17 AM