![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /********************************************************************* 00002 ** Copyright (c) 2005 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: wwwDocRoot.h,v $ $Revision: 1.6 $ $State: Exp $ 00007 *******************************************************************************/ 00008 #ifndef DtWwwDocRoot_H_ 00009 #define DtWwwDocRoot_H_ 00010 00011 #include <rtiMsConfig.h> 00012 #include "ehsHttpConnMgr.h" 00013 #include <lrcConsoleLogXmlBlock.h> 00014 #include <vlutil/vlString.h> 00015 #include <vlutil/vlSmartPointers.h> 00016 #include <basicEhsDoc.h> 00017 #include <memory> 00018 #include <list> 00019 00020 class DtRtiExec; 00021 class DtAboutHTML; 00022 class DtServerConnectionListXML; 00023 class DtWwwDocSubDir; 00024 class HttpRequest; 00025 class HttpResponse; 00026 00027 00028 // DtWwwDocRoot is the base EHS server page. All requests for .htm, .js, .css, etc. 00029 // are handled directly by the DtWwwDocRoot. The Xml response pages are added as 00030 // sub-pages as new RTI components connect to the Www Server. 00031 class DT_DLL_WWWEHS DtWwwDocRoot : public DtBasicEhsDoc 00032 { 00033 public: 00034 00035 // Datastructure to hold the directory structure that can be legally served 00036 struct Directory { 00037 typedef std::map< DtString, Directory > DirectoriesByName; 00038 DirectoriesByName subdirs; 00039 }; 00040 00041 private: 00042 // No default constructor (needs parent) 00043 DtWwwDocRoot(); 00044 // Copy Constructor not implimented : Copy not allowed 00045 DtWwwDocRoot(const DtWwwDocRoot&); 00046 // Copy Constructor not implimented : Copy not allowed 00047 DtWwwDocRoot& operator=(const DtWwwDocRoot&); 00048 00049 public: 00050 00051 DtWwwDocRoot(DtEhsHttpConnectionMgr& parent); 00052 virtual ~DtWwwDocRoot(); 00053 00054 // Add a new page to the document tree 00055 virtual void addPage( const DtWebSpyUtils::ConnectionIdentifier& connInfo ); 00056 00057 // Update a specific page's state cache 00058 virtual void updatePage( const DtWebSpyUtils::ConnectionIdentifier& connInfo, 00059 std::auto_ptr< DtWebSpyUtils::ConnectionState > connState, bool appendToExisting ); 00060 00061 // Update a specific page's event log 00062 virtual void appendConnectionLogEvent( const DtWebSpyUtils::ConnectionIdentifier& connInfo, 00063 unsigned long componentId, DtLrcConsoleLogXmlBlockSP logSegmentSP ); 00064 00065 00066 // Remove a page from the document tree 00067 virtual void removePage( const DtWebSpyUtils::ConnectionIdentifier& connInfo, const DtString& dropNotificationMsg ); 00068 00069 public: 00070 00071 static const DtString& uninitializedPageHTML(); 00072 00073 protected: 00074 00075 // Serve requests for this page 00076 virtual ResponseCode HandleNonFileRequest( HttpRequest * ipoHttpRequest, 00077 HttpResponse * ipoHttpResponse ); 00078 00079 // Set the About box data creates the /about/ page 00080 virtual void setupAboutPage(); 00081 00082 // Create/update the Web Spy Front page (with connection list) 00083 virtual void setupFrontPage(); 00084 00085 // Prepare response page for direct component connect requests 00086 virtual void setupDirectRequestPage(); 00087 00088 00089 // Setup the Document Tree directory structure for file service (ie - add the directory 00090 // for javascript files, css files, etc.) 00091 virtual void setupDocumentTree(); 00092 00093 // Add the list of directory names to be offered as sub-directories from doc-root 00094 // Only ( and ALL ) files in these directories are available for service 00095 virtual void initDirectoryTree(); 00096 00097 // Does the specified page exist? 00098 virtual bool exists( const DtWebSpyUtils::ConnectionIdentifier& connInfo ) const; 00099 00100 // Get the requested component from direct connect requests 00101 // Returns the user's specified connection ID (all parameter value parsing is 00102 // handled at the client side) 00103 // Returns a null string if this is not a direct connect request 00104 DtString parseDirectConnectionRequest( HttpRequest * ipoHttpRequest ); 00105 00106 protected: 00107 00108 typedef std::map< DtWebSpyUtils::ConnectionIdentifier, DtBasicEhsDocSP > ConnInfoToPageMap; 00109 00110 ConnInfoToPageMap mySubPages; 00111 DtEhsHttpConnectionMgr& myParent; 00112 00113 DtAboutHTML* myAboutPage; 00114 DtServerConnectionListXML* myConnectionListPage; 00115 std::list< DtWwwDocSubDir* > mySubdirectories; 00116 00117 // When a direct connect is requested, we must build the response page 00118 // from its component parts (header + dynamic content + trailer) 00119 DtString myHeader; 00120 DtString myTrailer; 00121 00122 // Tree of Directory names to be served (rooted at rootDir) 00123 // For security, only add directories which are absolutely required - and only put required 00124 // files into those directories 00125 // NOTE: for testing purposes, add directories only in DEBUG mode 00126 Directory myDirectoryTree; 00127 }; 00128 00129 #endif // DtWwwDocRoot_H_ 00130