3 Replies - 197 Views - Last Post: 08 April 2019 - 06:29 AM Rate Topic: -----

#1 Grimmjow91   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 20-February 19

HTTPResponse

Posted 06 April 2019 - 07:26 AM

Hello, I have a homework assignment that I just need a small piece of help with. So for my assignment I am connecting a browser, like firefox, to my java server application then my server is supposed to look for the file they are they are requesting and return a 200 ok with the file, or a 404 error if it is not there. So I am making a basic web server. I have been trying to read the documentation on HTTPresponse but I still don't know how to make the HTTP response object or how to get the URL from the GET request. My question is simple, how to I make the object for a HTTP resposne (you know the
 something name = new something(); 
. And how do I get the the URL from a HTTP GET request.

Documentation I have been trying but failing to understand: https://docs.oracle....tpResponse.html

Thank You.

Is This A Good Question/Topic? 0
  • +

Replies To: HTTPResponse

#2 NormR   User is offline

  • D.I.C Lover
  • member icon

Reputation: 765
  • View blog
  • Posts: 5,767
  • Joined: 25-December 13

Re: HTTPResponse

Posted 06 April 2019 - 07:46 AM

HTML is defined here: https://tools.ietf.org/html/rfc1866

For some ideas: Write a test program to read and display what is returned by a HTTP server to see what other servers return.

There are probably some Java classes that will help you build a response header.
Was This Post Helpful? 0
  • +
  • -

#3 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3623
  • View blog
  • Posts: 16,656
  • Joined: 20-September 08

Re: HTTPResponse

Posted 06 April 2019 - 10:14 AM

Examples of Java's inbuilt web server here:
https://gist.github....dratlee/6163025
Was This Post Helpful? 1
  • +
  • -

#4 Grimmjow91   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 20-February 19

Re: HTTPResponse

Posted 08 April 2019 - 06:29 AM

Thank you kindly g00se that is exactly what I was hoping for.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1