[Bio] / FigWebServices / sap_server.psgi Repository:
ViewVC logotype

View of /FigWebServices/sap_server.psgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (annotate)
Wed Mar 13 17:58:09 2013 UTC (6 years, 10 months ago) by olson
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
PSGI version of sap_server

#!/usr/bin/perl -w

#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
#
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License.
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#

use strict;
use ServerThing;
use SAP;
use CGI::Emulate::PSGI;

=head1 General Sapling Database Server

This script implements server access to the L</SAP> module via PSGI.

=cut

#
# The following is logic wrapped up inside ServerThing::RunServer. We extract
# it here so we can do the inside-out return a function thing for PSGI.
#
my $serverThing = SAP->new();

my $methods = $serverThing->methods();

my $raw_methods = [];
if ($serverThing->can("raw_methods"))
{
    $raw_methods = $serverThing->raw_methods();
}
# Store it in the object so we can use it to validate methods.
my %methodHash = map { $_ => 1 } @$methods;
$serverThing->{methods} = \%methodHash;
$serverThing->{raw_methods} = { map { $_ => 1 } @$raw_methods };

my $app = CGI::Emulate::PSGI->handler( sub {
    CGI::initialize_globals;
    my $cgi = new CGI;
    ServerThing::RunRequest($cgi, $serverThing);
});

return $app;

1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3