Ver código fonte

HPCC-10583 Custom root page should use httpContentFromFile

This will use common routine for setting cache headers, Content-Type,
etc.

Signed-off-by: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>
Anthony Fishbeck 11 anos atrás
pai
commit
7917905e5c

+ 12 - 0
esp/bindings/http/platform/httpservice.cpp

@@ -546,6 +546,18 @@ int CEspHttpServer::onGetApplicationFrame(CHttpRequest* request, CHttpResponse*
     }
     else
     {
+        CEspBindingEntry* entry = m_apport->getDefaultBinding();
+        if(entry)
+        {
+            EspHttpBinding *httpbind = dynamic_cast<EspHttpBinding *>(entry->queryBinding());
+            if(httpbind)
+            {
+                const char *page = httpbind->getRootPage(ctx);
+                if(page && *page)
+                    return onGetFile(request, response, page);
+            }
+        }
+
         StringBuffer html;
         m_apport->getAppFrameHtml(modtime, inner, html, ctx);
         response->setContent(html.length(), html.str());

+ 0 - 16
esp/platform/espprotocol.cpp

@@ -90,24 +90,8 @@ void CEspApplicationPort::appendBinding(CEspBindingEntry* entry, bool isdefault)
     }
 }
 
-
 const StringBuffer &CEspApplicationPort::getAppFrameHtml(time_t &modified, const char *inner, StringBuffer &html, IEspContext* ctx)
 {
-    CEspBindingEntry* bindingentry = getDefaultBinding();
-    if(bindingentry)
-    {
-        EspHttpBinding *httpbind = dynamic_cast<EspHttpBinding *>(bindingentry->queryBinding());
-        if(httpbind)
-        {
-            const char* rootpage = httpbind->getRootPage(ctx);
-            if(rootpage && *rootpage)
-            {
-                html.loadFile(StringBuffer(getCFD()).append(rootpage).str());
-                return html;
-            }
-        }
-    }
-
     if (!xslp)
        throw MakeStringException(0,"Error - CEspApplicationPort XSLT processor not initialized");
 

+ 1 - 1
esp/services/WsDeploy/WsDeployBinding.cpp

@@ -59,7 +59,7 @@ public:
 
     virtual const char* getRootPage(IEspContext* ctx)
     {
-        return "files/configmgr.html";
+        return "configmgr.html";
     }
 
 

+ 1 - 1
esp/services/ws_ecl/ws_ecl_service.hpp

@@ -140,7 +140,7 @@ public:
     void addQueryNavLink(IPropertyTree &data, IPropertyTree *query, const char *setname, const char *qname=NULL);
     void getQueryNames(IPropertyTree* settree, const char *id, const char *qname, StringArray& qnames);
 
-    virtual const char* getRootPage(IEspContext* ctx) {return "files/esp_app_tree.html";}
+    virtual const char* getRootPage(IEspContext* ctx) {return "esp_app_tree.html";}
 
     int onGet(CHttpRequest* request, CHttpResponse* response);
     void xsltTransform(const char* xml, unsigned int len, const char* xslFileName, IProperties *params, StringBuffer& ret);

+ 1 - 1
esp/services/ws_smc/ws_smcService.hpp

@@ -175,7 +175,7 @@ public:
     {
         if (ctx->queryRequestParameters()->hasProp("legacy"))
             return NULL;
-        return "files/stub.htm";
+        return "stub.htm";
     }
     virtual int onGetRoot(IEspContext &context, CHttpRequest* request,  CHttpResponse* response)
     {