Apache-AxKit-Plugin-AddXSLParams-Request

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    Param Prefix: request.headers.*

    Implemented Fields:

    The headers sent during a request vary somewhat from client to client;
    this group will contain *all* the headers returned by the request
    object's headers_in() method using the convention:
    request.headers.*fieldname* where *fieldname* is name of the given HTTP
    header field, forced to lower case.

    If any HTTP Cookies are found in the headers, they will be parsed and
    values available as XSLT params using the naming convention:
    request.cookies.*yourcookiename*. See the Cookies group below for an
    alternative way to access cookies.

    More common headers include:

    * accept
    * content-type
    * accept-charset
    * accept-encoding
    * accept-language
    * connection

README  view on Meta::CPAN

    * from
    * referer

    Examples:

      <xsl:param name="request.headers.accept-language"/>
      <xsl:param name="request.headers.host"/>
      <xsl:param name="request.headers.user-agent"/>
      <xsl:param name="request.headers.referer"/>

Cookies
    Provides an *alternative* way to access the HTTP Cookies header for
    those folks that want to get at the cookie data but don't want to pull
    in all of the other HTTP headers.

    Param Prefix: request.cookies.*

    Implemented Fields:

    Cookie values are made available as params using the convention:
    request.cookies.*yourcookiename*

    Examples:

      <xsl:param name="request.cookies.oreo"/>
      <xsl:param name="request.cookies.chocolate-chip"/>
      <xsl:param name="request.cookies.fortune"/>

VerboseURI
    Offers fine-grained access to the URI requested (via Apache::URI's

README  view on Meta::CPAN


    Examples:

      <xsl:param name="request.uri.path"/>
      <xsl:param name="request.uri.scheme"/>
      <xsl:param name="request.uri.port"/>

DEPENDENCIES
    * libapreq
    * Apache::Request
    * Apache::Cookie
    * Apache::URI
    * AxKit (1.5 or greater)

AUTHOR
    Kip Hampton, khampton@totalcinema.com

SEE ALSO
    AxKit, Apache::Request, libapreq, Apache::Cookie, Apache::URI

Request.pm  view on Meta::CPAN

package Apache::AxKit::Plugin::AddXSLParams::Request;

use strict;
use Apache::Constants;
use Apache::Cookie;
use Apache::Request;
use Apache::URI;
use vars qw($VERSION);
$VERSION = '1.02';


sub handler {
    my $r = shift;
    my $uri = $r->uri;
    my $cgi = Apache::Request->instance($r);
    my @allowed_groups = split /\s+/, $r->dir_config('AxAddXSLParamGroups') || ();
     
    # HTTP Headers
    if ( grep { $_ eq 'HTTPHeaders' } @allowed_groups ) {
        my $headers = $r->headers_in();
        foreach my $h ( keys( %{$headers} ) ) {
            #warn "Processing header " .  lc( $h ) . " = " . $headers->{$h} . " \n";
            if ( $h eq 'Cookie' ) {
                my $cookies = Apache::Cookie::parse( $headers->{$h} );
                foreach my $oreo ( keys( %{$cookies} ) ) {
                    $cgi->parms->set('request.cookie.' . $oreo => $cookies->{$oreo}->value ) if defined( $cookies->{$oreo}->value );

                }
            }
        
            $cgi->parms->set('request.headers.' . lc( $h ) => $headers->{$h});
        }
    }
            
    # Allow 'em to get Cookies header without all the other headers as an alternative
    elsif ( grep { $_ eq 'Cookies' } @allowed_groups ) {
        my $cookies = Apache::Cookie::parse( $r->header_in('Cookie') );
        foreach my $oreo ( keys( %{$cookies} ) ) {
            $cgi->parms->set('request.cookie.' . $oreo => $cookies->{$oreo}->value ) if defined( $cookies->{$oreo}->value );

        }
    }  
       
    # Here's the "Request-Common" group
    if ( grep { $_ eq 'Request-Common' } @allowed_groups ) {
        $cgi->parms->set('request.uri' => $r->uri );
        $cgi->parms->set('request.filename' => $r->filename);

Request.pm  view on Meta::CPAN


B<Param Prefix>: request.headers.*

B<Implemented Fields>:

The headers sent during a request vary somewhat from client to client; this
group will contain I<all> the headers returned by the request object's
headers_in() method using the convention: request.headers.I<fieldname> where
I<fieldname> is name of the given HTTP header field, forced to lower case.

If any HTTP Cookies are found in the headers, they will be parsed and values available as XSLT
params using the naming convention: request.cookies.I<yourcookiename>. See the B<Cookies> group
below for an alternative way to access cookies.

More common headers include:

=over 4

=item * accept

=item * content-type

Request.pm  view on Meta::CPAN


=back

B<Examples>:

  <xsl:param name="request.headers.accept-language"/>
  <xsl:param name="request.headers.host"/>
  <xsl:param name="request.headers.user-agent"/>
  <xsl:param name="request.headers.referer"/>

=head1 B<Cookies>

Provides an I<alternative> way to access the HTTP Cookies header for those folks
that want to get at the cookie data but don't want to pull in all of the other
HTTP headers.

B<Param Prefix>: request.cookies.*

B<Implemented Fields>:

Cookie values are made available as params using the convention: request.cookies.I<yourcookiename>

B<Examples>:

  <xsl:param name="request.cookies.oreo"/>
  <xsl:param name="request.cookies.chocolate-chip"/>
  <xsl:param name="request.cookies.fortune"/>

=head1 B<VerboseURI>

Offers fine-grained access to the URI requested (via Apache::URI's parse_uri() method.

Request.pm  view on Meta::CPAN

  <xsl:param name="request.uri.port"/>

=head1 DEPENDENCIES

=over 4

=item * libapreq

=item * Apache::Request

=item * Apache::Cookie

=item * Apache::URI

=item * AxKit (1.5 or greater)

=back

=head1 AUTHOR

Kip Hampton, khampton@totalcinema.com

=head1 SEE ALSO

AxKit, Apache::Request, libapreq, Apache::Cookie, Apache::URI

=cut



( run in 0.796 second using v1.01-cache-2.11-cpan-e9199f4ba4c )