Originally gui topology app use /.* to for static file path, however,
it may cause other wsgi applications failed.

for example, if we access /v1.0/topology/switches, it use static
handler to get “switch" file from /v1.0/topology/

-- 
Yi Tseng (a.k.a Takeshi)
Taiwan National Chiao Tung University
Department of Computer Science
W2CNLab

http://blog.takeshi.tw
From 9387a4688835ae9bf02423eef5046aecf2580207 Mon Sep 17 00:00:00 2001
From: Takeshi <[email protected]>
Date: Mon, 24 Aug 2015 10:26:53 +0800
Subject: [PATCH] Change gui_topology default url path
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Originally gui topology app use /.* to for static file path, however,
it may cause other wsgi applications failed.

for example, if we access /v1.0/topology/switches, it use static
handler to get “switch" file from /v1.0/topology/

Signed-off-by: Takeshi <[email protected]>
---
 ryu/app/gui_topology/gui_topology.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ryu/app/gui_topology/gui_topology.py b/ryu/app/gui_topology/gui_topology.py
index ed4857a..4892e26 100644
--- a/ryu/app/gui_topology/gui_topology.py
+++ b/ryu/app/gui_topology/gui_topology.py
@@ -29,6 +29,7 @@ $ PYTHONPATH=. ./bin/ryu run \
 import os

 from webob.static import DirectoryApp
+from webob import Response

 from ryu.app.wsgi import ControllerBase, WSGIApplication, route
 from ryu.base import app_manager
@@ -56,7 +57,15 @@ class GUIServerController(ControllerBase):
         path = "%s/html/" % PATH
         self.static_app = DirectoryApp(path)

-    @route('topology', '/{filename:.*}')
+    @route('topology', '/')
+    def root_handler(self, req, **kwargs):
+        res = Response()
+        res.status = 303  # use http 303 "See Other" status code to redirect
+        res.location = '/ui/index.html'
+
+        return res
+
+    @route('topology', '/ui/{filename:.*}')
     def static_handler(self, req, **kwargs):
         if kwargs['filename']:
             req.path_info = kwargs['filename']
--
2.3.2 (Apple Git-55)
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to