OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
BESDapResponse.cc
Go to the documentation of this file.
1
// BESDapResponse.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-2009 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 "
BESDapResponse.h
"
34
#include "
BESContextManager.h
"
35
#include "
BESConstraintFuncs.h
"
36
#include "
BESDataNames.h
"
37
#include "
BESError.h
"
38
55
void
56
BESDapResponse::read_contexts
()
57
{
58
bool
found =
false
;
59
60
// d_explicit_containers is false by default
61
string
context =
BESContextManager::TheManager
()->
get_context
(
"dap_explicit_containers"
, found);
62
if
(found) {
63
if
(context ==
"yes"
)
64
d_explicit_containers =
true
;
65
else
if
(context ==
"no"
)
66
d_explicit_containers =
false
;
67
else
68
throw
BESError
(
"dap_explicit_containers must be yes or no"
,
69
BES_SYNTAX_USER_ERROR
, __FILE__, __LINE__);
70
}
71
72
if
(!found) {
73
context =
BESContextManager::TheManager
()->
get_context
(
"dap_format"
, found);
74
if
(found) {
75
if
(context ==
"dap2"
)
76
d_explicit_containers =
false
;
77
else
78
d_explicit_containers =
true
;
79
}
80
}
81
82
context =
BESContextManager::TheManager
()->
get_context
(
"xdap_accept"
, found);
83
if
(found)
84
d_dap_client_protocol = context;
85
86
context =
BESContextManager::TheManager
()->
get_context
(
"xml:base"
, found);
87
if
(found)
88
d_request_xml_base = context;
89
90
}
91
99
bool
BESDapResponse::is_dap2
()
100
{
101
return
!d_explicit_containers;
102
#if 0
103
bool
found =
false
;
104
string
context =
BESContextManager::TheManager
()->
get_context
(
105
"dap_format"
, found);
106
if
(found && (context ==
"dap2"
|| context ==
"2.0"
)) {
107
return
true
;
108
}
109
return
false
;
110
#endif
111
}
112
123
void
124
BESDapResponse::set_constraint
(
BESDataHandlerInterface
&dhi )
125
{
126
if
( dhi.
container
)
127
{
128
if
(
is_dap2
() )
129
{
130
dhi.
data
[
POST_CONSTRAINT
] = dhi.
container
->
get_constraint
() ;
131
}
132
else
133
{
134
BESConstraintFuncs::post_append
( dhi ) ;
135
}
136
}
137
}
138
146
void
147
BESDapResponse::dump
( ostream &strm )
const
148
{
149
strm <<
BESIndent::LMarg
<<
"BESDapResponse::dump - ("
150
<< (
void
*)
this
<<
")"
<< endl ;
151
BESIndent::Indent
();
152
strm <<
BESIndent::LMarg
<<
"d_explicit_containers: "
<< d_explicit_containers << endl;
153
strm <<
BESIndent::LMarg
<<
"d_dap_client_protocol: "
<< d_dap_client_protocol << endl;
154
BESIndent::UnIndent
();
155
156
BESIndent::UnIndent
();
157
}
158
dispatch
BESDapResponse.cc
Generated by
1.8.4