com.google.caja.service
Class CajolingService

java.lang.Object
  extended by com.google.caja.service.CajolingService

public class CajolingService
extends java.lang.Object

A cajoling service which proxies connections:

Author:
jasvir@gmail.com (Jasvir Nagra)

Nested Class Summary
static class CajolingService.Directive
           
static class CajolingService.Transform
           
 
Field Summary
(package private) static java.lang.String DEFAULT_HOST
           
private  java.util.List<ContentHandler> handlers
           
private  java.lang.String host
           
private  ContentTypeCheck typeCheck
           
private  UriFetcher uriFetcher
           
 
Constructor Summary
CajolingService()
           
CajolingService(BuildInfo buildInfo)
           
CajolingService(BuildInfo buildInfo, java.lang.String host)
           
CajolingService(BuildInfo buildInfo, java.lang.String host, UriFetcher fetcher)
           
 
Method Summary
private  Pair<java.lang.String,java.lang.String> applyHandler(java.net.URI uri, CajolingService.Transform t, java.util.List<CajolingService.Directive> d, ContentHandlerArgs args, java.lang.String inputContentType, FetchedData input, java.io.OutputStream response, MessageQueue mq)
           
 FetchedData handle(FetchedData inputFetchedData, ContentHandlerArgs args, MessageQueue mq)
          Main entry point for the cajoling service.
private  void registerHandlers(BuildInfo buildInfo)
           
static java.lang.String render(MessageQueue mq)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HOST

static final java.lang.String DEFAULT_HOST
See Also:
Constant Field Values

handlers

private final java.util.List<ContentHandler> handlers

typeCheck

private final ContentTypeCheck typeCheck

host

private final java.lang.String host

uriFetcher

private final UriFetcher uriFetcher
Constructor Detail

CajolingService

public CajolingService()

CajolingService

public CajolingService(BuildInfo buildInfo)

CajolingService

public CajolingService(BuildInfo buildInfo,
                       java.lang.String host)

CajolingService

public CajolingService(BuildInfo buildInfo,
                       java.lang.String host,
                       UriFetcher fetcher)
Method Detail

handle

public FetchedData handle(FetchedData inputFetchedData,
                          ContentHandlerArgs args,
                          MessageQueue mq)
Main entry point for the cajoling service.

Parameters:
inputFetchedData - the input content. If this is null, the service will attempt to fetch the content from the location given by the CajaArguments.URL parameter.
args - a set of arguments to the cajoling service.
mq - a message queue into which status and error messages will be placed. The caller should query for the most severe status of the messages in this queue to determine the overall success of the invocation.
Returns:
the output content, or null if a serious error occurred that prevented the content from being generated.

render

public static java.lang.String render(MessageQueue mq)

registerHandlers

private void registerHandlers(BuildInfo buildInfo)

applyHandler

private Pair<java.lang.String,java.lang.String> applyHandler(java.net.URI uri,
                                                             CajolingService.Transform t,
                                                             java.util.List<CajolingService.Directive> d,
                                                             ContentHandlerArgs args,
                                                             java.lang.String inputContentType,
                                                             FetchedData input,
                                                             java.io.OutputStream response,
                                                             MessageQueue mq)
                                                      throws UnsupportedContentTypeException
Throws:
UnsupportedContentTypeException


Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0