Class ApacheEscape
- java.lang.Object
-
- com.aoindustries.aoserv.client.util.ApacheEscape
-
public class ApacheEscape extends Object
Escapes arbitrary values for use in Apache directives.- Author:
- AO Industries, Inc.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_DOLLAR_VARIABLE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringescape(String dollarVariable, String value)Escapes arbitrary text to be used in an Apache directive.static Stringescape(String dollarVariable, String value, boolean allowVariables)Escapes arbitrary text to be used in an Apache directive.
-
-
-
Field Detail
-
DEFAULT_DOLLAR_VARIABLE
public static final String DEFAULT_DOLLAR_VARIABLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
escape
public static String escape(String dollarVariable, String value)
Escapes arbitrary text to be used in an Apache directive. Adds double quotes as-needed. Please note that '$' is also escaped when found in form${variable}, so this might not be appropriate for${variable}substitutions.Please note, the dollar escaping relies on Apache being configured with
Define <dollarVariable> $, as it is performed with a${dollarVariable}hack.
-
escape
public static String escape(String dollarVariable, String value, boolean allowVariables)
Escapes arbitrary text to be used in an Apache directive. Adds double quotes as-needed. Optionally allowing '$' unescaped.Please note, the dollar escaping relies on Apache being configured with
Define $ $, as it is performed with a${$}hack. This is set in the aoserv-httpd-config package, incore.inc.I am unable to find clear documentation on the full set of rules for escaping Apache directives. I have experimented with various values and techniques to achieve this implementation. It seems there is no useful way to encode completely arbitrary values into directives. Thus, this set of rules may not be optimal (may perform more escaping than necessary) or, even worse, could be incomplete.
- Returns:
- the escaped string or the original string when no escaping required
- See Also:
escape(java.lang.String, java.lang.String)
-
-