OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESXMLWWWGetCommand.cc
Go to the documentation of this file.
1 // BESXMLWWWGetCommand.cc
2 
3 // This file is part of bes, A C++ back-end server implementation framework
4 // for the OPeNDAP Data Access Protocol.
5 
6 // Copyright (c) 2004,2005 University Corporation for Atmospheric Research
7 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 //
23 // You can contact University Corporation for Atmospheric Research at
24 // 3080 Center Green Drive, Boulder, CO 80301
25 
26 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
28 //
29 // Authors:
30 // pwest Patrick West <pwest@ucar.edu>
31 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
33 #include "BESXMLWWWGetCommand.h"
35 #include "BESDefinitionStorage.h"
36 #include "BESDefine.h"
37 #include "BESDataNames.h"
38 #include "BESWWWNames.h"
39 #include "BESResponseNames.h"
40 #include "BESXMLUtils.h"
41 #include "BESUtil.h"
42 #include "BESSyntaxUserError.h"
43 #include "BESDebug.h"
44 
46  : BESXMLGetCommand( base_dhi )
47 {
48 }
49 
56 void
58 {
59  string name ;
60  string value ;
61  map<string, string> props ;
62  BESXMLUtils::GetNodeInfo( node, name, value, props ) ;
63 
64  if( name != GET_RESPONSE )
65  {
66  string err = "The specified command " + name
67  + " is not a get command" ;
68  throw BESSyntaxUserError( err, __FILE__, __LINE__ ) ;
69  }
70 
71  string type = props["type"] ;
72  if( type.empty() || type != "html_form" )
73  {
74  string err = name + " command: data product must be html_form" ;
75  throw BESSyntaxUserError( err, __FILE__, __LINE__ ) ;
76  }
77 
78  parse_basic_get( node, name, type, value, props ) ;
79 
80  _dhi.data[WWW_URL] = props["url"] ;
81  if( _dhi.data[WWW_URL].empty() )
82  {
83  string err = name + " html_form command: missing url property" ;
84  throw BESSyntaxUserError( err, __FILE__, __LINE__ ) ;
85  }
86  _str_cmd += " using " + _dhi.data[WWW_URL] ;
87 
88  // now that we've set the action, go get the response handler for the
89  // action
91 }
92 
99 void
100 BESXMLWWWGetCommand::dump( ostream &strm ) const
101 {
102  strm << BESIndent::LMarg << "BESXMLWWWGetCommand::dump - ("
103  << (void *)this << ")" << endl ;
105  BESXMLCommand::dump( strm ) ;
107 }
108 
111 {
112  return new BESXMLWWWGetCommand( base_dhi ) ;
113 }
114 
BESXMLWWWGetCommand(const BESDataHandlerInterface &base_dhi)
static void GetNodeInfo(xmlNode *node, string &name, string &value, map< string, string > &props)
get the name, value if any, and any properties for the specified node
Definition: BESXMLUtils.cc:105
BESDataHandlerInterface _dhi
Definition: BESXMLCommand.h:57
static void Indent()
Definition: BESIndent.cc:38
error thrown if there is a user syntax error in the request or any other user error ...
virtual void set_response()
The request has been parsed, use the command action name to set the response handler.
virtual void parse_request(xmlNode *node)
parse a get html_form command.
virtual void parse_basic_get(xmlNode *node, const string &name, const string &type, const string &value, map< string, string > &props)
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
#define GET_RESPONSE
virtual void dump(ostream &strm) const
dumps information about this object
Structure storing information used by the BES to handle the request.
map< string, string > data
the map of string data that will be required for the current request.
static void UnIndent()
Definition: BESIndent.cc:44
#define WWW_URL
Definition: BESWWWNames.h:49
static BESXMLCommand * CommandBuilder(const BESDataHandlerInterface &base_dhi)
virtual void dump(ostream &strm) const
dumps information about this object