BioMart::Configuration URLLocation
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
BioMart::Configuration::URLLocation
Package variables
No package variables defined.
Included modules
LWP::UserAgent
Log::Log4perl
Inherit
BioMart::Configuration::Location
Synopsis
A Location that represents the configuration for a mart database accessed
via a mart server
Description
Methods
_newDescriptionCode
getResultSet
No description
Code
Methods description
_newcode    nextTop
  Usage      : see Usage for BioMart::Configuration::Location.
Description: creates a new MartURLLocation object which ...
Returntype : BioMart::Configuration::MartURLLocation
Exceptions : none
Caller : general
Methods code
_newdescriptionprevnextTop
sub _new {
  my ($self, @param) = @_;
  $self->SUPER::_new(@param);
 
  $self->dsn("http://".$self->host.":".$self->port.$self->path."?");
}
getResultSetdescriptionprevnextTop
sub getResultSet {
    my ($self, $qualifier,$type,$xml)=@_;
    
    if (!defined $xml){$xml=""}  # no uninitilized warning
my $logger=Log::Log4perl->get_logger(__PACKAGE__); my $request; if ($type eq "POST"){ $logger->warn("POST: ", $self->dsn," query=$xml"); $request = HTTP::Request->new($type,$self->dsn, HTTP::Headers->new(),'query='.$xml."\n"); } elsif ($type eq "GET") { $qualifier=$qualifier."&requestid=biomart-client"; $logger->warn("GET: ", $self->dsn," $qualifier"); $request = HTTP::Request->new($type,$self->dsn.$qualifier); } else { BioMart::Exception::Query->throw("need a valid request type: GET or POST"); } my $ua = LWP::UserAgent->new; $ua->timeout(20); # default is 180 seconds
$ua->proxy( ['http', 'https'], $self->proxy ) if defined $self->proxy; my $response = $ua->request($request); my @results; if ($response->is_success) { my @arr=split(/\n/,$response->as_string); foreach my $el(@arr){ if ($el =~ /^Keep-Alive/) {next;} if ($el =~ /^Vary/) {next;} if ($el =~ /^Client/) {next;} if ($el eq '') {next;} if ($el =~/^HTTP/) { next;} if ($el =~/^Date/) { next;} if ($el =~/^Server/) {next;} if ($el =~/^Connection/) {next;} if ($el =~/^Content/) {next;} if ($el =~/^Proxy/) {next;} if ($el =~/^X-Cache/) {next;} if ($el =~/^Via/) {next;} if ($el =~/^X-Pad/) {next;} $logger->warn("RESPONSE: $el"); push (@results,$el); } } else { warn ("\n\nProblems with the web server: ". $response->status_line."\n\n"); } return @results; } 1;
}
General documentation
AUTHOR - Arek Kasprzyk, Damian SmedleyTop
CONTACTTop
This module is part of the BioMart project http://www.biomart.org
Questions can be posted to the mart-dev mailing list: mart-dev@ebi.ac.uk