From 5a29c4430e3a1feffa744f03a20c6753061dea6c Mon Sep 17 00:00:00 2001 From: Ralph Schindler Date: Thu, 18 Aug 2011 13:34:38 -0500 Subject: [PATCH] Zend\Http & Documentation - Broken Zend\Http into separate files - added a build-manual2.php script to help building manual with PhD - created a manual2.xml.in for ZF2 specific sections --- .gitignore | 1 + documentation/manual/en/manual.xml.in | 4614 +++++++++-------- documentation/manual/en/manual2.xml.in | 108 + .../manual/en/module_specs/Zend_Http.xml | 1708 +----- .../en/module_specs/Zend_Http_Headers.xml | 360 ++ .../en/module_specs/Zend_Http_Request.xml | 741 +++ .../module_specs/Zend_Http_Response-old.xml | 348 ++ .../en/module_specs/Zend_Http_Response.xml | 747 ++- working/build-manual2.php | 81 + 9 files changed, 4453 insertions(+), 4255 deletions(-) create mode 100644 documentation/manual/en/manual2.xml.in create mode 100644 documentation/manual/en/module_specs/Zend_Http_Headers.xml create mode 100644 documentation/manual/en/module_specs/Zend_Http_Request.xml create mode 100644 documentation/manual/en/module_specs/Zend_Http_Response-old.xml create mode 100644 working/build-manual2.php diff --git a/.gitignore b/.gitignore index e1b6d3b4512..d2096fd2857 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ nbproject .buildpath .project .settings/ +tmp/ \ No newline at end of file diff --git a/documentation/manual/en/manual.xml.in b/documentation/manual/en/manual.xml.in index 92f6bde5d70..71ddef649b9 100644 --- a/documentation/manual/en/manual.xml.in +++ b/documentation/manual/en/manual.xml.in @@ -32,20 +32,20 @@ --> - - &chapter.introduction.title; - - - - - - - - - - - - + + + + + + + + + + + + + + &part.learning.title; @@ -60,2351 +60,2367 @@ - - &part.learning.quickstart.title; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &part.learning.autoloading.title; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &part.learning.plugins.title; - - - - - - - - - - - - - - - - - - - - &part.learning.layout.title; - - - - - - - - - - - - - - - - - - - - &part.learning.view.placeholders.title; - - - - - - - - - - - - - - - - - - - - - - - - - &part.learning.form.decorators.title; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &part.learning.multiuser.title; - - - - - - - - - - - - - - - - - - - - - - - - - &part.learning.lucene.title; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &part.learning.paginator.title; - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &part.reference.title; - Zend_Acl - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Zend_Amf + + Zend\EventManager - - - - - - + - + - Zend_Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Zend_Auth - - - - - - - - - - - - + Zend_Http + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - Zend_Cache + Zend_Loader - - - - - - + - + - + + - + - + - Zend_Captcha + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Zend_Uri - - - - - - - - - - - + - + - - Zend_Cloud - - - - - - - - - - - - - - Zend_CodeGenerator - - - - - - - - - - - - - - - - - - - Zend_Config - - - - - - - - - - - - - - - - - - - - - - - - Zend_Config_Writer - - - - - - - - - Zend_Console_Getopt - - - - - - - - - - - - - - - - - - - - - - - - Zend_Controller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Currency - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Date - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Db - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Debug - - - - - - - - - Zend_Dojo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Dom - - - - - - - - - - - - - - - Zend\EventManager - - - - - - - - - Zend_Exception - - - - - - - - - - - - - - - - - - - Zend_Feed - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_File - - - - - - - - - - - - - - - - - - - Zend_Filter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Form - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Gdata - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Http - - - - - - - - - Zend_InfoCard - - - - - - - - - Zend_Json - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Layout - - - - - - - - - - - - - - - - - - - - - - - - Zend_Ldap - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Loader - - - - - - - - - - - - - - - - Zend_Locale - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Mail - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Markup - - - - - - - - - - - - - - - - - - - - - - - - Zend_Measure - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Memory - - - - - - - - - - - - - - - - - - - Zend_Mime - - - - - - - - - - - - - - - - - - - Zend_Navigation - - - - - - - - - - - - - - - - - - - Zend_Oauth - - - - - - - - - Zend_OpenId - - - - - - - - - - - - - - - - - - - Zend_Paginator - - - - - - - - - - - - - - - - - - - - - - - - Zend_Pdf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_ProgressBar - - - - - - - - - Zend_Queue - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Reflection - - - - - - - - - - - - - - - - - - - Zend_Registry - - - - - - - - - Zend_Rest - - - - - - - - - - - - - - - - - - - Zend_Search_Lucene - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Serializer - - - - - - - - - - - - - - - Zend_Server - - - - - - - - - - - - - - Zend_Service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Session - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Soap - - - - - - - - - - - - - - - - - - - - - - - - Zend_Tag - - - - - - - - - - - - - - Zend_Test - - - - - - - - - - - - - - - - - - - Zend_Text - - - - - - - - - - - - - - Zend_TimeSync - - - - - - - - - - - - - - Zend_Tool - - - - - - - - - - - - - - Zend_Tool_Framework - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Tool_Project - - - - - - - - - - - - - - - - - - - - - - - - Zend_Translate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Uri - - - - - - - - - Zend_Validate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Version - - - - - - - - - Zend_View - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Zend_Wildfire - - - - - - - - - Zend_XmlRpc - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - &appendix.migration.title; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - &appendix.performance.title; - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/documentation/manual/en/manual2.xml.in b/documentation/manual/en/manual2.xml.in new file mode 100644 index 00000000000..1587cb7b1fe --- /dev/null +++ b/documentation/manual/en/manual2.xml.in @@ -0,0 +1,108 @@ + + + + %language-snippets; + + + + %language-snippets.default; +]> + + + &book.title; + &book.subtitle; + &book.edition; + + + 2005- + + Zend Technologies Inc. + (http://www.zend.com) + + + + + + &part.learning.title; + + + Learning Dependency Injection + + + + + + + + + + + &part.reference.title; + + + Zend\EventManager + + + + + + + + + Zend\Http + + + + + + + + + + + + + + + + + + + + + + + + Zend_Loader + + + + + + + + + + + + + + Zend_Uri + + + + + + + + + + + + + + + + diff --git a/documentation/manual/en/module_specs/Zend_Http.xml b/documentation/manual/en/module_specs/Zend_Http.xml index 5a7c24ab897..28c3e8a05ba 100644 --- a/documentation/manual/en/module_specs/Zend_Http.xml +++ b/documentation/manual/en/module_specs/Zend_Http.xml @@ -1,17 +1,15 @@ -
- The HTTP Component +
+ Zend\Http -
+
Overview - Zend\Http is one of the primary foundational components of Zend - Framework. Since much of what PHP does is web, specifically HTTP, - it makes sense to have a performant, extensible, concise and - consistent API to do all things HTTP. In nutshell, there are - several parts of Zend\Http: + Zend\Http is one of the primary foundational components of Zend Framework. Since much of what PHP does is + web, specifically HTTP, it makes sense to have a performant, extensible, concise and consistent API to do + all things HTTP. In nutshell, there are several parts of Zend\Http: @@ -48,8 +46,8 @@ - A Client implementation with various adapters that allow - for sending requests and introspecting responses. + A Client implementation with various adapters that allow for sending requests and introspecting + responses. @@ -57,1690 +55,20 @@
-
+
Zend\Http Request, Response and Headers - The Request, Response and Headers portion of component Zend\Http - component provides a fluent object oriented interface for - introspecting information from all the various parts of an http - request or http response. The two main objects are - 'Zend\Http\Request' and 'Zend\Http\Response'. These two classes - are "context-less", meaning, that they model a request or response - in the same way whether it is presented by a client (to - send a request and receive a response) or by a - server (to receive a request and send a - response). In other words, regardless of the context, the API - remains the same for introspecting their various respective parts. - Each attempt to fully model a request or response so that a - developer can create these objects from a factory, or they can be - created and populated by hand. -
- -
- -
- - Overview - - - - The Zend\Http\Request object is responsible for providing a fluent - API that allows a developer to interact with all the various parts - of an HTTP request. - - - - A typical HTTP Request looks like this: -
-    --------------------------
-    | METHOD | URI | VERSION |
-    --------------------------
-    |        HEADERS         |
-    --------------------------
-    |         BODY           |
-    --------------------------
-                
-
- - - In simplified terms, the request consist of a method, uri and the HTTP - version number which all make up the Request Line. Next, is a set of - headers, there can be 0 or an unlimited amount of headers. After that, - is the request body, which is typically used when a client wishes to - send data to the server in the form of an encoded file, or set of - POST parameters, for example. More information on the structure and - specification of an HTTP request can be found in the RFC2616 on W3.org - site: - here - - -
- -
- - Quick Start - - - - Request objects can either be created from the provided fromString() - factory, or if you wish to have a completely empty object to start with - by simply instantiating the Zend\Http\Request class. - - - -setMethod(Zend\Http\Request::METHOD_POST); -$request->setUri('/foo'); -$request->headers()->addHeaders(array( - 'HeaderField1' => 'header-field-value' - 'HeaderField2' => 'header-field-value2' -); -$request->post()->set('foo', 'bar'); -?> - - -
- -
- - Configuration Options - - - - None currently - - - - - </variablelist> - </section> - - <section xml:id="zend.http.request.methods"> - <info> - <title>Available Methods - - - - - - - fromString - - string $string - - - - - - - - Returns Zend\Http\Request - - - - - - - setMethod - - string $method - - - - - - - - Returns Zend\Http\Request - - - - - - - getMethod - - - - - - - - - - Returns string - - - - - - - setUri - - string|Zend\Stdlib\RequestDescription\Zend\Stdlib\Message\Zend\Stdlib\ParametersDescription\Zend\Stdlib\Parameters\Zend\Uri\Http $uri - - - - - - - - Returns Zend\Http\Request - - - - - - - getUri - - - - - - - - - - Returns string - - - - - - - uri - - - - - - - - - - Returns Zend\Stdlib\RequestDescription\Zend\Stdlib\Message\Zend\Stdlib\ParametersDescription\Zend\Stdlib\Parameters\Zend\Uri\Http - - - - - - - setVersion - - string $version - - - - - - - - Returns Zend\Http\Request - - - - - - - getVersion - - - - - - - - - - Returns string - - - - - - - setQuery - - ParametersDescription $query - - - - - - - - Returns Zend\Http\Request - - - - - - - query - - - - - - - - - - Returns ParametersDescription - - - - - - - setPost - - ParametersDescription $post - - - - - - - - Returns Zend\Http\Request - - - - - - - post - - - - - - - - - - Returns Zend\Stdlib\ParametersDescription - - - - - - - cookie - - - - - - - - - - Returns Zend\Stdlib\ParametersDescription - - - - - - - setFile - - ParametersDescription $files - - - - - - - - Returns Zend\Http\Request - - - - - - - file - - - - - - - - - - Returns ParametersDescription - - - - - - - setServer - - ParametersDescription $server - - - - - - - - Returns Zend\Http\Request - - - - - - - server - - - - - - - - - - Returns Zend\Stdlib\ParametersDescription - - - - - - - setEnv - - Zend\Stdlib\ParametersDescription $env - - - - - - - - Returns Zend\Http\Request - - - - - - - env - - - - - - - - - - Returns Zend\Stdlib\ParametersDescription - - - - - - - setHeaders - - Zend\Http\RequestHeaders $headers - - - - - - - - Returns Zend\Http\Request - - - - - - - headers - - - - - - - - - - Returns Zend\Http\RequestHeaders - - - - - - - setRawBody - - string $string - - - - - - - - Returns Zend\Http\Request - - - - - - - getRawBody - - - - - - - - - - Returns string - - - - - - - isOptions - - - - - - - - - - Returns bool - - - - - - - isGet - - - - - - - - - - Returns bool - - - - - - - isHead - - - - - - - - - - Returns bool - - - - - - - isPost - - - - - - - - - - Returns bool - - - - - - - isPut - - - - - - - - - - Returns bool - - - - - - - isDelete - - - - - - - - - - Returns bool - - - - - - - isTrace - - - - - - - - - - Returns bool - - - - - - - isConnect - - - - - - - - - - Returns bool - - - - - - - renderRequestLine - - - - - - - - - - Returns string - - - - - - - toString - - - - - - - - - - Returns string - - - - - - - setMetadata - - string|int|array|Traversable $spec, mixed $value - - - - - - Set message metadata - Non-destructive setting of message metadata; always adds to the metadata, never overwrites - the entire metadata container. - Returns Zend\Stdlib\Message - - - - - - - getMetadata - - null|string|int $key, null|mixed $default - - - - - - Retrieve all metadata or a single metadatum as specified by key - - Returns mixed - - - - - - - setContent - - mixed $value - - - - - - Set message content - - Returns Zend\Stdlib\Message - - - - - - - getContent - - - - - - - - Get message content - - Returns mixed - - - - -
- -
- - Examples - - -
-
- - - - -
- - Zend\Http\Response - - -
- - Overview - - - - The Zend\Http\Response object is responsible for providing a fluent - API that allows a developer to interact with all the various parts - of an HTTP response. + The Request, Response and Headers portion of component Zend\Http component provides a fluent object oriented + interface for introspecting information from all the various parts of an http request or http response. The + two main objects are 'Zend\Http\Request' and 'Zend\Http\Response'. These two classes are "context-less", + meaning, that they model a request or response in the same way whether it is presented by a client (to + send a request and receive a response) or by a server (to + receive a request and send a response). In other words, + regardless of the context, the API remains the same for introspecting their various respective parts. Each + attempt to fully model a request or response so that a developer can create these objects from a factory, or + they can be created and populated by hand. - - - A typical HTTP Response looks like this: -
----------------------------
-| VERSION | CODE | REASON |
----------------------------
-|        HEADERS          |
----------------------------
-|         BODY            |
----------------------------
-            
-
- - - In simplified terms, the response consist of the HTTP version, status - code, and the reason string for the provided status code which all - make up the Response Line. Next, is a set of headers, there can be 0 - or an unlimited amount of headers. After that, is the request body, - which is typically an string of HTML that will render on the clients - browser, but can also be a place for request/response payload data - typical of an AJAX request. More information on the structure and - specification of an HTTP request can be found in the RFC2616 on W3.org - site: - here - - -
- -
- - Quick Start - - - - Response objects can either be created from the provided fromString() - factory, or if you wish to have a completely empty object to start with - by simply instantiating the Zend\Http\Response class. - - - - - - Hello World - - -EOS); - -// OR - -$request = new Zend\Http\Request(); -$request->setStatusCode(Zend\Http\Response::STATUS_CODE_200); -$request->headers()->addHeaders(array( - 'HeaderField1' => 'header-field-value' - 'HeaderField2' => 'header-field-value2' -); -$request->setRawBody(<< - - Hello World - - -EOS); -?> - - -
- -
- - Configuration Options - - - - None currently available - - - - - </variablelist> - </section> - - <section xml:id="zend.http.response.methods"> - <info> - <title>Available Methods - - - - - - - fromString - - string $string - - - - - - Populate object from string - - Returns Zend\Http\Response - - - - - - - renderStatusLine - - - - - - - - Render the status line header - - Returns string - - - - - - - setHeaders - - Headers $headers - - - - - - Set response headers - - Returns Zend\Http\Response - - - - - - - headers - - - - - - - - Get response headers - - Returns Headers - - - - - - - setVersion - - string $version - - - - - - - - Returns Zend\Http\Response - - - - - - - getVersion - - - - - - - - - - Returns string - - - - - - - getStatusCode - - - - - - - - Retrieve HTTP status code - - Returns int - - - - - - - setReasonPhrase - - string $reasonPhrase - - - - - - - - Returns Zend\Http\Response - - - - - - - getReasonPhrase - - - - - - - - Get HTTP status message - - Returns string - - - - - - - setStatusCode - - numeric $code - - - - - - Set HTTP status code and (optionally) message - - Returns Zend\Http\Response - - - - - - - isClientError - - - - - - - - Does the status code indicate a client error? - - Returns bool - - - - - - - isForbidden - - - - - - - - Is the request forbidden due to ACLs? - - Returns bool - - - - - - - isInformational - - - - - - - - Is the current status "informational"? - - Returns bool - - - - - - - isNotFound - - - - - - - - Does the status code indicate the resource is not found? - - Returns bool - - - - - - - isOk - - - - - - - - Do we have a normal, OK response? - - Returns bool - - - - - - - isServerError - - - - - - - - Does the status code reflect a server error? - - Returns bool - - - - - - - isRedirect - - - - - - - - Do we have a redirect? - - Returns bool - - - - - - - isSuccess - - - - - - - - Was the response successful? - - Returns bool - - - - - - - decodeChunkedBody - - string $body - - - - - - Decode a "chunked" transfer-encoded body and return the decoded text - - Returns string - - - - - - - decodeGzip - - string $body - - - - - - Decode a gzip encoded message (when Content-encoding = gzip) - Currently requires PHP with zlib support - Returns string - - - - - - - decodeDeflate - - string $body - - - - - - Decode a zlib deflated message (when Content-encoding = deflate) - Currently requires PHP with zlib support - Returns string - - - - - - - setMetadata - - string|int|array|Traversable $spec, mixed $value - - - - - - Set message metadata - Non-destructive setting of message metadata; always adds to the metadata, never overwrites - the entire metadata container. - Returns Zend\Stdlib\Message - - - - - - - getMetadata - - null|string|int $key, null|mixed $default - - - - - - Retrieve all metadata or a single metadatum as specified by key - - Returns mixed - - - - - - - setContent - - mixed $value - - - - - - Set message content - - Returns Zend\Stdlib\Message - - - - - - - getContent - - - - - - - - Get message content - - Returns mixed - - - - - - - toString - - - - - - - - - - Returns string - - - - -
- -
- - Examples - - -
-
- -
- - Zend\Http\Headers - - -
- - Overview - - -
- -
- - Quick Start - - -
- -
- - Configuration Options - - - - - </variablelist> - </section> - - <section xml:id="zend.http.headers.methods"> - <info> - <title>Available Methods - - - - - - - fromString - - string $string - - - - - - Populates headers from string representation - Parses a string for headers, and aggregates them, in order, in the - current instance. - - On Request/Response variants, this should look for the first line - matching the appropriate regex, and then forward the remainder of the - string on to parent::fromString(). - Returns Zend\Http\Headers - - - - - - - setPluginLoader - - PluginClassLoader $pluginLoader - - - - - - - - Returns Zend\Http\Headers - - - - - - - getPluginClassLoader - - - - - - - - - - Returns PluginClassLoader - - - - - - - addHeaders - - array|Traversable $headers - - - - - - Add many headers at once - Expects an array (or Traversable object) of type/value pairs. - Returns Zend\Http\Headers - - - - - - - addHeaderLine - - string $headerFieldNameOrLine, string $fieldValue - - - - - - - - Returns Zend\Http\Headers - - - - - - - addHeader - - Zend\Http\Header\HeaderDescription $header - - - - - - Add a header onto the queue - - Returns Zend\Http\Headers - - - - - - - removeHeader - - Header $header - - - - - - - - Returns Zend\Http\Headers - - - - - - - clearHeaders - - - - - - - - Clear all headers - Removes all headers from queue - Returns void - - - - - - - get - - string $name - - - - - - Get all headers of a certain name/type - - Returns false|Zend\Http\Header\HeaderDescription|ArrayIterator - - - - - - - has - - string $name - - - - - - Test for existence of a type of header - - Returns bool - - - - - - - next - - - - - - - - - - Returns void - - - - - - - key - - - - - - - - - - Returns mixed - - - - - - - valid - - - - - - - - - - Returns bool - - - - - - - rewind - - - - - - - - - - Returns void - - - - - - - current - - - - - - - - - - Returns Zend\Http\Header\HeaderDescription - - - - - - - count - - - - - - - - - - Returns int - - - - - - - toString - - - - - - - - Render all headers at once - This method handles the normal iteration of headers; it is up to the - concrete classes to prepend with the appropriate status/request line. - Returns string - - - - - - - toArray - - - - - - - - - - Returns array - - - - -
- -
- - Examples - - -
-
- -
- xxx -
diff --git a/documentation/manual/en/module_specs/Zend_Http_Headers.xml b/documentation/manual/en/module_specs/Zend_Http_Headers.xml new file mode 100644 index 00000000000..e40311f62d6 --- /dev/null +++ b/documentation/manual/en/module_specs/Zend_Http_Headers.xml @@ -0,0 +1,360 @@ + + +
+ + + Zend\Http\Headers And The Various Header Classes + + +
+ + Overview + + +
+ +
+ + Quick Start + + +
+ +
+ + Configuration Options + + + + + </variablelist> + </section> + + <section xml:id="zend.http.headers.methods"> + <info> + <title>Available Methods + + + + + + + fromString + + string $string + + + + + + Populates headers from string representation + Parses a string for headers, and aggregates them, in order, in the +current instance. + +On Request/Response variants, this should look for the first line +matching the appropriate regex, and then forward the remainder of the +string on to parent::fromString(). + Returns Zend\Http\Headers + + + + + + + setPluginLoader + + PluginClassLoader $pluginLoader + + + + + + + + Returns Zend\Http\Headers + + + + + + + getPluginClassLoader + + + + + + + + + + Returns PluginClassLoader + + + + + + + addHeaders + + array|Traversable $headers + + + + + + Add many headers at once + Expects an array (or Traversable object) of type/value pairs. + Returns Zend\Http\Headers + + + + + + + addHeaderLine + + string $headerFieldNameOrLine, string $fieldValue + + + + + + + + Returns Zend\Http\Headers + + + + + + + addHeader + + Zend\Http\Header\HeaderDescription $header + + + + + + Add a header onto the queue + + Returns Zend\Http\Headers + + + + + + + removeHeader + + Header $header + + + + + + + + Returns Zend\Http\Headers + + + + + + + clearHeaders + + + + + + + + Clear all headers + Removes all headers from queue + Returns void + + + + + + + get + + string $name + + + + + + Get all headers of a certain name/type + + Returns false|Zend\Http\Header\HeaderDescription|ArrayIterator + + + + + + + has + + string $name + + + + + + Test for existence of a type of header + + Returns bool + + + + + + + next + + + + + + + + + + Returns void + + + + + + + key + + + + + + + + + + Returns mixed + + + + + + + valid + + + + + + + + + + Returns bool + + + + + + + rewind + + + + + + + + + + Returns void + + + + + + + current + + + + + + + + + + Returns Zend\Http\Header\HeaderDescription + + + + + + + count + + + + + + + + + + Returns int + + + + + + + toString + + + + + + + + Render all headers at once + This method handles the normal iteration of headers; it is up to the +concrete classes to prepend with the appropriate status/request line. + Returns string + + + + + + + toArray + + + + + + + + + + Returns array + + + + +
+ +
+ + Examples + + +
+
\ No newline at end of file diff --git a/documentation/manual/en/module_specs/Zend_Http_Request.xml b/documentation/manual/en/module_specs/Zend_Http_Request.xml new file mode 100644 index 00000000000..763bf4c8ba0 --- /dev/null +++ b/documentation/manual/en/module_specs/Zend_Http_Request.xml @@ -0,0 +1,741 @@ + + +
+ Zend\Http\Request + +
+ + Overview + + + + The Zend\Http\Request object is responsible for providing a fluent + API that allows a developer to interact with all the various parts + of an HTTP request. + + + + A typical HTTP Request looks like this: + +
+--------------------------
+| METHOD | URI | VERSION |
+--------------------------
+|        HEADERS         |
+--------------------------
+|         BODY           |
+--------------------------
+        
+ + + + In simplified terms, the request consist of a method, uri and the HTTP + version number which all make up the Request Line. Next, is a set of + headers, there can be 0 or an unlimited amount of headers. After that, + is the request body, which is typically used when a client wishes to + send data to the server in the form of an encoded file, or set of + POST parameters, for example. More information on the structure and + specification of an HTTP request can be found in the RFC2616 on W3.org + site: + here + + +
+ +
+ + Quick Start + + + + Request objects can either be created from the provided fromString() + factory, or if you wish to have a completely empty object to start with + by simply instantiating the Zend\Http\Request class. + + + setMethod(Zend\Http\Request::METHOD_POST); +$request->setUri('/foo'); +$request->headers()->addHeaders(array( +'HeaderField1' => 'header-field-value' +'HeaderField2' => 'header-field-value2' +); +$request->post()->set('foo', 'bar'); + +]]> + +
+ +
+ + Configuration Options + + + + None currently + + + + + </variablelist> + </section> + + <section xml:id="zend.http.request.methods"> + <info> + <title>Available Methods + + + + + + + fromString + + string $string + + + + + + + + Returns Zend\Http\Request + + + + + + + setMethod + + string $method + + + + + + + + Returns Zend\Http\Request + + + + + + + getMethod + + + + + + + + + + Returns string + + + + + + + setUri + + string|Zend\Stdlib\RequestDescription\Zend\Stdlib\Message\Zend\Stdlib\ParametersDescription\Zend\Stdlib\Parameters\Zend\Uri\Http $uri + + + + + + + + Returns Zend\Http\Request + + + + + + + getUri + + + + + + + + + + Returns string + + + + + + + uri + + + + + + + + + + Returns Zend\Stdlib\RequestDescription\Zend\Stdlib\Message\Zend\Stdlib\ParametersDescription\Zend\Stdlib\Parameters\Zend\Uri\Http + + + + + + + setVersion + + string $version + + + + + + + + Returns Zend\Http\Request + + + + + + + getVersion + + + + + + + + + + Returns string + + + + + + + setQuery + + ParametersDescription $query + + + + + + + + Returns Zend\Http\Request + + + + + + + query + + + + + + + + + + Returns ParametersDescription + + + + + + + setPost + + ParametersDescription $post + + + + + + + + Returns Zend\Http\Request + + + + + + + post + + + + + + + + + + Returns Zend\Stdlib\ParametersDescription + + + + + + + cookie + + + + + + + + + + Returns Zend\Stdlib\ParametersDescription + + + + + + + setFile + + ParametersDescription $files + + + + + + + + Returns Zend\Http\Request + + + + + + + file + + + + + + + + + + Returns ParametersDescription + + + + + + + setServer + + ParametersDescription $server + + + + + + + + Returns Zend\Http\Request + + + + + + + server + + + + + + + + + + Returns Zend\Stdlib\ParametersDescription + + + + + + + setEnv + + Zend\Stdlib\ParametersDescription $env + + + + + + + + Returns Zend\Http\Request + + + + + + + env + + + + + + + + + + Returns Zend\Stdlib\ParametersDescription + + + + + + + setHeaders + + Zend\Http\RequestHeaders $headers + + + + + + + + Returns Zend\Http\Request + + + + + + + headers + + + + + + + + + + Returns Zend\Http\RequestHeaders + + + + + + + setRawBody + + string $string + + + + + + + + Returns Zend\Http\Request + + + + + + + getRawBody + + + + + + + + + + Returns string + + + + + + + isOptions + + + + + + + + + + Returns bool + + + + + + + isGet + + + + + + + + + + Returns bool + + + + + + + isHead + + + + + + + + + + Returns bool + + + + + + + isPost + + + + + + + + + + Returns bool + + + + + + + isPut + + + + + + + + + + Returns bool + + + + + + + isDelete + + + + + + + + + + Returns bool + + + + + + + isTrace + + + + + + + + + + Returns bool + + + + + + + isConnect + + + + + + + + + + Returns bool + + + + + + + renderRequestLine + + + + + + + + + + Returns string + + + + + + + toString + + + + + + + + + + Returns string + + + + + + + setMetadata + + string|int|array|Traversable $spec, mixed $value + + + + + + Set message metadata + Non-destructive setting of message metadata; always adds to the metadata, never overwrites +the entire metadata container. + Returns Zend\Stdlib\Message + + + + + + + getMetadata + + null|string|int $key, null|mixed $default + + + + + + Retrieve all metadata or a single metadatum as specified by key + + Returns mixed + + + + + + + setContent + + mixed $value + + + + + + Set message content + + Returns Zend\Stdlib\Message + + + + + + + getContent + + + + + + + + Get message content + + Returns mixed + + + + +
+ +
+ + Examples + + +
+ + +
\ No newline at end of file diff --git a/documentation/manual/en/module_specs/Zend_Http_Response-old.xml b/documentation/manual/en/module_specs/Zend_Http_Response-old.xml new file mode 100644 index 00000000000..423962d4701 --- /dev/null +++ b/documentation/manual/en/module_specs/Zend_Http_Response-old.xml @@ -0,0 +1,348 @@ + +
Zend_Http_Response + + +
Introduction + + + + Zend_Http_Response provides easy access to an + HTTP responses message, as well as a set of static methods for + parsing HTTP response messages. Usually, + Zend_Http_Response is used as an object returned by a + Zend_Http_Client request. + + + + In most cases, a Zend_Http_Response object will be instantiated + using the fromString() method, which reads a string containing a + HTTP response message, and returns a new + Zend_Http_Response object: + Instantiating a Zend_Http_Response Object Using the Factory Method + + + + + + + + You can also use the contractor method to create a new response + object, by specifying all the parameters of the response: + + + + public function __construct($code, $headers, $body = null, $version = '1.1', + $message = null) + + + + + + $code: The HTTP response code (eg. 200, + 404, etc.) + + + + + + $headers: An associative array of HTTP + response headers (eg. 'Host' => 'example.com') + + + + + + $body: The response body as a string + + + + + + $version: The HTTP response version + (usually 1.0 or 1.1) + + + + + + $message: The HTTP response message (eg + 'OK', 'Internal Server Error'). If not specified, the message will be set + according to the response code + + + +
+ +
Boolean Tester Methods + + + + Once a Zend_Http_Response object is instantiated, it provides + several methods that can be used to test the type of the response. These all + return Boolean TRUE or FALSE: + + + + isSuccessful(): Whether the request was successful + or not. Returns TRUE for HTTP 1xx + and 2xx response codes + + + + + + isError(): Whether the response code implies an + error or not. Returns TRUE for HTTP + 4xx (client errors) and 5xx (server errors) response codes + + + + + + isRedirect(): Whether the response is a redirection + response or not. Returns TRUE for + HTTP 3xx response codes + + + + + Using the isError() method to validate a response + + + isError()) { + echo "Error transmitting data.\n" + echo "Server reply was: " . $response->getStatus() . + " " . $response->getMessage() . "\n"; +} +// .. process the response here... +]]> + + +
+ +
Accessor Methods + + + + The main goal of the response object is to provide easy access to + various response parameters. + + + + getStatus(): Get the HTTP + response status code (eg. 200, 504, etc.) + + + + + + getMessage(): Get the HTTP + response status message (eg. "Not Found", "Authorization Required") + + + + + + getBody(): Get the fully decoded + HTTP response body + + + + + + getRawBody(): Get the raw, possibly encoded + HTTP response body. if the body was decoded using GZIP + encoding for example, it will not be decoded. + + + + + + getHeaders(): Get the HTTP + response headers as an associative array (eg. 'Content-type' => 'text/html') + + + + + + getHeader($header): Get a specific + HTTP response header, specified by $header + + + + + + getHeadersAsString($status_line, $br): Get + the entire set of headers as a string. If $status_line is + TRUE (default), the first status line (eg. "HTTP/1.1 + 200 OK") will also be returned. Lines are broken with the + $br parameter (Can be, for example, "<br />". + Default "\n") + + + + + + string asString($br): Get the entire response message as + a string. Lines are broken with the $br parameter (Can be, for example, + "<br />". Default "\n"). You can also use the magic method + __toString() when casting the object as a string. + It will then proxy to asString(). + + + + + Using Zend_Http_Response Accessor Methods + + + getStatus() == 200) { + echo "The request returned the following information:
"; + echo $response->getBody(); +} else { + echo "An error occurred while fetching data:
"; + echo $response->getStatus() . ": " . $response->getMessage(); +} +]]>
+
+ + Always check return value + + + + Since a response can contain several instances of the same header, + the getHeader() method and getHeaders() method may return either a + single string, or an array of strings for each header. You should + always check whether the returned value is a string or array. + + + + Accessing Response Headers + + + getHeader('Content-type'); +if (is_array($ctype)) $ctype = $ctype[0]; + +$body = $response->getBody(); +if ($ctype == 'text/html' || $ctype == 'text/xml') { + $body = htmlentities($body); +} + +echo $body; +]]> + +
+
+ +
Static HTTP Response Parsers + + + + The Zend_Http_Response class also includes several + internally-used methods for processing and parsing HTTP response + messages. These methods are all exposed as static methods, which means they can be + used externally, even if you do not need to instantiate a response + object, and just want to extract a specific part of the response. + + + + + Zend_Http_Response::extractCode($response_str): + Extract and return the HTTP response code (eg. 200 or + 404) from $response_str + + + + + + Zend_Http_Response::extractMessage($response_str): + Extract and return the HTTP response message (eg. "OK" or + "File Not Found") from $response_str + + + + + + Zend_Http_Response::extractVersion($response_str): + Extract and return the HTTP version (eg. 1.1 or 1.0) from + $response_str + + + + + + Zend_Http_Response::extractHeaders($response_str): + Extract and return the HTTP response headers from + $response_str as an array + + + + + + Zend_Http_Response::extractBody($response_str): + Extract and return the HTTP response body from + $response_str + + + + + + Zend_Http_Response::responseCodeAsText($code, + $http11): Get the standard HTTP response + message for a response code $code. For example, will return "Internal Server + Error" if $code is 500. If $http11 is + TRUE (default), will return + HTTP/1.1 standard messages - otherwise + HTTP/1.0 messages will be returned. If + $code is not specified, this method will return all known + HTTP response codes as an associative (code => message) + array. + + + + + + + Apart from parser methods, the class also includes a set of decoders for common + HTTP response transfer encodings: + + + + + Zend_Http_Response::decodeChunkedBody($body): + Decode a complete "Content-Transfer-Encoding: Chunked" body + + + + + + Zend_Http_Response::decodeGzip($body): Decode + a "Content-Encoding: gzip" body + + + + + + Zend_Http_Response::decodeDeflate($body): Decode + a "Content-Encoding: deflate" body + + + + +
+
diff --git a/documentation/manual/en/module_specs/Zend_Http_Response.xml b/documentation/manual/en/module_specs/Zend_Http_Response.xml index 423962d4701..a973e20f10c 100644 --- a/documentation/manual/en/module_specs/Zend_Http_Response.xml +++ b/documentation/manual/en/module_specs/Zend_Http_Response.xml @@ -1,348 +1,563 @@ - -
Zend_Http_Response - + + +
-
Introduction - + + Zend\Http\Response + + +
+ + Overview + - Zend_Http_Response provides easy access to an - HTTP responses message, as well as a set of static methods for - parsing HTTP response messages. Usually, - Zend_Http_Response is used as an object returned by a - Zend_Http_Client request. + The Zend\Http\Response object is responsible for providing a fluent + API that allows a developer to interact with all the various parts + of an HTTP response. - In most cases, a Zend_Http_Response object will be instantiated - using the fromString() method, which reads a string containing a - HTTP response message, and returns a new - Zend_Http_Response object: - Instantiating a Zend_Http_Response Object Using the Factory Method - - - - + A typical HTTP Response looks like this: + +--------------------------- +| VERSION | CODE | REASON | +--------------------------- +| HEADERS | +--------------------------- +| BODY | +--------------------------- + - You can also use the contractor method to create a new response - object, by specifying all the parameters of the response: + In simplified terms, the response consist of the HTTP version, status + code, and the reason string for the provided status code which all + make up the Response Line. Next, is a set of headers, there can be 0 + or an unlimited amount of headers. After that, is the request body, + which is typically an string of HTML that will render on the clients + browser, but can also be a place for request/response payload data + typical of an AJAX request. More information on the structure and + specification of an HTTP request can be found in the RFC2616 on W3.org + site: + here +
+ +
+ + Quick Start + + - public function __construct($code, $headers, $body = null, $version = '1.1', - $message = null) + Response objects can either be created from the provided fromString() + factory, or if you wish to have a completely empty object to start with + by simply instantiating the Zend\Http\Response class. - - - - $code: The HTTP response code (eg. 200, - 404, etc.) - - - - - - $headers: An associative array of HTTP - response headers (eg. 'Host' => 'example.com') - - - - - - $body: The response body as a string - - - - - - $version: The HTTP response version - (usually 1.0 or 1.1) - - - - - - $message: The HTTP response message (eg - 'OK', 'Internal Server Error'). If not specified, the message will be set - according to the response code - - - + + + Hello World + + +EOS); + +// OR + +$request = new Zend\Http\Request(); +$request->setStatusCode(Zend\Http\Response::STATUS_CODE_200); +$request->headers()->addHeaders(array( +'HeaderField1' => 'header-field-value' +'HeaderField2' => 'header-field-value2' +); +$request->setRawBody(<< + + Hello World + + +EOS); + ]]> +
-
Boolean Tester Methods - +
+ + Configuration Options + - Once a Zend_Http_Response object is instantiated, it provides - several methods that can be used to test the type of the response. These all - return Boolean TRUE or FALSE: - + None currently available + + + + + </variablelist> + </section> + + <section xml:id="zend.http.response.methods"> + <info> + <title>Available Methods + + + + + + + fromString + + string $string + + + + - - isSuccessful(): Whether the request was successful - or not. Returns TRUE for HTTP 1xx - and 2xx response codes - + Populate object from string + + Returns Zend\Http\Response + + + + + + renderStatusLine + + + + + - - isError(): Whether the response code implies an - error or not. Returns TRUE for HTTP - 4xx (client errors) and 5xx (server errors) response codes - + Render the status line header + + Returns string + + + + + + setHeaders + + Headers $headers + + + - - isRedirect(): Whether the response is a redirection - response or not. Returns TRUE for - HTTP 3xx response codes - + Set response headers + + Returns Zend\Http\Response - - - Using the isError() method to validate a response - - - isError()) { - echo "Error transmitting data.\n" - echo "Server reply was: " . $response->getStatus() . - " " . $response->getMessage() . "\n"; -} -// .. process the response here... -]]> - - -
+ + + + + + headers + + + + + -
Accessor Methods - + + Get response headers + + Returns Headers + + + + + + + setVersion + + string $version + + + - - The main goal of the response object is to provide easy access to - various response parameters. - - - getStatus(): Get the HTTP - response status code (eg. 200, 504, etc.) - + + + Returns Zend\Http\Response + + + + + + getVersion + + + + + - - getMessage(): Get the HTTP - response status message (eg. "Not Found", "Authorization Required") - + + + Returns string + + + + + + getStatusCode + + + + + - - getBody(): Get the fully decoded - HTTP response body - + Retrieve HTTP status code + + Returns int + + + + + + setReasonPhrase + + string $reasonPhrase + + + - - getRawBody(): Get the raw, possibly encoded - HTTP response body. if the body was decoded using GZIP - encoding for example, it will not be decoded. - + + + Returns Zend\Http\Response + + + + + + getReasonPhrase + + + + + - - getHeaders(): Get the HTTP - response headers as an associative array (eg. 'Content-type' => 'text/html') - + Get HTTP status message + + Returns string + + + + + + setStatusCode + + numeric $code + + + - - getHeader($header): Get a specific - HTTP response header, specified by $header - + Set HTTP status code and (optionally) message + + Returns Zend\Http\Response + + + + + + isClientError + + + + + - - getHeadersAsString($status_line, $br): Get - the entire set of headers as a string. If $status_line is - TRUE (default), the first status line (eg. "HTTP/1.1 - 200 OK") will also be returned. Lines are broken with the - $br parameter (Can be, for example, "<br />". - Default "\n") - + Does the status code indicate a client error? + + Returns bool + + + + + + isForbidden + + + + + - - string asString($br): Get the entire response message as - a string. Lines are broken with the $br parameter (Can be, for example, - "<br />". Default "\n"). You can also use the magic method - __toString() when casting the object as a string. - It will then proxy to asString(). - + Is the request forbidden due to ACLs? + + Returns bool - - - Using Zend_Http_Response Accessor Methods - - - getStatus() == 200) { - echo "The request returned the following information:
"; - echo $response->getBody(); -} else { - echo "An error occurred while fetching data:
"; - echo $response->getStatus() . ": " . $response->getMessage(); -} -]]>
-
- - Always check return value - - - - Since a response can contain several instances of the same header, - the getHeader() method and getHeaders() method may return either a - single string, or an array of strings for each header. You should - always check whether the returned value is a string or array. - - - - Accessing Response Headers - - - getHeader('Content-type'); -if (is_array($ctype)) $ctype = $ctype[0]; - -$body = $response->getBody(); -if ($ctype == 'text/html' || $ctype == 'text/xml') { - $body = htmlentities($body); -} - -echo $body; -]]> - - -
+
+ + + + + isInformational + + + + + -
Static HTTP Response Parsers - + + Is the current status "informational"? + + Returns bool + + + + + + + isNotFound + + + + + - - The Zend_Http_Response class also includes several - internally-used methods for processing and parsing HTTP response - messages. These methods are all exposed as static methods, which means they can be - used externally, even if you do not need to instantiate a response - object, and just want to extract a specific part of the response. + + Does the status code indicate the resource is not found? + + Returns bool + + + + + + + isOk + + + + + - - - Zend_Http_Response::extractCode($response_str): - Extract and return the HTTP response code (eg. 200 or - 404) from $response_str - + Do we have a normal, OK response? + + Returns bool + + + + + + isServerError + + + + + - - Zend_Http_Response::extractMessage($response_str): - Extract and return the HTTP response message (eg. "OK" or - "File Not Found") from $response_str - + Does the status code reflect a server error? + + Returns bool + + + + + + isRedirect + + + + + - - Zend_Http_Response::extractVersion($response_str): - Extract and return the HTTP version (eg. 1.1 or 1.0) from - $response_str - + Do we have a redirect? + + Returns bool + + + + + + isSuccess + + + + + - - Zend_Http_Response::extractHeaders($response_str): - Extract and return the HTTP response headers from - $response_str as an array - + Was the response successful? + + Returns bool + + + + + + decodeChunkedBody + + string $body + + + - - Zend_Http_Response::extractBody($response_str): - Extract and return the HTTP response body from - $response_str - + Decode a "chunked" transfer-encoded body and return the decoded text + + Returns string + + + + + + decodeGzip + + string $body + + + - - Zend_Http_Response::responseCodeAsText($code, - $http11): Get the standard HTTP response - message for a response code $code. For example, will return "Internal Server - Error" if $code is 500. If $http11 is - TRUE (default), will return - HTTP/1.1 standard messages - otherwise - HTTP/1.0 messages will be returned. If - $code is not specified, this method will return all known - HTTP response codes as an associative (code => message) - array. - + Decode a gzip encoded message (when Content-encoding = gzip) + Currently requires PHP with zlib support + Returns string - - + + + + + + decodeDeflate + + string $body + + + - - Apart from parser methods, the class also includes a set of decoders for common - HTTP response transfer encodings: + + Decode a zlib deflated message (when Content-encoding = deflate) + Currently requires PHP with zlib support + Returns string + + + + + + + setMetadata + + string|int|array|Traversable $spec, mixed $value + + + - - - Zend_Http_Response::decodeChunkedBody($body): - Decode a complete "Content-Transfer-Encoding: Chunked" body - + Set message metadata + Non-destructive setting of message metadata; always adds to the metadata, never overwrites +the entire metadata container. + Returns Zend\Stdlib\Message + + + + + + getMetadata + + null|string|int $key, null|mixed $default + + + - - Zend_Http_Response::decodeGzip($body): Decode - a "Content-Encoding: gzip" body - + Retrieve all metadata or a single metadatum as specified by key + + Returns mixed + + + + + + setContent + + mixed $value + + + - - Zend_Http_Response::decodeDeflate($body): Decode - a "Content-Encoding: deflate" body - + Set message content + + Returns Zend\Stdlib\Message - - + + + + + + getContent + + + + + + + + Get message content + + Returns mixed + + + + + + + toString + + + + + + + + + + Returns string + + + + +
+ +
+ + Examples + +
-
+
\ No newline at end of file diff --git a/working/build-manual2.php b/working/build-manual2.php new file mode 100644 index 00000000000..afbc0b3cfcc --- /dev/null +++ b/working/build-manual2.php @@ -0,0 +1,81 @@ + ' + . $temp_dir . '/manual2.full.xml | tee -a ' + . $temp_dir . '/manual2-err.txt'; +cli_print('Running: ' . $command, 'green'); +system($command); +cli_nl(); + + +$command = $temp_dir . '/phd/pear/phd -g \'phpdotnet\phd\Highlighter_GeSHi\' --xinclude -f zfpackage -d ' + . $temp_dir . '/manual2.full.xml -o ' . $temp_dir . '/manual-html'; +cli_print('Running: ' . $command, 'green'); +system($command); +cli_nl(); + +cli_print('[DONE]', 'green'); +cli_nl(); + +cli_print('HTML Manual located in ' . $temp_dir . '/manual-html/zf-package-chunked-xhtml/manual.html', 'green'); +cli_nl(); + + + + +/** FUNCTIONS **/ + +function cli_print($message, $color) { + static $is_color = null; + if ($is_color === null) $is_color = (function_exists('posix_isatty')); + + list($prefix, $postfix) = array('', ''); + + if ($is_color) { + switch ($color) { + case 'green': + list($prefix, $postfix) = array("\033[32m", "\033[37m"); + break; + case 'red': + list($prefix, $postfix) = array("\033[31m", "\033[37m"); + break; + } + } + + echo $prefix . $message . $postfix; + +} + +function cli_nl() { + echo "\r\n"; +} \ No newline at end of file