Package org.apache.juneau.html
Class HtmlSerializerSession
- Direct Known Subclasses:
- HtmlSchemaSerializerSession,- HtmlStrippedDocSerializerSession
Session object that lives for the duration of a single use of 
HtmlSerializer.
 Notes:
- This class is not thread safe and is typically discarded after one use.
See Also:
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class org.apache.juneau.xml.XmlSerializerSessionXmlSerializerSession.ContentResult
- 
Field SummaryFields inherited from class org.apache.juneau.BeanTraverseSessionindent
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedConstructor.
- 
Method SummaryModifier and TypeMethodDescriptioncreate(HtmlSerializer ctx) Creates a new builder for this object.protected voiddoSerialize(SerializerPipe out, Object o) Serializes a POJO to the specified pipe.getAnchorText(BeanPropertyMeta pMeta, Object o) Returns the anchor text to use for the specified URL object.protected HtmlBeanPropertyMetaReturns the language-specific metadata on the specified bean property.protected HtmlClassMetagetHtmlClassMeta(ClassMeta<?> cm) Returns the language-specific metadata on the specified class.protected final HtmlWriterConverts the specified output target object to anHtmlWriter.protected final StringLink label parameter name.protected final AnchorTextAnchor text source.protected final booleanAdd"_type" properties when needed.protected final booleanAdd key/value headers on bean/map tables.protected final booleanLook for link labels in URIs.protected final booleanLook for URLs inStrings.booleanReturnstrue if we're serializing HTML.booleanisUri(ClassMeta<?> cm, BeanPropertyMeta pMeta, Object o) Returnstrue if the specified object is a URL.protected XmlSerializerSession.ContentResultserializeAnything(XmlWriter out, Object o, ClassMeta<?> eType, String keyName, String elementName, Namespace elementNamespace, boolean addNamespaceUris, XmlFormat format, boolean isMixed, boolean preserveWhitespace, BeanPropertyMeta pMeta) Workhorse method.protected XmlSerializerSession.ContentResultserializeAnything(XmlWriter out, Object o, ClassMeta<?> eType, String name, BeanPropertyMeta pMeta, int xIndent, boolean isRoot, boolean nlIfElement) Serialize the specified object to the specified writer.Methods inherited from class org.apache.juneau.xml.XmlSerializerSessioncreate, findNsfMappings, getDefaultNamespace, getNamespaces, getXmlBeanMeta, getXmlBeanPropertyMeta, getXmlClassMeta, getXmlWriter, isAddJsonTags, isAddNamespaceUrisToRoot, isAutoDetectNamespaces, isEnableNamespacesMethods inherited from class org.apache.juneau.serializer.WriterSerializerSessioncreate, createPipe, getFileCharset, getMaxIndent, getQuoteChar, getStreamCharset, isUseWhitespace, isWriterSerializer, properties, serialize, serializeToStringMethods inherited from class org.apache.juneau.serializer.SerializerSessionaddVarBean, canIgnoreValue, create, createBeanTypeNameProperty, createDefaultVarResolverSession, forEachEntry, forEachEntry, generalize, getBeanTypeName, getExpectedRootType, getJavaMethod, getListener, getListener, getResponseHeaders, getSchema, getUriContext, getUriRelativity, getUriResolution, getUriResolver, getVarResolver, handleThrown, isAddRootType, isKeepNullProperties, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimStrings, onBeanGetterException, onError, push2, relativizeUri, resolve, resolveUri, serialize, sort, sort, sort, swap, toList, toString, trimMethods inherited from class org.apache.juneau.BeanTraverseSessiongetInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, isRoot, pop, push, setCurrentClass, setCurrentProperty, willExceedDepth, willRecurseMethods inherited from class org.apache.juneau.BeanSession_class, addWarning, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, create, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionary, getBeanFieldVisibility, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getLocale, getMediaType, getNamePropertyName, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPropertyNamer, getSwaps, getTimeZone, getTimeZoneId, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isFindFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnoreMissingSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, newBean, newBean, newBeanMap, newBeanMap, newGenericMap, object, string, toArray, toBeanMap, toBeanMap, toBeanMapMethods inherited from class org.apache.juneau.ContextSessioncheckForWarnings, getContext, getSessionProperties, getWarnings, isDebug, toString
- 
Constructor Details- 
HtmlSerializerSessionConstructor.- Parameters:
- builder- The builder for this object.
 
 
- 
- 
Method Details- 
createCreates a new builder for this object.- Parameters:
- ctx- The context creating this session.
- Returns:
- A new builder.
 
- 
getHtmlWriterConverts the specified output target object to anHtmlWriter.- Parameters:
- out- The output target object.
- Returns:
- The output target object wrapped in an HtmlWriter.
- Throws:
- IOException- Thrown by underlying stream.
 
- 
isUriReturnstrue if the specified object is a URL.- Parameters:
- cm- The ClassMeta of the object being serialized.
- pMeta- The property metadata of the bean property of the object. Can be- null if the object isn't from a bean property.
- o- The object.
- Returns:
- true if the specified object is a URL.
 
- 
getAnchorTextReturns the anchor text to use for the specified URL object.- Parameters:
- pMeta- The property metadata of the bean property of the object. Can be- null if the object isn't from a bean property.
- o- The URL object.
- Returns:
- The anchor text to use for the specified URL object.
 
- 
isHtmlModeDescription copied from class:XmlSerializerSessionReturnstrue if we're serializing HTML.The difference in behavior is how empty non-void elements are handled. The XML serializer will produce a collapsed tag, whereas the HTML serializer will produce a start and end tag. - Overrides:
- isHtmlModein class- XmlSerializerSession
- Returns:
- true if we're generating HTML.
 
- 
doSerializeDescription copied from class:SerializerSessionSerializes a POJO to the specified pipe.This method should NOT close the context object. The default implementation of this method simply calls Serializer.doSerialize(SerializerSession,SerializerPipe,Object).- Overrides:
- doSerializein class- XmlSerializerSession
- Parameters:
- out- Where to send the output from the serializer.
- o- The object to serialize.
- Throws:
- IOException- Thrown by underlying stream.
- SerializeException- Problem occurred trying to serialize object.
 
- 
serializeAnythingprotected XmlSerializerSession.ContentResult serializeAnything(XmlWriter out, Object o, ClassMeta<?> eType, String keyName, String elementName, Namespace elementNamespace, boolean addNamespaceUris, XmlFormat format, boolean isMixed, boolean preserveWhitespace, BeanPropertyMeta pMeta) throws SerializeException Description copied from class:XmlSerializerSessionWorkhorse method.- Overrides:
- serializeAnythingin class- XmlSerializerSession
- Parameters:
- out- The writer to send the output to.
- o- The object to serialize.
- eType- The expected type if this is a bean property value being serialized.
- keyName- The property name or map key name.
- elementName- The root element name.
- elementNamespace- The namespace of the element.
- addNamespaceUris- Flag indicating that namespace URIs need to be added.
- format- The format to serialize the output to.
- isMixed- We're serializing mixed content, so don't use whitespace.
- preserveWhitespace-- true if we're serializing- XmlFormat.MIXED_PWSor- XmlFormat.TEXT_PWS.
- pMeta- The bean property metadata if this is a bean property being serialized.
- Returns:
- The same writer passed in so that calls to the writer can be chained.
- Throws:
- SerializeException- General serialization error occurred.
 
- 
serializeAnythingprotected XmlSerializerSession.ContentResult serializeAnything(XmlWriter out, Object o, ClassMeta<?> eType, String name, BeanPropertyMeta pMeta, int xIndent, boolean isRoot, boolean nlIfElement) throws SerializeException Serialize the specified object to the specified writer.- Parameters:
- out- The writer.
- o- The object to serialize.
- eType- The expected type of the object if this is a bean property.
- name- The attribute name of this object if this object was a field in a JSON object (i.e. key of a- Map.Entryor property name of a bean).
- pMeta- The bean property being serialized, or- null if we're not serializing a bean property.
- xIndent- The current indentation value.
- isRoot-- true if this is the root element of the document.
- nlIfElement-- true if we should add a newline to the output before serializing only if the object is an element and not text.
- Returns:
- The type of content encountered. Either simple (no whitespace) or normal (elements with whitespace).
- Throws:
- SerializeException- Generic serialization error occurred.
 
- 
isAddBeanTypesAdd"_type" properties when needed.- Overrides:
- isAddBeanTypesin class- XmlSerializerSession
- Returns:
- true if- "_type" properties will be added to beans if their type cannot be inferred through reflection.
- See Also:
 
- 
isAddKeyValueTableHeadersAdd key/value headers on bean/map tables.- Returns:
- true if- key and- value column headers are added to tables.
- See Also:
 
- 
isDetectLabelParametersLook for link labels in URIs.- Returns:
- true if we should ook for URL label parameters (e.g.- "?label=foobar" ).
- See Also:
 
- 
isDetectLinksInStringsLook for URLs inStrings.- Returns:
- true if we should automatically convert strings to URLs if they look like a URL.
- See Also:
 
- 
getLabelParameterLink label parameter name.- Returns:
- The parameter name to look for when resolving link labels.
- See Also:
 
- 
getUriAnchorTextAnchor text source.- Returns:
- When creating anchor tags (e.g. <a href ='...' > text</a> 
- See Also:
 
- 
getHtmlClassMetaReturns the language-specific metadata on the specified class.- Parameters:
- cm- The class to return the metadata on.
- Returns:
- The metadata.
 
- 
getHtmlBeanPropertyMetaReturns the language-specific metadata on the specified bean property.- Parameters:
- bpm- The bean property to return the metadata on.
- Returns:
- The metadata.
 
 
-