You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ch...@apache.org on 2013/07/22 10:10:40 UTC

svn commit: r1505620 - /felix/site/trunk/content/documentation/subprojects/apache-felix-script-console-plugin.mdtext

Author: chetanm
Date: Mon Jul 22 08:10:39 2013
New Revision: 1505620

URL: http://svn.apache.org/r1505620
Log:
FELIX-4122 - Felix Script Console Plugin

Fixing formatting

Modified:
    felix/site/trunk/content/documentation/subprojects/apache-felix-script-console-plugin.mdtext

Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-script-console-plugin.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-script-console-plugin.mdtext?rev=1505620&r1=1505619&r2=1505620&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-script-console-plugin.mdtext (original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-script-console-plugin.mdtext Mon Jul 22 08:10:39 2013
@@ -24,6 +24,7 @@ The plugin screen provides a textarea to
 output is shown in pane below.
 
 The script exposes following variables
+
 * `request` - Current HttpServletRequest instance
 * `response` - Current HttpServletResponse instance
 * `reader` - Direct access to the Reader of the request - same as request.getReader(). Use it for reading the data of an HTTP request body.
@@ -74,64 +75,63 @@ If any exception occurs while evaluating
 Following are some sample scripts in Groovy. Note the scripts might be depending on implementation details to access the
 relevant data structures
 
-1. Script to find out servlets which are registered problematically with Felix HTTP Service
-
-    :::groovy
-    import org.osgi.service.http.HttpService
-    import org.osgi.framework.FrameworkUtil
-    import org.osgi.framework.Bundle
-
-    def httpService = osgi.getService(HttpService.class)
-    httpService.handlerRegistry.aliasMap.each{alias,servlet ->
-        Bundle bnd = FrameworkUtil.getBundle(servlet.class)
-        println "$alias : ${servlet.class.name} ($bnd.symbolicName)"
-    }
-
-2. Script to load a class which is not exported and then invoke some static method on that class
-
-At times you need to access some private class to see the runtime state.
-
-    :::groovy
-    import org.osgi.framework.Bundle
-    import org.osgi.framework.BundleContext
-
-    //Script to load a class which is not exported and then invoke some static method on that class
-
-    //Name of the class
-    def className = "org.apache.sling.engine.impl.SlingMainServlet"
+1 Script to find out servlets which are registered problematically with Felix HTTP Service
 
-    def resPath = className.replaceAll('.','/')+".class"
-    def bundles = bundleContext.getBundles().findAll{Bundle b ->
-        b.getEntry(resPath) != null
-    }
-
-    if(!bundles){
-       println "No bundle found for class $className"
-       return
-    }
-
-    def b = bundles.asList().first()
-    def clazz = b.loadClass(className)
-
-    //Invoke some static method
-    def result = clazz.metaClass.invokeStaticMethod(clazz, 'foo',  arg1)
-    println result
+        :::groovy
+        import org.osgi.service.http.HttpService
+        import org.osgi.framework.FrameworkUtil
+        import org.osgi.framework.Bundle
+
+        def httpService = osgi.getService(HttpService.class)
+        httpService.handlerRegistry.aliasMap.each{alias,servlet ->
+            Bundle bnd = FrameworkUtil.getBundle(servlet.class)
+            println "$alias : ${servlet.class.name} ($bnd.symbolicName)"
+        }
+
+2. Script to load a class which is not exported and then invoke some static method on that class. At times you need to
+access some private class to see the runtime state.
+
+        :::groovy
+        import org.osgi.framework.Bundle
+        import org.osgi.framework.BundleContext
+
+        //Script to load a class which is not exported and then invoke some static method on that class
+
+        //Name of the class
+        def className = "org.apache.sling.engine.impl.SlingMainServlet"
+
+        def resPath = className.replaceAll('.','/')+".class"
+        def bundles = bundleContext.getBundles().findAll{Bundle b ->
+            b.getEntry(resPath) != null
+        }
+
+        if(!bundles){
+           println "No bundle found for class $className"
+           return
+        }
+
+        def b = bundles.asList().first()
+        def clazz = b.loadClass(className)
+
+        //Invoke some static method
+        def result = clazz.metaClass.invokeStaticMethod(clazz, 'foo',  arg1)
+        println result
 
 3. Script to find out which bundle embeds a given class
 
-    :::groovy
-    import org.osgi.framework.Bundle
-    import org.osgi.framework.BundleContext
-
-    //Name of the class
-    def className = "org.apache.sling.engine.impl.SlingMainServlet"
-
-    def resPath = className.replaceAll('.','/')+".class"
-    def bundles = bundleContext.getBundles().findAll{Bundle b ->
-        b.getEntry(resPath) != null
-    }
-
-    println "Following bundles have the class"
-    bundles.each{
-        println it
-    }
\ No newline at end of file
+        :::groovy
+        import org.osgi.framework.Bundle
+        import org.osgi.framework.BundleContext
+
+        //Name of the class
+        def className = "org.apache.sling.engine.impl.SlingMainServlet"
+
+        def resPath = className.replaceAll('.','/')+".class"
+        def bundles = bundleContext.getBundles().findAll{Bundle b ->
+            b.getEntry(resPath) != null
+        }
+
+        println "Following bundles have the class"
+        bundles.each{
+            println it
+        }
\ No newline at end of file