• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

RemapPlugin.h

Go to the documentation of this file.
00001 /**
00002   Licensed to the Apache Software Foundation (ASF) under one
00003   or more contributor license agreements.  See the NOTICE file
00004   distributed with this work for additional information
00005   regarding copyright ownership.  The ASF licenses this file
00006   to you under the Apache License, Version 2.0 (the
00007   "License"); you may not use this file except in compliance
00008   with the License.  You may obtain a copy of the License at
00009 
00010       http://www.apache.org/licenses/LICENSE-2.0
00011 
00012   Unless required by applicable law or agreed to in writing, software
00013   distributed under the License is distributed on an "AS IS" BASIS,
00014   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015   See the License for the specific language governing permissions and
00016   limitations under the License.
00017  */
00018 
00019 /**
00020  * @file RemapPlugin.h
00021  */
00022 
00023 #pragma once
00024 #ifndef ATSCPPAPI_REMAP_PLUGIN_H_
00025 #define ATSCPPAPI_REMAP_PLUGIN_H_
00026 
00027 #include "atscppapi/Transaction.h"
00028 #include "atscppapi/Url.h"
00029 #include "atscppapi/utils.h"
00030 
00031 namespace atscppapi {
00032 
00033 /** 
00034  * @brief Base class that remap plugins should extend.
00035  */
00036 class RemapPlugin {
00037 public:
00038   /**
00039    * Constructor
00040    * 
00041    * @param instance_handle The instance_handle argument received in TSRemapInit() should be passed here.
00042    */
00043   RemapPlugin(void **instance_handle);
00044 
00045   enum Result { RESULT_ERROR = 0, RESULT_NO_REMAP, RESULT_DID_REMAP, RESULT_NO_REMAP_STOP,
00046                 RESULT_DID_REMAP_STOP };
00047 
00048   /** 
00049    * Invoked when a request matches the remap.config line - implementation should perform the
00050    * remap. The client's URL is in the transaction and that's where it should be modified.
00051    * 
00052    * @param map_from_url The map from URL specified in the remap.config line.
00053    * @param map_to_url The map to URL specified in the remap.config line.
00054    * @param transaction Transaction
00055    * @param redirect Output argument that should be set to true if the (new) url should be used
00056    *                 as a redirect. 
00057    *
00058    * @return Result of the remap - will dictate futher processing by the system.
00059    */
00060   virtual Result doRemap(const Url &map_from_url ATSCPPAPI_UNUSED, const Url &map_to_url ATSCPPAPI_UNUSED, Transaction &transaction ATSCPPAPI_UNUSED,
00061                          bool &redirect ATSCPPAPI_UNUSED) {
00062     return RESULT_NO_REMAP;
00063   }
00064 
00065   virtual ~RemapPlugin() { }
00066 };
00067 
00068 }
00069 
00070 #endif

Generated by  doxygen 1.7.1