Geo-OGC-Service

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.10, May 24, 2016
  * Fix several decode/encode bugs.
  * Fix CORS headers.
  * Separate Parameter method from Operation in Geo::OGC::Service::Common.

0.09, Dec 14, 2015
  * Decode attribute values and content into UTF-8 unless they already are in XML responses
  * Support simple references to top level keys in configuration files
  * Add CORS method in Geo::OGC::Service::Common to get CORS headers 
  * XMLWriter constructors take now header instead of just content-type

0.08, Nov 12, 2015
  * Add Geo::OGC::Service::Common class as a root class for services
  * Config file is now read and prepared in boot time

0.07, Nov 7, 2015
  * Allow more complex config variables/files to support multiple services

0.06, Nov 7, 2015(?)

lib/Geo/OGC/Service.pm  view on Meta::CPAN

is taken as a value for Access-Control-Allow-Origin. A hash may have
the following keys. (Note the missing prefix Access-Control-.)

      key                      default value
  -----------------  ----------------------------------
  Allow-Origin              
  Allow-Credentials
  Expose-Headers
  Max-Age                        60*60*24
  Allow-Methods                  GET,POST
  Allow-Headers    origin,x-requested-with,content-type

=cut

sub CORS {
    my $self = shift;
    # default CORS response headers:
    my %default = ( 
        'Allow-Origin' => '',
        'Allow-Credentials' => '',
        'Expose-Headers' => '',
        'Max-Age' => 60*60*24,
        'Allow-Methods' => 'GET,POST',
        'Allow-Headers' => 'origin,x-requested-with,content-type'
        );
    # where CORS is in the configuration
    my $config = $self->{config}{Common}{CORS} // $self->{config}{CORS};
    my @cors;
    if (ref $config eq 'HASH') {
        for my $key (keys %default) {
            my $val = $config->{$key} // $default{$key};
            push @cors, ('Access-Control-'.$key => $val);
        }
    } else {



( run in 2.445 seconds using v1.01-cache-2.11-cpan-524268b4103 )