- java.lang.Object
-
- javax.faces.render.RenderKit
-
- Direct Known Subclasses:
- RenderKitWrapper
public abstract class RenderKit extends Object
RenderKit represents a collection of
Renderer
instances that, together, know how to render JavaServer FacesUIComponent
instances for a specific client. Typically,RenderKit
s are specialized for some combination of client device type, markup language, and/or userLocale
. ARenderKit
also acts as a Factory for associatedRenderer
instances, which perform the actual rendering process for each component.A typical JavaServer Faces implementation will configure one or more
RenderKit
instances at web application startup. They are made available through calls to thegetRenderKit()
methods ofRenderKitFactory
. BecauseRenderKit
instances are shared, they must be implemented in a thread-safe manner. Due to limitations in the current specification having multipleRenderKit
instances at play in the same application requires a customViewHandler
instance that is aware of how to deal with this case. This limitation will be lifted in a future version of the spec.The
RenderKit
instance must also vend aResponseStateManager
instance, which is used in the process of saving and restoring tree structure and state.
-
-
Constructor Summary
Constructors Constructor and Description RenderKit()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description void
addClientBehaviorRenderer(String type, ClientBehaviorRenderer renderer)
Register the specifiedClientBehaviorRenderer
instance, associated with the specified componenttype
, to the set ofClientBehaviorRenderer
s registered with thisRenderKit
, replacing any previously registeredClientBehaviorRenderer
for this type.abstract void
addRenderer(String family, String rendererType, Renderer renderer)
abstract ResponseStream
createResponseStream(OutputStream out)
Use the providedOutputStream
to create a newResponseStream
instance.abstract ResponseWriter
createResponseWriter(Writer writer, String contentTypeList, String characterEncoding)
Use the providedWriter
to create a newResponseWriter
instance for the specified (optional) content type, and character encoding.ClientBehaviorRenderer
getClientBehaviorRenderer(String type)
Return theClientBehaviorRenderer
instance most recently registered for the specifiedtype
, if any; otherwise, returnnull
.Iterator<String>
getClientBehaviorRendererTypes()
Return an
Iterator
over theClientBehaviorRenderer
types.Iterator<String>
getComponentFamilies()
Return an
Iterator
over the component-family entries supported by thisRenderKit
instance.abstract Renderer
getRenderer(String family, String rendererType)
Return theRenderer
instance most recently registered for the specified componentfamily
andrendererType
, if any; otherwise, returnnull
.Iterator<String>
getRendererTypes(String componentFamily)
Return an
Iterator
over the renderer-type entries for the given component-family.abstract ResponseStateManager
getResponseStateManager()
Return an instance ofResponseStateManager
to handle rendering technology specific state management decisions.
-
-
-
Method Detail
-
addRenderer
public abstract void addRenderer(String family, String rendererType, Renderer renderer)
Register the specified
Renderer
instance, associated with the specified componentfamily
andrendererType
, to the set ofRenderer
s registered with thisRenderKit
, replacing any previously registeredRenderer
for this combination of identifiers.- Parameters:
family
- Component family of theRenderer
to registerrendererType
- Renderer type of theRenderer
to registerrenderer
-Renderer
instance we are registering- Throws:
NullPointerException
- iffamily
orrendererType
orrenderer
is null
-
getRenderer
public abstract Renderer getRenderer(String family, String rendererType)
Return the
Renderer
instance most recently registered for the specified componentfamily
andrendererType
, if any; otherwise, returnnull
.- Parameters:
family
- Component family of the requestedRenderer
instancerendererType
- Renderer type of the requestedRenderer
instance- Throws:
NullPointerException
- iffamily
orrendererType
isnull
-
getResponseStateManager
public abstract ResponseStateManager getResponseStateManager()
Return an instance of
ResponseStateManager
to handle rendering technology specific state management decisions.
-
createResponseWriter
public abstract ResponseWriter createResponseWriter(Writer writer, String contentTypeList, String characterEncoding)
Use the provided
Writer
to create a newResponseWriter
instance for the specified (optional) content type, and character encoding.Implementors are advised to consult the
getCharacterEncoding()
method of classServletResponse
to get the required value for the characterEncoding for this method. Since theWriter
for 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 thisResponseWriter
must be built.contentTypeList
- an "Accept header style" list of content types for this response, ornull
if 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 Stringtext/html
,application/xhtml+xml
,application/xml
ortext/xml
. This may change in a future version. The RenderKit must support a value for this argument that comes straight from theAccept
HTTP header, and therefore requires parsing according to the specification of theAccept
header. Please see Section 14.1 of RFC 2616 for the specification of theAccept
header.characterEncoding
- such as "ISO-8859-1" for this ResponseWriter, ornull
if theRenderKit
should 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 incontentTypeList
, no appropriate content type can be found with the implementation dependent best fit algorithm, or no matching character encoding can be found for the argumentcharacterEncoding
.
-
createResponseStream
public abstract ResponseStream createResponseStream(OutputStream out)
Use the provided
OutputStream
to create a newResponseStream
instance.
-
getComponentFamilies
public Iterator<String> getComponentFamilies()
Return an
Iterator
over the component-family entries supported by thisRenderKit
instance.The default implementation of this method returns an empty
Iterator
- Since:
- 2.0
-
getRendererTypes
public Iterator<String> getRendererTypes(String componentFamily)
Return an
Iterator
over the renderer-type entries for the given component-family.If the specified
componentFamily
is not known to thisRenderKit
implementation, return an emptyIterator
The default implementation of this method returns an empty
Iterator
- Parameters:
componentFamily
- one of the members of theIterator
returned bygetComponentFamilies()
.- Since:
- 2.0
-
addClientBehaviorRenderer
public void addClientBehaviorRenderer(String type, ClientBehaviorRenderer renderer)
Register the specified
ClientBehaviorRenderer
instance, associated with the specified componenttype
, to the set ofClientBehaviorRenderer
s registered with thisRenderKit
, replacing any previously registeredClientBehaviorRenderer
for this type.- Parameters:
type
- type of theClientBehaviorRenderer
to registerrenderer
-ClientBehaviorRenderer
instance we are registering- Throws:
NullPointerException
- iftype
orrenderer
is null- Since:
- 2.0
-
getClientBehaviorRenderer
public ClientBehaviorRenderer getClientBehaviorRenderer(String type)
Return the
ClientBehaviorRenderer
instance most recently registered for the specifiedtype
, if any; otherwise, returnnull
.- Parameters:
type
- type of the requestedClientBehaviorRenderer
instance- Throws:
NullPointerException
- iftype
isnull
- Since:
- 2.0
-
getClientBehaviorRendererTypes
public Iterator<String> getClientBehaviorRendererTypes()
Return an
Iterator
over theClientBehaviorRenderer
types.- Since:
- 2.0
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/faces/render/RenderKit.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.