Python 7.0pl5 Manuale Utente Pagina 88

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 124
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 87
Servlet Framework
88
to provide a servlet to handle the actual request. If no server object is found corresponding to that por-
tion of the URL namespace, or the server object is not able to provide a servlet to handle the request,
a HTTP error response is returned to the client indicating that the resource corresponding to the sup-
plied URL could not be found.
Where an appropriate servlet to handle the request is found, the session manager will initially pass off
to the servlet the details of the request. This will include the type of request, the URL and the contents
of any HTTP headers. The details initially provided to the servlet do not include any content associated
with the request. Any content associated with a request will subsequently be passed to the servlet as it
arrives. This will only occur though if the servlet wasn’t able to process the request based on the initial
information and does actually require the content.
In the majority of cases a request will not have any associated content and a servlet will be able to proc-
ess the request straight away. Even if there is no content however, the servlet isnt obligated to send a
response immediately. This may be the situation if the servlet needs to wait until information from an-
other source arrives before it can form the response. In this scenario, the servlet might send a request
using the messaging framework to a remote service to obtain the information. When the response from
the remote service arrives, the servlet can then generate the response.
When the action of the servlet does depend on the content supplied with the request, the servlet would
accumulate the content as it arrives until the amount of content matches that given in the content length
header, or until some appropriate boundary is encountered. Now having all the content associated with
the request, the servlet can process the request and send a response. Alternatively it could again delay
the response if it needs to first send the content received to some remote service and wait for some re-
sponse.
When a servlet sends a response to the HTTP client, as long as the servlet generates a content length
in the HTTP headers, any request by a HTTP client to keep alive the session will be honoured. This
allows the HTTP client to submit additional requests using the same connection if desired. In general
the servlet framework adheres to the HTTP 1.0 protocol.
The HTTP Daemon
The Python class which listens for connection requests from HTTP clients is called HttpDaemon.
When creating the HTTP daemon, you need to tell it which port to listen on and also register with it
any HTTP server objects. When registering a HTTP server object, you need to identify which part of
the URL namespace it manages. Finally, you need to start the daemon so that once the dispatcher is
run it will actually listen and handle the requests.
dispatcher = netsvc.Dispatcher()
dispatcher.monitor(signal.SIGINT)
daemon = netsvc.HttpDaemon(8000)
filesrvr = netsvc.FileServer(os.getcwd())
daemon.attach("/",filesrvr)
Vedere la pagina 87
1 2 ... 83 84 85 86 87 88 89 90 91 92 93 ... 123 124

Commenti su questo manuale

Nessun commento

Cables Direct B6LZ-603K manuals

Owner’s manuals and user’s guides for Networking cables Cables Direct B6LZ-603K.
We providing 1 pdf manuals Cables Direct B6LZ-603K for download free by document types: Datasheet


Table of contents





More products and manuals for Networking cables Cables Direct

Models Document Type
XXURT-602 Datasheet   Cables Direct XXURT-602 networking cable, 1 pages
URT-603R Datasheet   Cables Direct URT-603R networking cable, 1 pages
B6LZ-603Y Datasheet   Cables Direct B6LZ-603Y networking cable, 1 pages
EUT-720 Datasheet   Cables Direct EUT-720 networking cable, 1 pages
B6-503R Datasheet   Cables Direct B6-503R networking cable, 1 pages
B6LZ-605 Datasheet   Cables Direct B6LZ-605 networking cable, 1 pages
B5-110W Datasheet   Cables Direct B5-110W networking cable, 1 pages
B6-510B Datasheet   Cables Direct B6-510B networking cable, 1 pages
URT-601.5R Datasheet   Cables Direct URT-601.5R networking cable, 1 pages
B6ST-710B Datasheet   Cables Direct B6ST-710B networking cable, 1 pages
XXURT-615R Datasheet   Cables Direct XXURT-615R networking cable, 1 pages
B6ST-701B Datasheet   Cables Direct B6ST-701B networking cable, 1 pages
URT-620K Datasheet   Cables Direct URT-620K networking cable, 1 pages
URT-601.5K Datasheet   Cables Direct URT-601.5K networking cable, 1 pages
B6LZ-603B Datasheet   Cables Direct B6LZ-603B networking cable, 1 pages
ERT-601-5G Datasheet   Cables Direct ERT-601-5G networking cable, 1 pages
RJEXT-03 Datasheet   Cables Direct RJEXT-03 networking cable, 1 pages
B6LZ-602B Datasheet   Cables Direct B6LZ-602B networking cable, 1 pages
B5-102B Datasheet   Cables Direct B5-102, 1 pages
URT-601V Datasheet   Cables Direct URT-601V networking cable, 1 pages