public static enum Context.UriPart extends Enum<Context.UriPart>
We need to distinguish these so that we can
javascript:.
| Enum Constant and Description |
|---|
AUTHORITY_OR_PATH
In the scheme, authority, or path.
|
DANGEROUS_SCHEME
A known-dangerous scheme where dynamic content is forbidden.
|
FRAGMENT
In the fragment.
|
MAYBE_SCHEME
Still possibly in the scheme, though it could also be a relative path, but no print
statements have been seen yet.
|
MAYBE_VARIABLE_SCHEME
After a print statement in the beginning of a URI, where it's still possible to be in the
scheme.
|
NONE
Not in a URI.
|
QUERY
In the query portion.
|
START
At the absolute beginning of a URI.
|
UNKNOWN
Not
NONE, but unknown. |
UNKNOWN_PRE_FRAGMENT
|
| Modifier and Type | Method and Description |
|---|---|
static Context.UriPart |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Context.UriPart[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Context.UriPart NONE
public static final Context.UriPart START
At ^ in ^http://host/path?k=v#frag or ^foo/bar?a=1.
public static final Context.UriPart MAYBE_VARIABLE_SCHEME
For example, after href="{$x}, it's hard to know what will happen.
For example, if $x is "java" (a perfectly valid relative URI on its own), then
"script:alert(1)" would execute as Javascript. But if $x is "java" followed by
"/test.html", it's a relative URI.
This state is kept until we see anything that's hard-coded that makes it clear that we've left the scheme context; while remaining in this state, print statements and colons are forbidden, since we don't want what looks like a relative URI to set the scheme.
public static final Context.UriPart MAYBE_SCHEME
For example, between carets in h^ttp^://host/path or f^oo^/bar.html.
This is similar to MAYBE_VARIABLE_SCHEME in that print statements are forbidden; however, colons are allowed and transition to AUTHORITY_OR_PATH.
public static final Context.UriPart AUTHORITY_OR_PATH
h^ttp://host/path^?k=v#frag.public static final Context.UriPart QUERY
http://host/path?^k=v^#fragpublic static final Context.UriPart FRAGMENT
http://host/path?k=v#^fragpublic static final Context.UriPart UNKNOWN_PRE_FRAGMENT
public static final Context.UriPart UNKNOWN
NONE, but unknown. Used to join different contexts.public static final Context.UriPart DANGEROUS_SCHEME
public static Context.UriPart[] values()
for (Context.UriPart c : Context.UriPart.values()) System.out.println(c);
public static Context.UriPart valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is null