Package com.yahoo.search.rendering
Class JsonRenderer
java.lang.Object
com.yahoo.component.AbstractComponent
com.yahoo.processing.rendering.Renderer<RESPONSE>
com.yahoo.processing.rendering.AsynchronousRenderer<RESPONSE>
com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
com.yahoo.search.rendering.JsonRenderer
- All Implemented Interfaces:
com.yahoo.component.Component,com.yahoo.component.Deconstructable,Cloneable,Comparable<com.yahoo.component.Component>
public class JsonRenderer
extends com.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
JSON renderer for search results.
- Author:
- Steinar Knutsen, bratseth
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classReceived callbacks when fields of hits are encountered. -
Field Summary
Fields inherited from class com.yahoo.component.AbstractComponent
isDeconstructable -
Constructor Summary
ConstructorsConstructorDescriptionJsonRenderer(Executor executor) Creates a json renderer using a custom executor. -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginList(com.yahoo.processing.response.DataList<?> list) voidbeginResponse(OutputStream stream) protected JsonRenderer.FieldConsumercreateFieldConsumer(boolean debugRendering) Override this method to use a customJsonRenderer.FieldConsumersub-class to render fieldsvoiddata(com.yahoo.processing.response.Data data) voidendList(com.yahoo.processing.response.DataList<?> list) voidvoidinit()protected voidprotected voidrenderAllFields(Hit hit) protected voidrenderContinuations(Map<String, Continuation> continuations) protected voidprotected voidrenderErrors(Set<ErrorMessage> errors) protected voidprotected voidprotected voidrenderHitContents(Hit hit) protected voidrenderHitGroupHead(HitGroup hitGroup) protected voidrenderTotalHitCount(Hit hit) protected voidrenderTrace(com.yahoo.processing.execution.Execution.Trace trace) protected booleanshouldRender(Hit hit) Methods inherited from class com.yahoo.processing.rendering.AsynchronousSectionedRenderer
clientClosed, deconstruct, getExecution, getRecursionLevel, getResponse, onClientClosed, renderResponse, renderResponseBeforeHandover, setNetworkWiringMethods inherited from class com.yahoo.processing.rendering.Renderer
cloneMethods inherited from class com.yahoo.component.AbstractComponent
compareTo, getClassName, getId, getIdString, hasInitializedId, initId, isDeconstructable, setIsDeconstructable, toString
-
Constructor Details
-
JsonRenderer
public JsonRenderer() -
JsonRenderer
Creates a json renderer using a custom executor. Using a custom executor is useful for tests to avoid creating new threads for each renderer registry.
-
-
Method Details
-
init
public void init()- Overrides:
initin classcom.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>
-
beginResponse
- Specified by:
beginResponsein classcom.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>- Throws:
IOException
-
renderTrace
- Throws:
IOException
-
beginList
- Specified by:
beginListin classcom.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>- Throws:
IOException
-
moreChildren
- Throws:
IOException
-
renderHitGroupHead
- Throws:
IOException
-
renderErrors
- Throws:
IOException
-
renderCoverage
- Throws:
IOException
-
renderHit
- Throws:
IOException
-
shouldRender
-
renderHitContents
- Throws:
IOException
-
renderAllFields
- Throws:
IOException
-
renderContinuations
- Throws:
IOException
-
renderGroupMetadata
- Throws:
IOException
-
renderTotalHitCount
- Throws:
IOException
-
data
- Specified by:
datain classcom.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>- Throws:
IOException
-
endList
- Specified by:
endListin classcom.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>- Throws:
IOException
-
endResponse
- Specified by:
endResponsein classcom.yahoo.processing.rendering.AsynchronousSectionedRenderer<Result>- Throws:
IOException
-
getEncoding
- Specified by:
getEncodingin classcom.yahoo.processing.rendering.Renderer<Result>
-
getMimeType
- Specified by:
getMimeTypein classcom.yahoo.processing.rendering.Renderer<Result>
-
createFieldConsumer
Override this method to use a customJsonRenderer.FieldConsumersub-class to render fields
-