Package org.owasp.encoder
Class Encoders
- java.lang.Object
-
- org.owasp.encoder.Encoders
-
public final class Encoders extends java.lang.ObjectEncoders -- Public factory method for obtaining instances of Encoders. Classes implementing the encoders are not directly exposed as part of the API since encoding strategies are subject to change. In many cases encoders will share the same implementation, but have different internal flags for how to handle varied content. For example the XML_CONTENT and XML_ATTRIBUTE contexts may currently share the same class with each instances having a different set of flags. Future version may optimize them into different classes.All encoders returned by the factory are thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCDATAName of CDATA context.static java.lang.StringCSS_STRINGName of CSS string context.static java.lang.StringCSS_URLName of CSS URL context.static java.lang.StringHTMLName of HTML general context.static java.lang.StringHTML_ATTRIBUTEName of HTML attribute context.static java.lang.StringHTML_CONTENTName of HTML content context.static java.lang.StringHTML_UNQUOTED_ATTRIBUTEName of unquoted HTML attribute context.static java.lang.StringJAVAName of Java String context.static java.lang.StringJAVASCRIPTName of JavaScript general context.static java.lang.StringJAVASCRIPT_ATTRIBUTEName of JavaScript attribute context.static java.lang.StringJAVASCRIPT_BLOCKName of JavaScript block context.static java.lang.StringJAVASCRIPT_SOURCEName of JavaScript source context.static java.lang.StringURIName of URI context.static java.lang.StringURI_COMPONENTName of URI component context.static java.lang.StringXMLName of XML general context.static java.lang.StringXML_ATTRIBUTEName of XML attribute context.static java.lang.StringXML_COMMENTName of XML comment context.static java.lang.StringXML_CONTENTName of XML content context.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EncoderforName(java.lang.String contextName)Returns a new instance of an Encoder for the specified context.
-
-
-
Field Detail
-
HTML
public static final java.lang.String HTML
Name of HTML general context.- See Also:
- Constant Field Values
-
HTML_CONTENT
public static final java.lang.String HTML_CONTENT
Name of HTML content context.- See Also:
- Constant Field Values
-
HTML_ATTRIBUTE
public static final java.lang.String HTML_ATTRIBUTE
Name of HTML attribute context.- See Also:
- Constant Field Values
-
HTML_UNQUOTED_ATTRIBUTE
public static final java.lang.String HTML_UNQUOTED_ATTRIBUTE
Name of unquoted HTML attribute context.- See Also:
- Constant Field Values
-
XML
public static final java.lang.String XML
Name of XML general context.- See Also:
- Constant Field Values
-
XML_CONTENT
public static final java.lang.String XML_CONTENT
Name of XML content context.- See Also:
- Constant Field Values
-
XML_ATTRIBUTE
public static final java.lang.String XML_ATTRIBUTE
Name of XML attribute context.- See Also:
- Constant Field Values
-
XML_COMMENT
public static final java.lang.String XML_COMMENT
Name of XML comment context.- See Also:
- Constant Field Values
-
CDATA
public static final java.lang.String CDATA
Name of CDATA context.- See Also:
- Constant Field Values
-
CSS_STRING
public static final java.lang.String CSS_STRING
Name of CSS string context.- See Also:
- Constant Field Values
-
CSS_URL
public static final java.lang.String CSS_URL
Name of CSS URL context.- See Also:
- Constant Field Values
-
JAVA
public static final java.lang.String JAVA
Name of Java String context.- See Also:
- Constant Field Values
-
JAVASCRIPT
public static final java.lang.String JAVASCRIPT
Name of JavaScript general context.- See Also:
- Constant Field Values
-
JAVASCRIPT_ATTRIBUTE
public static final java.lang.String JAVASCRIPT_ATTRIBUTE
Name of JavaScript attribute context.- See Also:
- Constant Field Values
-
JAVASCRIPT_BLOCK
public static final java.lang.String JAVASCRIPT_BLOCK
Name of JavaScript block context.- See Also:
- Constant Field Values
-
JAVASCRIPT_SOURCE
public static final java.lang.String JAVASCRIPT_SOURCE
Name of JavaScript source context.- See Also:
- Constant Field Values
-
URI
public static final java.lang.String URI
Name of URI context.- See Also:
- Constant Field Values
-
URI_COMPONENT
public static final java.lang.String URI_COMPONENT
Name of URI component context.- See Also:
- Constant Field Values
-
-
Method Detail
-
forName
public static Encoder forName(java.lang.String contextName) throws java.lang.NullPointerException, UnsupportedContextException
Returns a new instance of an Encoder for the specified context. The returned instance is thread-safe.- Parameters:
contextName- the context name (one of the String constants defined in this class)- Returns:
- an encoder for the specified context.
- Throws:
java.lang.NullPointerException- ifcontextNameis nullUnsupportedContextException- ifcontextNameis not recognized.
-
-