com.google.caja.plugin
Class DataUriFetcher
java.lang.Object
com.google.caja.plugin.DataUriFetcher
- All Implemented Interfaces:
- UriFetcher
public class DataUriFetcher
- extends java.lang.Object
- implements UriFetcher
Supports cross-browser support for fetching content from data uri
- Author:
- Jasvir Nagra
Field Summary |
private java.lang.String |
DATA_URI_DEFAULT_CHARSET
|
private java.util.regex.Pattern |
DATA_URI_RE
From http://tools.ietf.org/html/rfc2397
dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
mediatype := [ type "/" subtype ] *( ";" parameter )
data := *urlchar
parameter := attribute "=" value |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DATA_URI_RE
private final java.util.regex.Pattern DATA_URI_RE
- From http://tools.ietf.org/html/rfc2397
dataurl := "data:" [ mediatype ] [ ";base64" ] "," data
mediatype := [ type "/" subtype ] *( ";" parameter )
data := *urlchar
parameter := attribute "=" value
DATA_URI_DEFAULT_CHARSET
private final java.lang.String DATA_URI_DEFAULT_CHARSET
- See Also:
- Constant Field Values
DataUriFetcher
public DataUriFetcher()
isDataUri
private boolean isDataUri(java.net.URI uri)
charsetFromMime
private java.lang.String charsetFromMime(java.lang.String mime)
fetch
public FetchedData fetch(ExternalReference ref,
java.lang.String mimeType)
throws UriFetcher.UriFetchException
- Description copied from interface:
UriFetcher
- Loads an external resource such as the
src
of a script
tag or a stylesheet.
- Specified by:
fetch
in interface UriFetcher
- Returns:
- non-null resource
- Throws:
UriFetcher.UriFetchException
- if the resource could not be loaded
fetchBinary
public final byte[] fetchBinary(ExternalReference ref,
java.lang.String mimeType)
throws UriFetcher.UriFetchException
- Throws:
UriFetcher.UriFetchException
Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0