Log in

View Full Version : HTTP Request



???
12-29-2008, 04:23 PM
I don't know all that much about HTTP Requests, but I'm wondering, can you receive two files from one request? What I want to do is eventually make my own HTTP Server in probably Java, and I want it to be able to pass variables to Javascript. I could have a "server variable definition" script block on every page, but it would be neater if it could be an external js file. Can I reasonably do this?

jscheuer1
12-29-2008, 04:33 PM
As I understand it, one file per request. Multiple request are made for the typical page:


the page itself
/favicon.ico (and/or variations on that depending upon a number of factors)
each image is a separate request
each linked style file is separate
each external script is separate
any Flash file(s) - each separate as well


There could be other resources required for the page, these would each be separate requests.

Twey
12-29-2008, 04:50 PM
The server serves only data. It's up to the client to decide what constitutes a 'file' — multiple requests may go into a single file, or the client may split a single request into multiple files. Most current Web browsers generally follow the 'one request, one file' rule, though.

A webserver in Java? That sounds like reinventing the wheel square, strapping one's self to the outside, and rolling down a hill covered in brambles. Allow me to recommend Haskell.

???
12-29-2008, 05:51 PM
A webserver in Java? That sounds like reinventing the wheel square, strapping one's self to the outside, and rolling down a hill covered in brambles. Allow me to recommend Haskell.
LOL, thanks though. Haskell?

Twey
12-29-2008, 09:19 PM
http://www.haskell.org/

Also good for large concurrent applications is Erlang, although it has only a weak type system, so it might be less than ideal. On that latter note, there's also Python if you prefer imperative languages.