[Bio] / FigKernelPackages / ServerThing.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/ServerThing.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.48, Fri Apr 16 21:39:51 2010 UTC revision 1.49, Wed Apr 28 14:02:11 2010 UTC
# Line 868  Line 868 
868    
869  =item cgi  =item cgi
870    
871  CGI query object containing the parameters from the web service request.  CGI query object containing the parameters from the web service request. The
872    significant parameters are as follows.
873    
874    =over 8
875    
876    =item function
877    
878    Name of the function to run.
879    
880    =item args
881    
882    Parameters for the function.
883    
884    =item encoding
885    
886    Encoding scheme for the function parameters, either C<yaml> (the default) or C<json> (used
887    by the Java interface).
888    
889    =back
890    
891    Certain unusual requests can come in outside of the standard function interface.
892    These are indicated by special parameters that override all the others.
893    
894    =over 8
895    
896    =item pod
897    
898    Display a POD documentation module.
899    
900    =item code
901    
902    Display an example code file.
903    
904    =item file
905    
906    Transfer a file (not implemented).
907    
908    =back
909    
910  =item serverThing  =item serverThing
911    
# Line 919  Line 956 
956          my $sapling;          my $sapling;
957          # Protect from errors.          # Protect from errors.
958          eval {          eval {
959              # Parse the arguments.              # Here we parse the arguments. This is affected by the encoding parameter.
960              $args = YAML::Load($cgi->param('args'));              # The default is YAML.
961                my $encoding = $cgi->param('encoding') || 'yaml';
962                # Get the argument string.
963                my $argString = $cgi->param('args');
964                if ($encoding eq 'yaml') {
965                    # Parse the arguments using YAML.
966                    $args = YAML::Load($argString);
967                } elsif ($encoding eq 'json') {
968                    # Parse the arguments using JSON.
969                    require JSON::Any;
970                    $args = JSON::Any->jsonToObj($argString);
971                } else {
972                    Die("Invalid encoding type $encoding.");
973                }
974          };          };
975          # Check to make sure we got everything.          # Check to make sure we got everything.
976          if ($@) {          if ($@) {

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3