com.google.caja.service
Class HtmlHandler
java.lang.Object
com.google.caja.service.AbstractCajolingHandler
com.google.caja.service.HtmlHandler
- All Implemented Interfaces:
- ContentHandler
public class HtmlHandler
- extends AbstractCajolingHandler
Retrieves html files and cajoles them
- Author:
- jasvir@google.com (Jasvir Nagra)
Method Summary |
Pair<java.lang.String,java.lang.String> |
apply(java.net.URI uri,
CajolingService.Transform transform,
java.util.List<CajolingService.Directive> directives,
ContentHandlerArgs args,
java.lang.String inputContentType,
ContentTypeCheck checker,
FetchedData input,
java.io.OutputStream response,
MessageQueue mq)
Reads content from stream and writes it to response . |
private void |
cajoleHtml(java.net.URI inputUri,
CharProducer cp,
PluginMeta meta,
java.lang.String jsonpCallback,
boolean htmlInline,
java.lang.Appendable output,
MessageQueue mq)
|
boolean |
canHandle(java.net.URI uri,
CajolingService.Transform transform,
java.util.List<CajolingService.Directive> directives,
java.lang.String inputContentType,
ContentTypeCheck checker)
Returns if this content handler can check the given uri and ensure it has
the correct contentType . |
private static boolean |
hasParameter(java.lang.String query,
java.lang.String param)
|
boolean |
sandboxLinksAndImages(java.net.URI inputUri)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HtmlHandler
public HtmlHandler(BuildInfo buildInfo,
java.lang.String hostedService,
UriFetcher uriFetcher)
canHandle
public boolean canHandle(java.net.URI uri,
CajolingService.Transform transform,
java.util.List<CajolingService.Directive> directives,
java.lang.String inputContentType,
ContentTypeCheck checker)
- Description copied from interface:
ContentHandler
- Returns if this content handler can check the given
uri
and ensure it has
the correct contentType
. Testing contentType
equality is done using
checker
- Specified by:
canHandle
in interface ContentHandler
- Specified by:
canHandle
in class AbstractCajolingHandler
- Parameters:
uri
- URI of contenttransform
- Type of rewriting to performinputContentType
- The actual input content-typechecker
- Used to check whether two content-types are compatible
- Returns:
- true if this content-handler is appropriate for this URL and content-type
apply
public Pair<java.lang.String,java.lang.String> apply(java.net.URI uri,
CajolingService.Transform transform,
java.util.List<CajolingService.Directive> directives,
ContentHandlerArgs args,
java.lang.String inputContentType,
ContentTypeCheck checker,
FetchedData input,
java.io.OutputStream response,
MessageQueue mq)
throws UnsupportedContentTypeException
- Description copied from interface:
ContentHandler
- Reads content from
stream
and writes it to response
.
Checks to ensure that content has type compatible with contentType
if fetched from uri
- Specified by:
apply
in interface ContentHandler
- Specified by:
apply
in class AbstractCajolingHandler
- Parameters:
uri
- URI of contenttransform
- Type of rewriting to performargs
- Handler-specific argumentsinputContentType
- The actual input content-typechecker
- Used to check whether two content-types are compatibleinput
- content from uriresponse
- writes modified content to usermq
- receives status and error messages
- Returns:
- the content-type and content-encoding of the resulting output
- Throws:
UnsupportedContentTypeException
cajoleHtml
private void cajoleHtml(java.net.URI inputUri,
CharProducer cp,
PluginMeta meta,
java.lang.String jsonpCallback,
boolean htmlInline,
java.lang.Appendable output,
MessageQueue mq)
sandboxLinksAndImages
public boolean sandboxLinksAndImages(java.net.URI inputUri)
hasParameter
private static boolean hasParameter(java.lang.String query,
java.lang.String param)
Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0