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

#include <filter_http_rewrite1.hpp>

Inheritance diagram for metaproxy_1::filter::HttpRewrite1:
Inheritance graph
Collaboration diagram for metaproxy_1::filter::HttpRewrite1:
Collaboration graph

Classes

class  Rep
 
class  Rule
 

Public Member Functions

 HttpRewrite1 ()
 
 ~HttpRewrite1 ()
 
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_rewrite1.hpp.

Constructor & Destructor Documentation

metaproxy_1::filter::HttpRewrite1::HttpRewrite1 ( )
metaproxy_1::filter::HttpRewrite1::~HttpRewrite1 ( )

Member Function Documentation

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

Definition at line 120 of file filter_http_rewrite1.cpp.

References metaproxy_1::filter::HttpRewrite1::Rule::content_type, m_p, metaproxy_1::filter::HttpRewrite1::Rule::mode, metaproxy_1::filter::HttpRewrite1::Rule::pattern, and metaproxy_1::filter::HttpRewrite1::Rule::replacement.

122 {
123  for (ptr = ptr->children; ptr; ptr = ptr->next)
124  {
125  if (ptr->type != XML_ELEMENT_NODE)
126  continue;
127  else if (!strcmp((const char *) ptr->name, "replace"))
128  {
129  HttpRewrite1::Rule rule;
130 
131  const struct _xmlAttr *attr;
132  for (attr = ptr->properties; attr; attr = attr->next)
133  {
134  if (!strcmp((const char *) attr->name, "pattern"))
135  rule.pattern = mp::xml::get_text(attr->children);
136  else if (!strcmp((const char *) attr->name, "replacement"))
137  rule.replacement = mp::xml::get_text(attr->children);
138  else if (!strcmp((const char *) attr->name, "mode"))
139  rule.mode = mp::xml::get_text(attr->children);
140  else if (!strcmp((const char *) attr->name, "content-type"))
141  rule.content_type = mp::xml::get_text(attr->children);
142  else
143  throw mp::filter::FilterException
144  ("Bad attribute "
145  + std::string((const char *) attr->name)
146  + " in replace section of http_rewrite1");
147  }
148  if (rule.pattern.length() > 0)
149  m_p->rules.push_back(rule);
150  }
151  else
152  {
153  throw mp::filter::FilterException
154  ("Bad element "
155  + std::string((const char *) ptr->name)
156  + " in http_rewrite1 filter");
157  }
158  }
159 }
void metaproxy_1::filter::HttpRewrite1::process ( metaproxy_1::Package &  package) const

Member Data Documentation

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

Definition at line 30 of file filter_http_rewrite1.hpp.

Referenced by configure().


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