Class XmlRenderer

  • All Implemented Interfaces:
    com.yahoo.component.Component, java.lang.Cloneable, java.lang.Comparable<com.yahoo.component.Component>

    public final class XmlRenderer
    extends com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
    XML rendering of search results.
    Author:
    Tony Vaagenes
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_ENCODING  
      static java.lang.String DEFAULT_MIMETYPE  
      • Fields inherited from class com.yahoo.component.AbstractComponent

        isDeconstructable
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlRenderer()  
      XmlRenderer​(java.util.concurrent.Executor executor)
      Creates an XML renderer using a custom executor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void beginList​(com.yahoo.processing.response.DataList<?> list)  
      void beginResponse​(java.io.OutputStream stream)  
      void data​(com.yahoo.processing.response.Data data)  
      protected void emptyResult​(com.yahoo.text.XMLWriter writer, Result result)  
      void endList​(com.yahoo.processing.response.DataList<?> list)  
      void endResponse()  
      void error​(com.yahoo.text.XMLWriter writer, Result result)  
      java.lang.String getEncoding()  
      java.lang.String getMimeType()  
      java.lang.String getRequestedEncoding​(Query query)
      Returns the encoding of the query, or the encoding given by the template if none is set
      void init()  
      void queryContext​(com.yahoo.text.XMLWriter writer, QueryContext queryContext, Query owner)  
      protected static void renderCoverageAttributes​(Coverage coverage, com.yahoo.text.XMLWriter writer)  
      static void renderMessageDefaultErrorHit​(com.yahoo.text.XMLWriter writer, ErrorMessage error)  
      static boolean simpleRenderDefaultErrorHit​(com.yahoo.text.XMLWriter writer, ErrorHit defaultErrorHit)  
      • Methods inherited from class com.yahoo.processing.rendering.AsynchronousSectionedRenderer

        clientClosed, deconstruct, getExecution, getRecursionLevel, getResponse, onClientClosed, render, renderBeforeHandover, setNetworkWiring
      • Methods inherited from class com.yahoo.processing.rendering.Renderer

        clone
      • Methods inherited from class com.yahoo.component.AbstractComponent

        compareTo, getClassName, getId, getIdString, hasInitializedId, initId, isDeconstructable, setIsDeconstructable, toString
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • XmlRenderer

        public XmlRenderer()
      • XmlRenderer

        public XmlRenderer​(java.util.concurrent.Executor executor)
        Creates an XML renderer using a custom executor. Using a custom executor is useful for tests to avoid creating new threads for each renderer registry.
    • Method Detail

      • init

        public void init()
        Overrides:
        init in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
      • getEncoding

        public java.lang.String getEncoding()
        Specified by:
        getEncoding in class com.yahoo.processing.rendering.Renderer<Result>
      • getMimeType

        public java.lang.String getMimeType()
        Specified by:
        getMimeType in class com.yahoo.processing.rendering.Renderer<Result>
      • renderCoverageAttributes

        protected static void renderCoverageAttributes​(Coverage coverage,
                                                       com.yahoo.text.XMLWriter writer)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • error

        public void error​(com.yahoo.text.XMLWriter writer,
                          Result result)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • emptyResult

        protected void emptyResult​(com.yahoo.text.XMLWriter writer,
                                   Result result)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • queryContext

        public void queryContext​(com.yahoo.text.XMLWriter writer,
                                 QueryContext queryContext,
                                 Query owner)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • simpleRenderDefaultErrorHit

        public static boolean simpleRenderDefaultErrorHit​(com.yahoo.text.XMLWriter writer,
                                                          ErrorHit defaultErrorHit)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • renderMessageDefaultErrorHit

        public static void renderMessageDefaultErrorHit​(com.yahoo.text.XMLWriter writer,
                                                        ErrorMessage error)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • beginResponse

        public void beginResponse​(java.io.OutputStream stream)
                           throws java.io.IOException
        Specified by:
        beginResponse in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
        Throws:
        java.io.IOException
      • getRequestedEncoding

        public final java.lang.String getRequestedEncoding​(Query query)
        Returns the encoding of the query, or the encoding given by the template if none is set
      • beginList

        public void beginList​(com.yahoo.processing.response.DataList<?> list)
                       throws java.io.IOException
        Specified by:
        beginList in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
        Throws:
        java.io.IOException
      • data

        public void data​(com.yahoo.processing.response.Data data)
                  throws java.io.IOException
        Specified by:
        data in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
        Throws:
        java.io.IOException
      • endList

        public void endList​(com.yahoo.processing.response.DataList<?> list)
        Specified by:
        endList in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
      • endResponse

        public void endResponse()
        Specified by:
        endResponse in class com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>