Author: reto
Date: Sat May 21 12:58:55 2011
New Revision: 1125689

URL: http://svn.apache.org/viewvc?rev=1125689&view=rev
Log:
CLEREZZA-544: added to XmlResult and deprectated RenderedPage

Modified:
    
incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala
    
incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala

Modified: 
incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala?rev=1125689&r1=1125688&r2=1125689&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala
 (original)
+++ 
incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/RenderedPage.scala
 Sat May 21 12:58:55 2011
@@ -40,6 +40,7 @@ import org.apache.clerezza.rdf.scala.uti
  * the content method to produce an XML Element suitable as response to the
  * request yielding to the arguments passed to the constructor.
  */
+@deprecated("user XmlResult with SRenderlet")
 abstract class RenderedPage(arguments: RenderedPage.Arguments) {
 
        val RenderedPage.Arguments(

Modified: 
incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala?rev=1125689&r1=1125688&r2=1125689&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala
 (original)
+++ 
incubator/clerezza/trunk/parent/platform.typerendering.scala/src/main/scala/org/apache/clerezza/platform/typerendering/scala/XmlResult.scala
 Sat May 21 12:58:55 2011
@@ -77,10 +77,34 @@ abstract class XmlResult(arguments: XmlR
        }
 
        /**
+        * renders the specified resource without using the base-graph from 
resource
+        * rendered by the caller but getting a new context using the 
GraphNodeProvider
+        */
+       def render(resource: UriRef): Seq[Node] = {
+               modeOption match {
+                       case Some(m) => render(resource, m)
+                       case None => render(resource, "naked")
+               }
+       }
+
+       /**
+        * renders the specified resource without using the base-graph from 
resource
+        * rendered by the caller but getting a new context using the 
GraphNodeProvider
+        */
+       def render(resource: UriRef, mode: String) = {
+               def parseNodeSeq(string: String) = {
+                       _root_.scala.xml.XML.loadString("<elem>" + string + 
"</elem>").child
+               }
+               val baos = new java.io.ByteArrayOutputStream
+               renderer.render(resource, context, mode, baos)
+               parseNodeSeq(new String(baos.toByteArray))
+       }
+
+       /**
         * This is an object that allows one to use some nice shortcuts in 
scala based subclasses
         * - $variable will get the value of the sharedRenderingValues hash
         * - $variable = value allows one to update the sharedRenderingValues 
hash
-        * - $? not sure there...
+        * - $[ClassName] allows to access an osgi service annotated to be a 
WebRenderingService
         */
        object $ {
                def apply(key: String) = sharedRenderingValues.get(key)


Reply via email to