metaproxy  1.3.55
Classes | Public Member Functions | Private Attributes | List of all members
metaproxy_1::filter::HttpFile Class Reference

#include <filter_http_file.hpp>

Collaboration diagram for metaproxy_1::filter::HttpFile:
Collaboration graph

Classes

struct  Area
class  Mime
class  Rep

Public Member Functions

 HttpFile ()
 ~HttpFile ()
void process (metaproxy_1::Package &package) const
void configure (const xmlNode *ptr, bool test_only, const char *path)

Private Attributes

boost::scoped_ptr< Repm_p

Detailed Description

Definition at line 28 of file filter_http_file.hpp.

Constructor & Destructor Documentation

metaproxy_1::filter::HttpFile::HttpFile ( )

Referenced by filter_creator().

metaproxy_1::filter::HttpFile::~HttpFile ( )

Member Function Documentation

void metaproxy_1::filter::HttpFile::configure ( const xmlNode *  ptr,
bool  test_only,
const char *  path 
)

Definition at line 231 of file filter_http_file.cpp.

References metaproxy_1::filter::HttpFile::Area::m_file_root, m_p, and metaproxy_1::filter::HttpFile::Area::m_url_path_prefix.

{
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
if (ptr->type != XML_ELEMENT_NODE)
continue;
if (!strcmp((const char *) ptr->name, "mimetypes"))
{
std::string fname = mp::xml::get_text(ptr);
mp::PlainFile f;
if (!f.open(fname))
{
throw mp::filter::FilterException
("Can not open mime types file " + fname);
}
std::vector<std::string> args;
while (f.getline(args))
{
size_t i;
for (i = 1; i<args.size(); i++)
m_p->m_ext_to_map[args[i]] = args[0];
}
}
else if (!strcmp((const char *) ptr->name, "area"))
{
xmlNode *a_node = ptr->children;
Area a;
for (; a_node; a_node = a_node->next)
{
if (a_node->type != XML_ELEMENT_NODE)
continue;
if (mp::xml::is_element_mp(a_node, "documentroot"))
a.m_file_root = mp::xml::get_text(a_node);
else if (mp::xml::is_element_mp(a_node, "prefix"))
a.m_url_path_prefix = mp::xml::get_text(a_node);
else
throw mp::filter::FilterException
("Bad element "
+ std::string((const char *) a_node->name)
+ " in area section"
);
}
if (a.m_file_root.length())
{
m_p->m_area_list.push_back(a);
}
}
else
{
throw mp::filter::FilterException
("Bad element "
+ std::string((const char *) ptr->name)
+ " in virt_db filter");
}
}
}
void metaproxy_1::filter::HttpFile::process ( metaproxy_1::Package &  package) const

Member Data Documentation

boost::scoped_ptr<Rep> metaproxy_1::filter::HttpFile::m_p
private

Definition at line 31 of file filter_http_file.hpp.

Referenced by configure().


The documentation for this class was generated from the following files: