Class RenderKit
- java.lang.Object
- 
- jakarta.faces.render.RenderKit
 
- 
- Direct Known Subclasses:
- RenderKitWrapper
 
 public abstract class RenderKit extends Object RenderKit represents a collection of Rendererinstances that, together, know how to render Jakarta FacesUIComponentinstances for a specific client. Typically,RenderKits are specialized for some combination of client device type, markup language, and/or userLocale. ARenderKitalso acts as a Factory for associatedRendererinstances, which perform the actual rendering process for each component.A typical Jakarta Faces implementation will configure one or more RenderKitinstances at web application startup. They are made available through calls to thegetRenderKit()methods ofRenderKitFactory. BecauseRenderKitinstances are shared, they must be implemented in a thread-safe manner. Due to limitations in the current specification having multipleRenderKitinstances at play in the same application requires a customViewHandlerinstance that is aware of how to deal with this case. This limitation will be lifted in a future version of the spec.The RenderKitinstance must also vend aResponseStateManagerinstance, which is used in the process of saving and restoring tree structure and state.
- 
- 
Constructor SummaryConstructors Constructor Description RenderKit()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddClientBehaviorRenderer(String type, ClientBehaviorRenderer renderer)Register the specifiedClientBehaviorRendererinstance, associated with the specified componenttype, to the set ofClientBehaviorRenderers registered with thisRenderKit, replacing any previously registeredClientBehaviorRendererfor this type.abstract voidaddRenderer(String family, String rendererType, Renderer renderer)abstract ResponseStreamcreateResponseStream(OutputStream out)Use the providedOutputStreamto create a newResponseStreaminstance.abstract ResponseWritercreateResponseWriter(Writer writer, String contentTypeList, String characterEncoding)Use the providedWriterto create a newResponseWriterinstance for the specified (optional) content type, and character encoding.ClientBehaviorRenderergetClientBehaviorRenderer(String type)Return theClientBehaviorRendererinstance most recently registered for the specifiedtype, if any; otherwise, returnnull.Iterator<String>getClientBehaviorRendererTypes()Return anIteratorover theClientBehaviorRenderertypes.Iterator<String>getComponentFamilies()Return anIteratorover the component-family entries supported by thisRenderKitinstance.abstract RenderergetRenderer(String family, String rendererType)Return theRendererinstance most recently registered for the specified componentfamilyandrendererType, if any; otherwise, returnnull.Iterator<String>getRendererTypes(String componentFamily)Return anIteratorover the renderer-type entries for the given component-family.abstract ResponseStateManagergetResponseStateManager()Return an instance ofResponseStateManagerto handle rendering technology specific state management decisions.
 
- 
- 
- 
Method Detail- 
addRendererpublic abstract void addRenderer(String family, String rendererType, Renderer renderer) Register the specified Rendererinstance, associated with the specified componentfamilyandrendererType, to the set ofRenderers registered with thisRenderKit, replacing any previously registeredRendererfor this combination of identifiers.- Parameters:
- family- Component family of the- Rendererto register
- rendererType- Renderer type of the- Rendererto register
- renderer-- Rendererinstance we are registering
- Throws:
- NullPointerException- if- familyor- rendererTypeor- rendereris null
 
 - 
getRendererpublic abstract Renderer getRenderer(String family, String rendererType) Return the Rendererinstance most recently registered for the specified componentfamilyandrendererType, if any; otherwise, returnnull.- Parameters:
- family- Component family of the requested- Rendererinstance
- rendererType- Renderer type of the requested- Rendererinstance
- Returns:
- the Rendererinstance
- Throws:
- NullPointerException- if- familyor- rendererTypeis- null
 
 - 
getResponseStateManagerpublic abstract ResponseStateManager getResponseStateManager() Return an instance of ResponseStateManagerto handle rendering technology specific state management decisions.- Returns:
- the ResponseStateManager
 
 - 
createResponseWriterpublic abstract ResponseWriter createResponseWriter(Writer writer, String contentTypeList, String characterEncoding) Use the provided Writerto create a newResponseWriterinstance for the specified (optional) content type, and character encoding.Implementors are advised to consult the getCharacterEncoding()method of classServletResponseto get the required value for the characterEncoding for this method. Since theWriterfor this response will already have been obtained (due to it ultimately being passed to this method), we know that the character encoding cannot change during the rendering of the response.- Parameters:
- writer- the Writer around which this- ResponseWritermust be built.
- contentTypeList- an "Accept header style" list of content types for this response, or- nullif the RenderKit should choose the best fit. As of the current version, the values accepted by the Standard render-kit for this parameter include any valid "Accept header style" String that includes the String- text/html,- application/xhtml+xml,- application/xmlor- text/xml. This may change in a future version. The RenderKit must support a value for this argument that comes straight from the- AcceptHTTP header, and therefore requires parsing according to the specification of the- Acceptheader. Please see Section 14.1 of RFC 2616 for the specification of the- Acceptheader.
- characterEncoding- such as "ISO-8859-1" for this ResponseWriter, or- nullif the- RenderKitshould choose the best fit. Please see the IANA for a list of character encodings.
- Returns:
- a new ResponseWriter.
- Throws:
- IllegalArgumentException- if no matching content type can be found in- contentTypeList, no appropriate content type can be found with the implementation dependent best fit algorithm, or no matching character encoding can be found for the argument- characterEncoding.
 
 - 
createResponseStreampublic abstract ResponseStream createResponseStream(OutputStream out) Use the provided OutputStreamto create a newResponseStreaminstance.- Parameters:
- out- the- OutputStreamaround which to create the- ResponseStream
- Returns:
- the new ResponseStream
 
 - 
getComponentFamiliespublic Iterator<String> getComponentFamilies() Return an Iteratorover the component-family entries supported by thisRenderKitinstance.The default implementation of this method returns an empty Iterator- Returns:
- Return an Iteratorover the component-family entries
- Since:
- 2.0
 
 - 
getRendererTypespublic Iterator<String> getRendererTypes(String componentFamily) Return an Iteratorover the renderer-type entries for the given component-family.If the specified componentFamilyis not known to thisRenderKitimplementation, return an emptyIteratorThe default implementation of this method returns an empty Iterator- Parameters:
- componentFamily- one of the members of the- Iteratorreturned by- getComponentFamilies().
- Returns:
- an Iteratorover the renderer-type
- Since:
- 2.0
 
 - 
addClientBehaviorRendererpublic void addClientBehaviorRenderer(String type, ClientBehaviorRenderer renderer) Register the specified ClientBehaviorRendererinstance, associated with the specified componenttype, to the set ofClientBehaviorRenderers registered with thisRenderKit, replacing any previously registeredClientBehaviorRendererfor this type.- Parameters:
- type- type of the- ClientBehaviorRendererto register
- renderer-- ClientBehaviorRendererinstance we are registering
- Throws:
- NullPointerException- if- typeor- rendereris null
- Since:
- 2.0
 
 - 
getClientBehaviorRendererpublic ClientBehaviorRenderer getClientBehaviorRenderer(String type) Return the ClientBehaviorRendererinstance most recently registered for the specifiedtype, if any; otherwise, returnnull.- Parameters:
- type- type of the requested- ClientBehaviorRendererinstance
- Returns:
- the ClientBehaviorRendererinstance
- Throws:
- NullPointerException- if- typeis- null
- Since:
- 2.0
 
 - 
getClientBehaviorRendererTypespublic Iterator<String> getClientBehaviorRendererTypes() Return an Iteratorover theClientBehaviorRenderertypes.- Returns:
- an Iteratorover theClientBehaviorRenderer
- Since:
- 2.0
 
 
- 
 
-