diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
index 4206b6d..dec0c08 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
@@ -78,12 +78,6 @@
      */
     protected void renderContent( HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
-        String query = request.getQueryString();
-        if ( query == null || query.length() == 0 )
-        {
-            response.sendRedirect( LABEL + "?list=a" );
-            return;
-        }
         // prepare variables
         DefaultVariableResolver vars = ( ( DefaultVariableResolver ) WebConsoleUtil.getVariableResolver( request ) );
         vars.put( "__data__", getData( request ) );
@@ -166,14 +160,13 @@
         AbstractBundleRepositoryRenderHelper helper = getHelper();
         if ( helper == null || !helper.hasRepositoryAdmin() )
         {
-            return "";
+            return "{}";
         }
 
-        boolean details = request.getParameter( "details" ) != null;
+        RequestInfo info = new RequestInfo( request );
 
         final String filter;
-        String list = WebConsoleUtil.urlDecode( request.getParameter( "list" ) );
-        String query = WebConsoleUtil.urlDecode( request.getParameter( "query" ) );
+        String list = info.getList();
         if ( list != null )
         {
             if ( "-".equals( list ) )
@@ -193,39 +186,46 @@
                     + "*))";
             }
         }
-        else if ( query != null )
+        else
         {
-            if ( query.indexOf( '=' ) > 0 )
+            String query = info.getQuery();
+            if ( query != null )
             {
-                if (query.startsWith( "(" )) {
-                    filter = query;
-                } else {
-                    filter = "(" + query + ")";
+                if ( query.indexOf( '=' ) > 0 )
+                {
+                    if ( query.startsWith( "(" ) )
+                    {
+                        filter = query;
+                    }
+                    else
+                    {
+                        filter = "(" + query + ")";
+                    }
+                }
+                else
+                {
+                    filter = "(|(presentationame=*" + query + "*)(symbolicname=*" + query + "*))";
                 }
             }
             else
             {
-                filter = "(|(presentationame=*" + query + "*)(symbolicname=*" + query + "*))";
-            }
-        }
-        else
-        {
-            StringBuffer sb = new StringBuffer( "(&" );
-            for ( Enumeration e = request.getParameterNames(); e.hasMoreElements(); )
-            {
-                String k = ( String ) e.nextElement();
-                String v = request.getParameter( k );
-                if ( v != null && v.length() > 0 && !"details".equals( k ) && !"deploy".equals( k )
-                    && !"deploystart".equals( k ) && !"bundle".equals( k ) && !"optional".equals( k ) )
+                StringBuffer sb = new StringBuffer( "(&" );
+                for ( Enumeration e = request.getParameterNames(); e.hasMoreElements(); )
                 {
-                    sb.append( "(" ).append( k ).append( "=" ).append( v ).append( ")" );
+                    String k = ( String ) e.nextElement();
+                    String v = request.getParameter( k );
+                    if ( v != null && v.length() > 0 && !"details".equals( k ) && !"deploy".equals( k )
+                        && !"deploystart".equals( k ) && !"bundle".equals( k ) && !"optional".equals( k ) )
+                    {
+                        sb.append( "(" ).append( k ).append( "=" ).append( v ).append( ")" );
+                    }
                 }
+                sb.append( ")" );
+                filter = sb.toString();
             }
-            sb.append( ")" );
-            filter = sb.toString();
         }
 
-        return helper.getData( filter, details, getBundleContext().getBundles() );
+        return helper.getData( filter, info.showDetails(), getBundleContext().getBundles() );
     }
 
 
@@ -248,4 +248,70 @@
         }
     }
 
+    private static class RequestInfo {
+
+        private final HttpServletRequest request;
+
+        private boolean details;
+        private String query;
+        private String list;
+
+
+        RequestInfo( final HttpServletRequest request )
+        {
+            this.request = request;
+        }
+
+
+        boolean showDetails()
+        {
+            getQuery();
+            return details;
+        }
+
+
+        String getQuery()
+        {
+            if ( query == null )
+            {
+                String query = WebConsoleUtil.urlDecode( request.getParameter( "query" ) );
+                boolean details = false;
+                if ( query == null && request.getPathInfo().length() > 5 )
+                {
+                    // cut off "/obr/" prefix (might want to use getTitle ??)
+                    String path = request.getPathInfo().substring( 5 );
+                    int slash = path.indexOf( '/' );
+                    if ( slash < 0 )
+                    {
+                        // symbolic name only, version ??
+                        query = "(symbolicname=" + path + ")";
+                    }
+                    else
+                    {
+                        query = "(&(symbolicname=" + path.substring( 0, slash ) + ")(version="
+                            + path.substring( slash + 1 ) + "))";
+                        details = true;
+                    }
+                }
+
+                this.query = query;
+                this.details = details;
+            }
+            return query;
+        }
+
+
+        String getList()
+        {
+            if ( list == null )
+            {
+                list = WebConsoleUtil.urlDecode( request.getParameter( "list" ) );
+                if ( list == null && !request.getParameterNames().hasMoreElements() && getQuery() == null )
+                {
+                    list = "a";
+                }
+            }
+            return list;
+        }
+    }
 }
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/FelixBundleRepositoryRenderHelper.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/FelixBundleRepositoryRenderHelper.java
index 0ba2eeb..a9df5ba 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/FelixBundleRepositoryRenderHelper.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/FelixBundleRepositoryRenderHelper.java
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import javax.servlet.ServletException;
 import org.apache.felix.bundlerepository.Capability;
+import org.apache.felix.bundlerepository.Property;
 import org.apache.felix.bundlerepository.Reason;
 import org.apache.felix.bundlerepository.Repository;
 import org.apache.felix.bundlerepository.RepositoryAdmin;
@@ -59,15 +60,14 @@
             {
                 JSONObject json = new JSONObject();
                 json.put( "status", admin != null );
-                if ( admin != null )
+                json.put( "details", details );
+
+                final Repository repositories[] = admin.listRepositories();
+                for ( int i = 0; repositories != null && i < repositories.length; i++ )
                 {
-                    final Repository repositories[] = admin.listRepositories();
-                    for ( int i = 0; repositories != null && i < repositories.length; i++ )
-                    {
-                        json.append( "repositories", new JSONObject().put( "lastModified",
-                            repositories[i].getLastModified() ).put( "name", repositories[i].getName() ).put( "url",
-                            repositories[i].getURI() ) );
-                    }
+                    json.append( "repositories", new JSONObject().put( "lastModified",
+                        repositories[i].getLastModified() ).put( "name", repositories[i].getName() ).put( "url",
+                        repositories[i].getURI() ) );
                 }
 
                 Resource[] resources = admin.discoverResources( filter );
@@ -89,7 +89,7 @@
         }
 
         // fall back to no data
-        return "";
+        return "{}";
     }
 
 
@@ -211,7 +211,7 @@
             for ( int i = 0; caps != null && i < caps.length; i++ )
             {
                 json.append( "capabilities", new JSONObject().put( "name", caps[i].getName() ).put( "properties",
-                    new JSONObject( caps[i].getProperties() ) ) );
+                    toJSON( caps[i].getProperties() ) ) );
             }
             Requirement[] reqs = resource.getRequirements();
             for ( int i = 0; reqs != null && i < reqs.length; i++ )
@@ -244,4 +244,15 @@
         }
         return json;
     }
+
+
+    private JSONObject toJSON( final Property[] props ) throws JSONException
+    {
+        JSONObject json = new JSONObject();
+        for ( int i = 0; props != null && i < props.length; i++ )
+        {
+            json.put( props[i].getName(), props[i].getValue() );
+        }
+        return json;
+    }
 }
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/OsgiBundleRepositoryRenderHelper.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/OsgiBundleRepositoryRenderHelper.java
index 6dbe992..61477b1 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/OsgiBundleRepositoryRenderHelper.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/OsgiBundleRepositoryRenderHelper.java
@@ -50,18 +50,15 @@
 
     String getData( final String filter, final boolean details, Bundle[] bundles )
     {
-        try
+        RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();
+        if ( admin != null )
         {
-            RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();
-            if ( admin == null )
+            try
             {
-                return "";
-            }
+                JSONObject json = new JSONObject();
+                json.put( "status", admin != null );
+                json.put( "details", details );
 
-            JSONObject json = new JSONObject();
-            json.put( "status", admin != null );
-            if ( admin != null )
-            {
                 final Repository repositories[] = admin.listRepositories();
                 for ( int i = 0; repositories != null && i < repositories.length; i++ )
                 {
@@ -69,21 +66,23 @@
                         repositories[i].getLastModified() ).put( "name", repositories[i].getName() ).put( "url",
                         repositories[i].getURL() ) );
                 }
-            }
 
-            Resource[] resources = admin.discoverResources( filter );
-            for ( int i = 0; resources != null && i < resources.length; i++ )
+                Resource[] resources = admin.discoverResources( filter );
+                for ( int i = 0; resources != null && i < resources.length; i++ )
+                {
+                    json.append( "resources", toJSON( resources[i], bundles, details ) );
+                }
+
+                return json.toString();
+            }
+            catch ( JSONException e )
             {
-                json.append( "resources", toJSON( resources[i], bundles, details ) );
+                logger.log( "Failed to serialize repository to JSON object.", e );
             }
+        }
 
-            return json.toString();
-        }
-        catch ( JSONException e )
-        {
-            logger.log( "Failed to serialize repository to JSON object.", e );
-            return "";
-        }
+        // fall back to no data
+        return "{}";
     }
 
 
diff --git a/webconsole/src/main/resources/res/ui/obr.js b/webconsole/src/main/resources/res/ui/obr.js
index 2d5bc0a..baf96a9 100644
--- a/webconsole/src/main/resources/res/ui/obr.js
+++ b/webconsole/src/main/resources/res/ui/obr.js
@@ -68,7 +68,7 @@
 }
 
 function showDetails( symbolicname, version ) {
-    window.location.href = window.location.pathname + '?details&symbolicname=' + symbolicname + '&version=' + version;
+    window.location.href = pluginRoot + '/' + symbolicname + '/' + version;
 }
 
 function showVersions( symbolicname ) {
@@ -379,13 +379,13 @@
                         });
     // Required dependencies
     createDetailedTable(tbody, "Dependencies", ["Name", "Version"], res.required, function(p) {
-                            var a = createElement('a', null, { href: (window.location.pathname + '?details&symbolicname=' + p.symbolicname + '&version=' + p.version) });
+                            var a = createElement('a', null, { href: (pluginRoot + '/' + p.symbolicname + '/' + p.version) });
                             a.appendChild(text(p.presentationname ? p.presentationname : p.symbolicname));
                             return [ a, text(p.version) ];
                         });
     // Optional dependencies
     createDetailedTable(tbody, "Optional Dependencies", ["Name", "Version"], res.optional, function(p) {
-                            var a = createElement('a', null, { href: (window.location.pathname + '?details&symbolicname=' + p.symbolicname + '&version=' + p.version) });
+                            var a = createElement('a', null, { href: (pluginRoot + '/' + p.symbolicname + '/' + p.version) });
                             a.appendChild(text(p.presentationname ? p.presentationname : p.symbolicname));
                             return [ a, text(p.version) ];
                         });
@@ -421,7 +421,7 @@
 		for (var i in obrData.repositories ) {
 			renderRepository( obrData.repositories[i] );
 		}
-		if ($.getUrlVar('details')) {
+		if (obrData.details) {
 		    $('#resTable').addClass('ui-helper-hidden');
 		    $('#detailsTable').removeClass('ui-helper-hidden');
 		    for (var i in obrData.resources ) {
@@ -470,7 +470,11 @@
 	resTable = $('#resTable tbody').empty();
 	searchField = $('#searchField');
 	ifStatusOK = $('#ifStatusOK');
-    searchField.val($.getUrlVar('query'));
+	
+	var query = $.getUrlVar('query');
+	if (query) {
+        searchField.val(decodeURIComponent(query));
+    }
 
 	$('#addRepoBtn').click(function(event) {
         event.preventDefault();
@@ -478,7 +482,7 @@
 	});
 	$('#searchBtn').click(function(event) {
         event.preventDefault();
-        window.location.href = window.location.pathname + '?query=' + searchField.val();
+        window.location.href = pluginRoot + '?query=' + encodeURIComponent(searchField.val());
 	});
 	searchField.keypress(function(event) {
         if (event.keyCode == 13) {
diff --git a/webconsole/src/main/resources/templates/obr.html b/webconsole/src/main/resources/templates/obr.html
index 6f1ae5a..c40ffce 100644
--- a/webconsole/src/main/resources/templates/obr.html
+++ b/webconsole/src/main/resources/templates/obr.html
@@ -1,4 +1,4 @@
-<script type="text/javascript" src="res/ui/obr.js"></script>
+<script type="text/javascript" src="${pluginRoot}/res/ui/obr.js"></script>
 <script type="text/javascript">
 var i18n = {
 	status_ok : '${obr.status.ok}',
