bes  Updated for version 3.20.8
url_impl.h
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of the BES http package, part of the Hyrax data server.
5 
6 // Copyright (c) 2020 OPeNDAP, Inc.
7 // Author: Nathan Potter <ndp@opendap.org>
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 OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24 
25 // Authors:
26 // ndp Nathan Potter <ndp@opendap.org>
27 
28 #ifndef _bes_http_url_HH_
29 #define _bes_http_url_HH_ 1
30 #include <string>
31 #include <map>
32 #include <vector>
33 #include <time.h>
34 
35 
36 namespace http {
37 
38 
39 
40 class url {
41 private:
42 
43  std::string d_source_url;
44  std::string d_protocol;
45  std::string d_host;
46  std::string d_path;
47  std::string d_query;
48  std::map<std::string, std::vector<std::string> * > d_query_kvp;
49  time_t d_ingest_time;
50 
51 protected:
52 
53 public:
54 
55  void parse(const std::string &source_url);
56 
57  explicit url():d_source_url(""), d_ingest_time(0) {
58  }
59 
60 
61  // omitted copy, ==, accessors, ...
62  explicit url(const std::string &url_s):d_source_url(url_s), d_ingest_time(0) {
63  parse(url_s);
64  }
65 
66  ~url();
67  virtual std::string str() const { return d_source_url; }
68 
69  virtual std::string protocol() const { return d_protocol; }
70 
71  virtual std::string host() const { return d_host; }
72 
73  virtual std::string path() const { return d_path; }
74 
75  virtual std::string query() const { return d_query; }
76 
77  virtual time_t ingest_time() const { return d_ingest_time; }
78 
79  virtual void set_ingest_time(const time_t itime){
80  d_ingest_time = itime;
81  }
82 
83  virtual std::string query_parameter_value(const std::string &key) const;
84  virtual void query_parameter_values(const std::string &key, std::vector<std::string> &values) const;
85 
86  virtual bool is_expired();
87 
88  virtual std::string dump();
89 
90 };
91 
92 } // namespace http
93 #endif /* _bes_http_url_HH_ */
void parse(const std::string &source_url)
Definition: url_impl.cc:145
virtual void query_parameter_values(const std::string &key, std::vector< std::string > &values) const
Definition: url_impl.cc:220
virtual std::string query_parameter_value(const std::string &key) const
Definition: url_impl.cc:201
virtual std::string dump()
Definition: url_impl.cc:335
virtual bool is_expired()
Definition: url_impl.cc:261
utility class for the HTTP catalog module
Definition: EffectiveUrl.cc:58