bes  Updated for version 3.20.6
BESWWWRequestHandler.cc
1 // BESWWWRequestHandler.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 
34 #include "BESWWWRequestHandler.h"
35 #include "BESResponseHandler.h"
36 #include "BESResponseNames.h"
37 #include "BESVersionInfo.h"
38 #include "BESDataNames.h"
39 #include "config.h"
40 
41 using std::endl;
42 using std::ostream;
43 using std::string;
44 
45 BESWWWRequestHandler::BESWWWRequestHandler( const string &name )
46  : BESRequestHandler( name )
47 {
48  add_method( HELP_RESPONSE, BESWWWRequestHandler::dap_build_help ) ;
49  add_method( VERS_RESPONSE, BESWWWRequestHandler::dap_build_version ) ;
50 }
51 
52 BESWWWRequestHandler::~BESWWWRequestHandler()
53 {
54 }
55 
56 bool
57 BESWWWRequestHandler::dap_build_help( BESDataHandlerInterface & )
58 {
59  // the usage request handler provides help for this handler.
60  // A vestige of teh server 3 design. jhrg 1/29/17
61 
62  return true ;
63 }
64 
65 bool
66 BESWWWRequestHandler::dap_build_version( BESDataHandlerInterface &dhi )
67 {
68  BESResponseObject *response = dhi.response_handler->get_response_object() ;
69  BESVersionInfo *info = dynamic_cast < BESVersionInfo * >(response) ;
70  if( !info )
71  throw BESInternalError( "cast error", __FILE__, __LINE__ ) ;
72 
73  info->add_module( MODULE_NAME, MODULE_VERSION ) ;
74 
75  return true ;
76 }
77 
84 void
85 BESWWWRequestHandler::dump( ostream &strm ) const
86 {
87  strm << BESIndent::LMarg << "BESWWWRequestHandler::dump - ("
88  << (void *)this << ")" << endl ;
89  BESIndent::Indent() ;
90  BESRequestHandler::dump( strm ) ;
91  BESIndent::UnIndent() ;
92 }
93 
BESRequestHandler
Represents a specific data type request handler.
Definition: BESRequestHandler.h:74
BESResponseHandler::get_response_object
virtual BESResponseObject * get_response_object()
return the current response object
Definition: BESResponseHandler.cc:82
BESVersionInfo
Definition: BESVersionInfo.h:47
BESInternalError
exception thrown if internal error encountered
Definition: BESInternalError.h:43
BESWWWRequestHandler::dump
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: BESWWWRequestHandler.cc:85
BESRequestHandler::dump
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: BESRequestHandler.cc:163
BESDataHandlerInterface
Structure storing information used by the BES to handle the request.
Definition: BESDataHandlerInterface.h:56
BESResponseObject
Abstract base class representing a specific set of information in response to a request to the BES.
Definition: BESResponseObject.h:45