com.google.caja.service
Class InnocentHandler
java.lang.Object
com.google.caja.service.AbstractCajolingHandler
com.google.caja.service.InnocentHandler
- All Implemented Interfaces:
- ContentHandler
public class InnocentHandler
- extends AbstractCajolingHandler
Retrieves javascript 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 . |
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 void |
innocentJs(java.net.URI inputUri,
CharProducer cp,
java.lang.Appendable output,
java.lang.String jsonpCallback,
MessageQueue mq)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InnocentHandler
public InnocentHandler(BuildInfo buildInfo)
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
innocentJs
private void innocentJs(java.net.URI inputUri,
CharProducer cp,
java.lang.Appendable output,
java.lang.String jsonpCallback,
MessageQueue mq)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0