With symfony 1.x you can easily get access to ALL request headers in your
controller actions. Using this, you can also alter the response headers as
well as the content you respond with by reading what the request header is.
If you wish to do this across an entire application you can also pre or post
filters to help manage it easier.

With Symfony 2 I am not sure as I have not yet spent enough time learning
the newer version, primarily because our deployment servers cannot install a
PHP version higher than 5.1 right now.

On Thu, Mar 31, 2011 at 8:07 AM, Tobias <webmas...@tubo-world.de> wrote:

> Hey, that's also what I need. I made it work in sf1.4 but it was only
> hacked together. As far as I see such functionally is also not
> prebuilt in sf2.
> Thats a pity because its a regular use case.
> I imagine a custom route which supports to specify all available
> formats and then returns the most appropriate according to "Accept"
> header.
> It should also include the "Content-Location" header in the response
> and allow generic URI which have the "Vary" response header.
> Example:
>
> article_show:
>  class: ContentNegotiationRoute
>  pattern:  /articles/{year}/{title}.{_format}
>  defaults  { _controller: AcmeDemo:Article:show, _format: html }
>  requirements:
>      _format:  html|rss|json
>      year:     \d+
>
> So "/articles/2011/title" would return 200 with Content-Location "/
> articles/2011/title.html" and Vary: Accept
> And the format requirement can be used to specify all available
> formats for this route.
> And the URL-generator needs to return the generic URI when no format
> specified.
>
>
> On 29 Mrz., 02:01, raviu <ravi.undupit...@gmail.com> wrote:
> > Hi,
> >
> > I'm embarking on a project where I require one URL to provide multiple
> > formats of a document. The document should be served depending on the
> > "Accept" field of the HTTP header. HTML or RDF. I know this can be
> > done using apache mod_rewrite.
> >
> > Just want to know if this functionality is supported by Symfony and if
> > so is it as simple as updating a htaccess file?
> >
> > Thanks,
> > Ravi
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to