[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mapguide-commits
Subject:    [mapguide-commits] r3288 - in trunk/MgDev:
From:       svn_mapguide () osgeo ! org
Date:       2008-08-25 18:45:40
Message-ID: 20080825184540.CF337E0078F () lists ! osgeo ! org
[Download RAW message or body]

Author: trevorwekel
Date: 2008-08-25 14:45:38 -0400 (Mon, 25 Aug 2008)
New Revision: 3288

Modified:
   trunk/MgDev/Common/MapGuideCommon/Services/SiteConnection.cpp
   trunk/MgDev/Web/src/HttpHandler/HttpCreateSession.cpp
   trunk/MgDev/Web/src/HttpHandler/HttpRequestResponseHandler.cpp
   trunk/MgDev/Web/src/mapviewerjava/mainframe.jsp
   trunk/MgDev/Web/src/mapviewernet/mainframe.aspx
   trunk/MgDev/Web/src/mapviewerphp/mainframe.php
Log:
Ticket #669 WebLayout Load Balancing Fails because of API call sequence

Modified: trunk/MgDev/Common/MapGuideCommon/Services/SiteConnection.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/SiteConnection.cpp	2008-08-25 09:46:08 \
                UTC (rev 3287)
+++ trunk/MgDev/Common/MapGuideCommon/Services/SiteConnection.cpp	2008-08-25 18:45:38 \
UTC (rev 3288) @@ -491,19 +491,16 @@
     }
     else
     {
-        // TODO: The following overhead could be eliminated if additional load
-        //       balancing is implemented on the Web Tier. Also, the
-        //       RequestServer API could be optimized to allow the Web Tier to
-        //       notify the site server when a support server is down.
-        Ptr<MgUserInformation> userInformation = m_connProp->GetUserInfo();
-        assert(NULL != userInformation.p);
-        Ptr<MgSite> site = new MgSite();
+        // We have deprecated support servers.  All load balanced servers
+        // should support all services.  With this change, we do not need to
+        // contact the site server to determine where to vector service requests.
+        //
+        // A site connection has already been established if we are looking for \
services. +        // Just use the target and port from the existing connection.  \
This will +        // bind all service requests to the machine initially connected to \
in +        // the MgSiteConnection.Open call.
 
-        site->Open(userInformation, true);
-
-        STRING target = site->RequestServer(serviceType);
-
-        connProp = new MgConnectionProperties(userInformation.p, target, \
m_connProp->GetPort()); +        connProp = m_connProp;
     }
 
     return connProp.Detach();
@@ -549,15 +546,23 @@
 /// </summary>
 MgSite* MgSiteConnection::GetSite()
 {
-    // Get user information
+    Ptr<MgSite> site;
+
+    MgSiteManager* siteManager = MgSiteManager::GetInstance();
+    Ptr<MgSiteInfo> siteInfo = siteManager->GetSiteInfo(m_connProp->GetTarget(), \
m_connProp->GetPort());  Ptr<MgUserInformation> userInfo = m_connProp->GetUserInfo();
 
-    Ptr<MgSite> site;
-
     if (NULL != userInfo.p)
     {
         site = new MgSite();
-        site->Open(userInfo);
+        if (NULL != siteInfo.p)
+        {
+            site->Open(userInfo, siteInfo);
+        }
+        else
+        {
+            site->Open(userInfo);
+        }
     }
     else
     {

Modified: trunk/MgDev/Web/src/HttpHandler/HttpCreateSession.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpCreateSession.cpp	2008-08-25 09:46:08 UTC \
                (rev 3287)
+++ trunk/MgDev/Web/src/HttpHandler/HttpCreateSession.cpp	2008-08-25 18:45:38 UTC \
(rev 3288) @@ -53,10 +53,8 @@
     // Check common parameters
     ValidateCommonParameters();
 
-    // Open connection to Mg server
-    Ptr<MgSite> mgSite;
-    mgSite = new MgSite();
-    mgSite->Open(m_userInfo);
+    // Get the site
+    Ptr<MgSite> mgSite = m_siteConn->GetSite();
 
     // Run API command
     STRING ret = mgSite->CreateSession();

Modified: trunk/MgDev/Web/src/HttpHandler/HttpRequestResponseHandler.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpRequestResponseHandler.cpp	2008-08-25 \
                09:46:08 UTC (rev 3287)
+++ trunk/MgDev/Web/src/HttpHandler/HttpRequestResponseHandler.cpp	2008-08-25 \
18:45:38 UTC (rev 3288) @@ -177,6 +177,17 @@
         m_userInfo->SetClientIp(clientIp);
     }
 
+    // Short circuit the authentication check if no username or session is supplied.
+    // This will ensure that load balancing works correctly if browsers send an
+    // unauthenticated then an authenticated request.
+    //
+    // The check increments the load balanced servers so the unauthenticated HTTP \
request +    // will eat up one of the servers and give uneven load balancing.
+    if (m_userInfo->GetUserName().empty() && m_userInfo->GetMgSessionId().empty())
+    {
+        throw new MgAuthenticationFailedException(L"MgHttpRequestResponseHandler.InitializeCommonParameters", \
__LINE__, __WFILE__, NULL, L"", NULL); +    }
+
     // And create the site connection
     m_siteConn = new MgSiteConnection();
     m_siteConn->Open(m_userInfo);

Modified: trunk/MgDev/Web/src/mapviewerjava/mainframe.jsp
===================================================================
--- trunk/MgDev/Web/src/mapviewerjava/mainframe.jsp	2008-08-25 09:46:08 UTC (rev \
                3287)
+++ trunk/MgDev/Web/src/mapviewerjava/mainframe.jsp	2008-08-25 18:45:38 UTC (rev \
3288) @@ -77,8 +77,7 @@
 
     if(createSession)
     {
-        MgSite site1 = new MgSite();
-        site1.Open(cred);
+        MgSite site1 = site.GetSite();
         sessionId = site1.CreateSession();
         if(forDwf == 0)
         {

Modified: trunk/MgDev/Web/src/mapviewernet/mainframe.aspx
===================================================================
--- trunk/MgDev/Web/src/mapviewernet/mainframe.aspx	2008-08-25 09:46:08 UTC (rev \
                3287)
+++ trunk/MgDev/Web/src/mapviewernet/mainframe.aspx	2008-08-25 18:45:38 UTC (rev \
3288) @@ -78,8 +78,7 @@
 
         if (createSession)
         {
-            MgSite site1 = new MgSite();
-            site1.Open(cred);
+            MgSite site1 = site.GetSite();
             sessionId = site1.CreateSession();
             if (forDwf == 0)
             {

Modified: trunk/MgDev/Web/src/mapviewerphp/mainframe.php
===================================================================
--- trunk/MgDev/Web/src/mapviewerphp/mainframe.php	2008-08-25 09:46:08 UTC (rev 3287)
+++ trunk/MgDev/Web/src/mapviewerphp/mainframe.php	2008-08-25 18:45:38 UTC (rev 3288)
@@ -77,8 +77,7 @@
 
         if($createSession)
         {
-            $site1 = new MgSite();
-            $site1->Open($cred);
+            $site1 = $site->GetSite();
             $sessionId = $site1->CreateSession();
             if($forDwf == false)
                 $orgSessionId = $sessionId;

_______________________________________________
mapguide-commits mailing list
mapguide-commits@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic