NAME

DTA::CAB::Server::HTTP::Handler::Query - CAB HTTP Server: request handler: analyzer queries by CGI form

SYNOPSIS

 ##========================================================================
 ## PRELIMINARIES
 
 use DTA::CAB::Server::HTTP::Handler::Query;
 
 ##========================================================================
 ## Methods: API
 
 $h = $class_or_obj->new(%options);
 $bool = $h->prepare($server);
 $bool = $path->run($server, $localPath, $clientSocket, $httpRequest);
 

DESCRIPTION

DTA::CAB::Server::HTTP::Handler::Query is a request handler class for use with a DTA::CAB::Server::HTTP server which handles queries to selected server-supported analyzers submitted as CGI-style forms.

Globals

Variable: @ISA

DTA::CAB::Server::HTTP::Handler::Query inherits from DTA::CAB::Server::HTTP::Handler::CGI and implements the DTA::CAB::Server::HTTP::Handler API.

Variable: (%allowFormats);

Default allowed formats.

Methods: API

new
 $h = $class_or_obj->new(%options);

%$h, %options:

  (
   ##-- INHERITED from Handler::CGI
   #encoding => $defaultEncoding,  ##-- default encoding (UTF-8)
   allowGet => $bool,             ##-- allow GET requests? (default=1)
   allowPost => $bool,            ##-- allow POST requests? (default=1)
   pushMode => $mode,             ##-- push mode for addVars (default='keep')
   ##
   ##-- NEW in Handler::Query
   allowAnalyzers => \%analyzers, ##-- set of allowed analyzers ($allowedAnalyzerName=>$bool, ...) -- default=undef (all allowed)
   defaultAnalyzer => $aname,     ##-- default analyzer name (default = 'default')
   allowFormats => \%formats,     ##-- allowed formats: ($fmtAlias => $formatClassName, ...)
   defaultFormat => $class,       ##-- default format (default=$DTA::CAB::Format::CLASS_DEFAULT)
   forceClean => $bool,           ##-- always appends 'doAnalyzeClean'=>1 to options if true (default=false)
   returnRaw => $bool,            ##-- return all data as text/plain? (default=0)
   logVars => $level,             ##-- log-level for variable expansion (default=undef: none)
  )
prepare
 $bool = $h->prepare($server);

Sets $h->{allowAnalyzers} if not already defined.

run
 $bool = $path->run($server, $localPath, $clientSocket, $httpRequest);

Process $httpRequest matching $localPath as CGI form-encoded query. The following CGI form parameters are supported:

 (
  q    => $queryString,          ##-- raw, untokenized query string (preferred over 'qd')
  qd   => $queryData,            ##-- query data (formatted document)
  a    => $analyzerName,         ##-- analyzer key in %{$h->{allowAnalyzers}}, %{$srv->{as}}
  fmt  => $queryFormat,          ##-- query/response format (default=$h->{defaultFormat})
  #enc  => $queryEncoding,        ##-- query encoding (default='UTF-8')
  raw  => $bool,                 ##-- if true, data will be returned as text/plain (default=$h->{returnRaw})
  pretty => $level,              ##-- response format level
  ##
  $opt => $value,                ##-- other options are passed to analyzeDocument() (if $h->{allowUserOptions} is true)
 )

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2011-2019 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.

SEE ALSO

DTA::CAB::Server::HTTP::Handler::QueryList(3pm), DTA::CAB::Server::HTTP::Handler::QueryList(3pm), DTA::CAB::Server::HTTP::Handler::CGI(3pm), DTA::CAB::Server::HTTP::Handler(3pm), DTA::CAB::Server::HTTP(3pm), DTA::CAB(3pm), perl(1), ...