@@ -41,6 +41,9 @@ Symfony is built from the ground up around that reality. Whether you realize
41
41
it or not, HTTP is something you use every day. With Symfony, you'll learn
42
42
how to master it.
43
43
44
+ .. index ::
45
+ single: HTTP; Request-response paradigm
46
+
44
47
Step1: The Client Sends a Request
45
48
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46
49
@@ -98,10 +101,10 @@ delete a specific blog entry, for example:
98
101
but many of them are not widely used or supported. In reality, many
99
102
modern browsers only support ``POST `` and ``GET `` in HTML forms. Various
100
103
others are however supported in `XMLHttpRequest `_, as well as by Symfony's
101
- :doc: `router </components/routing/introduction >`.
104
+ :doc: `Routing component </components/routing/introduction >`.
102
105
103
- In addition to the first line, an HTTP request invariably contains other
104
- lines of information called request headers. The headers can supply a wide
106
+ In addition to the first line, a HTTP request invariably contains other
107
+ lines of information called request ** headers ** . The headers can supply a wide
105
108
range of information such as the host of the resource being requested (``Host ``),
106
109
the response formats the client accepts (``Accept ``) and the application the
107
110
client is using to make the request (``User-Agent ``). Many other headers exist
@@ -252,17 +255,18 @@ have all the request information at your fingertips::
252
255
``Request `` class has several public properties via which we can access information
253
256
about the client request. As seen above, the ``$_GET `` and ``$_POST `` PHP global
254
257
variables are accessible via the public ``query `` and ``request `` properties
255
- respectively, ``$_COOKIE `` is accessible via ``cookies ``, ``$_FILES `` via ``files ``
256
- and ``$_SERVER `` via ``server ``. ``headers `` property is mostly equivalent to
257
- a subset of ``$_SERVER `` (e.g. $request->headers->get('User-Agent')). Each property is a
258
+ respectively, ``$_COOKIE `` is accessible via ``cookies `` property, ``$_FILES ``
259
+ via ``files `` property and ``$_SERVER `` via ``server `` property. ``headers ``
260
+ property is mostly equivalent to a subset of ``$_SERVER ``
261
+ (e.g. $request->headers->get('User-Agent')). Each property is a
258
262
:class: `Symfony\\ Component\\ HttpFoundation\\ ParameterBag ` instance (or a sub-class
259
263
of: :class: `Symfony\\ Component\\ HttpFoundation\\ ServerBag `,
260
264
:class: `Symfony\\ Component\\ HttpFoundation\\ FileBag `,
261
- :class: `Symfony\\ Component\\ HttpFoundation\\ HeaderBag `,
265
+ :class: `Symfony\\ Component\\ HttpFoundation\\ HeaderBag `
262
266
), which is a data holder class. All ``ParameterBag `` instances have methods to
263
267
retrieve and update their data like: ``get() `` to return a parameter by name,
264
268
``has() `` to return true if the parameter is defined, ``all() `` to return all
265
- the parameters and many more...
269
+ the parameters and many more.
266
270
267
271
.. _book-fundamentals-attributes :
268
272
@@ -438,7 +442,7 @@ the same simple pattern for every request:
438
442
:align: center
439
443
:alt: Symfony request flow
440
444
441
- Incoming requests are interpreted by the :doc: `router component </book/routing>` and
445
+ Incoming requests are interpreted by the :doc: `Routing component </book/routing>` and
442
446
passed to PHP functions that return ``Response `` objects.
443
447
444
448
Each "page" of your site is defined in a routing configuration file that
@@ -509,7 +513,7 @@ When someone visits the ``/contact`` page, this route is matched, and the
509
513
specified controller is executed. As you'll learn in the
510
514
:ref: `routing chapter <controller-string-syntax >`, the ``AppBundle:Main:contact ``
511
515
string is a short syntax named *logical controller name * that points to a specific
512
- controller ``contactAction() `` inside a controller class called ``MainController)+ ``.
516
+ controller ``contactAction() `` inside a controller class called ``MainController ``.
513
517
In the routing chapter you will also learn about routing parameters like
514
518
``_controller ``, ``_route `` and the ``defaults `` array.
515
519
@@ -529,13 +533,13 @@ object with the HTML ``<h1>Contact us!</h1>``::
529
533
}
530
534
}
531
535
532
- In the :doc: `controller chapter </book/controller >`, you'll learn how a controller can
536
+ In the :doc: `Controller chapter </book/controller >`, you'll learn how a controller can
533
537
render templates, allowing your "presentation" code (i.e. anything that actually
534
538
writes out HTML) to live in a separate template file. This frees up the controller
535
539
to worry only about the hard stuff: interacting with the database, handling
536
540
submitted data, or sending email messages.
537
541
538
- - .. _symfony2-build-your-app-not-your-tools:
542
+ .. _symfony2-build-your-app-not-your-tools :
539
543
540
544
Symfony: Build your App, not your Tools
541
545
---------------------------------------
0 commit comments