org.apache.shindig.gadgets.rewrite
Class CssResponseRewriter

java.lang.Object
  extended by org.apache.shindig.gadgets.rewrite.CssResponseRewriter
All Implemented Interfaces:
ResponseRewriter

public class CssResponseRewriter
extends Object
implements ResponseRewriter

Rewrite links to referenced content in a stylesheet

Since:
2.0.0

Nested Class Summary
static class CssResponseRewriter.UriMaker
           
 
Constructor Summary
CssResponseRewriter(CajaCssParser cssParser, ProxyUriManager proxyUriManager, ContentRewriterFeature.Factory rewriterFeatureFactory)
           
 
Method Summary
static List<String> rewrite(com.google.caja.parser.css.CssTree.StyleSheet styleSheet, Uri source, CssResponseRewriter.UriMaker uriMaker, boolean extractImports, GadgetContext gadgetContext)
          Rewrite the CSS DOM in place.
 List<String> rewrite(Element styleNode, Uri source, CssResponseRewriter.UriMaker uriMaker, boolean extractImports, GadgetContext gadgetContext)
          Rewrite the CSS content in a style DOM node.
 void rewrite(HttpRequest request, HttpResponseBuilder original)
           
 List<String> rewrite(Reader content, Uri source, CssResponseRewriter.UriMaker uriMaker, Writer writer, boolean extractImports, GadgetContext gadgetContext)
          Rewrite the given CSS content and optionally extract the import references.
static CssResponseRewriter.UriMaker uriMaker(ProxyUriManager wrapped, ContentRewriterFeature.Config config)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CssResponseRewriter

@Inject
public CssResponseRewriter(CajaCssParser cssParser,
                                  ProxyUriManager proxyUriManager,
                                  ContentRewriterFeature.Factory rewriterFeatureFactory)
Method Detail

rewrite

public void rewrite(HttpRequest request,
                    HttpResponseBuilder original)
             throws RewritingException
Specified by:
rewrite in interface ResponseRewriter
Throws:
RewritingException

rewrite

public List<String> rewrite(Reader content,
                            Uri source,
                            CssResponseRewriter.UriMaker uriMaker,
                            Writer writer,
                            boolean extractImports,
                            GadgetContext gadgetContext)
                     throws RewritingException
Rewrite the given CSS content and optionally extract the import references.

Parameters:
content - CSS content
source - Uri of content
uriMaker - a Uri Maker
writer - Output
extractImports - If true remove the import statements from the output and return their referenced URIs.
gadgetContext - The gadgetContext
Returns:
Empty list of extracted import URIs.
Throws:
RewritingException

rewrite

public List<String> rewrite(Element styleNode,
                            Uri source,
                            CssResponseRewriter.UriMaker uriMaker,
                            boolean extractImports,
                            GadgetContext gadgetContext)
                     throws RewritingException
Rewrite the CSS content in a style DOM node.

Parameters:
styleNode - Rewrite the CSS content of this node
source - Uri of content
uriMaker - a UriMaker
extractImports - If true remove the import statements from the output and return their referenced URIs.
gadgetContext - The gadgetContext
Returns:
Empty list of extracted import URIs.
Throws:
RewritingException

rewrite

public static List<String> rewrite(com.google.caja.parser.css.CssTree.StyleSheet styleSheet,
                                   Uri source,
                                   CssResponseRewriter.UriMaker uriMaker,
                                   boolean extractImports,
                                   GadgetContext gadgetContext)
Rewrite the CSS DOM in place.

Parameters:
styleSheet - To rewrite
source - Uri of content
uriMaker - a UriMaker
extractImports - If true remove the import statements from the output and return their referenced URIs.
Returns:
Empty list of extracted import URIs.

uriMaker

public static CssResponseRewriter.UriMaker uriMaker(ProxyUriManager wrapped,
                                                    ContentRewriterFeature.Config config)


Copyright © 2007-2012. All Rights Reserved.