The aim of the HeaderManager is to send HTTP headers to the client. Beyond this, the class guarantees, that URLs generated with the LinkGenerator can be used as well.

To make use of this component, it must be included into the current scope by
PHP code
import('tools::http', 'HeaderManager');
After that, the following static methods are available for use by the developer:
  • forward(): Forwards to the desired target url.
  • redirect(): Redirects the user to the desired url. You can descide to send permanent redirect status or not.
  • send(): This method is a generic function, that can be used to send any HTTP header (e.g. content-type, ...). For details, please have a look at http://www.faqs.org/rfcs/rfc2616.

The following code box shows a typical application example:
PHP code
import('tools::http', 'HeaderManager'); import('tools::link', 'LinkGenerator'); $link = LinkGenerator::generateUrl(Url::fromCurrent()->mergeQuery(array('param1' => '','param2' => 'new_value'))); HeaderManager::forward($link);


Do you want to add a comment to the article above, or do you want to post additional hints? So please click here. Comments already posted can be found below.
There are no comments belonging to this article.