com.google.clearsilver.jsilver.functions.html
Class CssUrlValidateFunction

java.lang.Object
  extended by com.google.clearsilver.jsilver.functions.html.BaseUrlValidateFunction
      extended by com.google.clearsilver.jsilver.functions.html.CssUrlValidateFunction
All Implemented Interfaces:
TextFilter

public class CssUrlValidateFunction
extends BaseUrlValidateFunction

Validates that input string is a valid URI. If it is not valid, the string # is returned. If it is valid, the characters [\n\r\\'"()<>*] are URL encoded to ensure the string can be safely inserted in a CSS URL context. In particular:

  1. In an '@import url("URL");' statement
  2. In a CSS property such as 'background: url("URL");'
In both cases, enclosing quotes are optional but parenthesis are not. This filter ensures that the URL cannot exit the parens enclosure, close a STYLE tag or reset the browser's CSS parser (via comments or newlines).

References:

  1. CSS 2.1 URLs: http://www.w3.org/TR/CSS21/syndata.html#url
  2. CSS 1 URLs: http://www.w3.org/TR/REC-CSS1/#url

See Also:
BaseUrlValidateFunction

Constructor Summary
CssUrlValidateFunction()
           
 
Method Summary
protected  void applyEscaping(String in, Appendable out)
          Called by filter after verifying that the input is a valid URI.
 
Methods inherited from class com.google.clearsilver.jsilver.functions.html.BaseUrlValidateFunction
filter, isValidUri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CssUrlValidateFunction

public CssUrlValidateFunction()
Method Detail

applyEscaping

protected void applyEscaping(String in,
                             Appendable out)
                      throws IOException
Description copied from class: BaseUrlValidateFunction
Called by filter after verifying that the input is a valid URI. Should apply any appropriate escaping to the input string.

Specified by:
applyEscaping in class BaseUrlValidateFunction
Throws:
IOException


Copyright © 2010-2012 Google. All Rights Reserved.