Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / apps / JAWS / server / HTTP_Config.cpp
blobb8670491283a83cbd48c94448ab22178dc260e4f
1 // HTTP_Config.cpp
3 #include "ace/OS_NS_stdlib.h"
4 #include "HTTP_Config.h"
6 // static HTTP_Config_Info config_info;
8 HTTP_Config_Info *HTTP_Config::instance_ = 0;
10 HTTP_Config_Info *
11 HTTP_Config::instance ()
13 if (HTTP_Config::instance_ == 0)
15 HTTP_Config::instance_ = new HTTP_Config_Info;
17 HTTP_Config::instance_->document_root (0);
18 HTTP_Config::instance_->cgi_path (0);
19 HTTP_Config::instance_->user_dir (0);
20 HTTP_Config::instance_->dir_index (0);
21 HTTP_Config::instance_->proxy_flag (0);
24 return HTTP_Config::instance_;
27 HTTP_Config_Info::HTTP_Config_Info ()
28 : document_root_ (0),
29 cgi_path_ (0),
30 user_dir_ (0),
31 dir_index_ (0),
32 proxy_flag_ (0)
36 HTTP_Config_Info::~HTTP_Config_Info ()
40 const char *
41 HTTP_Config_Info::document_root () const
43 return this->document_root_;
46 const char *
47 HTTP_Config_Info::cgi_path () const
49 return this->cgi_path_;
52 const char *
53 HTTP_Config_Info::user_dir () const
55 return this->user_dir_;
58 const char *
59 HTTP_Config_Info::dir_index () const
61 return this->dir_index_;
64 int
65 HTTP_Config_Info::proxy_flag () const
67 return this->proxy_flag_;
70 const char *
71 HTTP_Config_Info::document_root (const char *dr_string)
73 if (dr_string)
74 this->document_root_ = dr_string;
75 else
77 this->document_root_ = ACE_OS::getenv ("JAWS_DOCUMENT_ROOT");
78 if (!this->document_root_)
79 this->document_root_ = ".";
82 return this->document_root_;
85 const char *
86 HTTP_Config_Info::cgi_path (const char *cp_string)
88 if (cp_string)
89 this->cgi_path_ = cp_string;
90 else
92 this->cgi_path_ = ACE_OS::getenv ("JAWS_CGI_PATH");
94 if (!this->cgi_path_)
95 this->cgi_path_ = "cgi-bin";
98 return this->cgi_path_;
101 const char *
102 HTTP_Config_Info::user_dir (const char *ud_string)
104 if (ud_string)
105 this->user_dir_ = ud_string;
106 else
108 this->user_dir_ = ACE_OS::getenv ("JAWS_USER_DIR");
109 if (!this->user_dir_)
110 this->user_dir_ = ".www";
113 return this->user_dir_;
116 const char *
117 HTTP_Config_Info::dir_index (const char *di_string)
119 if (di_string)
120 this->dir_index_ = di_string;
121 else
123 this->dir_index_ = ACE_OS::getenv ("JAWS_DIR_INDEX");
124 if (!this->dir_index_)
125 this->dir_index_ = "index.html";
128 return this->dir_index_;
132 HTTP_Config_Info::proxy_flag (int pf)
134 this->proxy_flag_ = pf;
135 return this->proxy_flag_;