org.apache.cocoon.generation
Class GenericProxyGenerator

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.generation.AbstractGenerator
              extended by org.apache.cocoon.generation.ServiceableGenerator
                  extended by org.apache.cocoon.generation.GenericProxyGenerator
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, LogEnabled, Serviceable, Generator, SitemapModelComponent, XMLProducer

public class GenericProxyGenerator
extends ServiceableGenerator

This is a generic HTTP proxy, designed to handle any possible HTTP method, but with a particular bias towards WebDAV. As of now it's pretty unstable, but still it might be a good proof of concept towards a pure HTTP(++) proxy.
TODO: doesn't handle authentication properly
TODO: doesn't handle (and doubt it'll ever will) HTTP/1.1 keep-alive

Version:
$Id: GenericProxyGenerator.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Gianugo Rabellino

Field Summary
 
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
 
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.generation.Generator
ROLE
 
Constructor Summary
GenericProxyGenerator()
           
 
Method Summary
 void dispose()
          Dispose
 void generate()
          Get the request data, pass them on to the forwarder and return the result.
 void service(ServiceManager manager)
          Compose and get a SAX parser for further use.
 void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
          Setup this component by getting the (required) "url" parameter and the (optional) "path" parameter.
 
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Constructor Detail

GenericProxyGenerator

public GenericProxyGenerator()
Method Detail

service

public void service(ServiceManager manager)
             throws ServiceException
Compose and get a SAX parser for further use.

Specified by:
service in interface Serviceable
Overrides:
service in class ServiceableGenerator
Throws:
ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

dispose

public void dispose()
Dispose

Specified by:
dispose in interface Disposable
Overrides:
dispose in class ServiceableGenerator

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws ProcessingException,
                  SAXException,
                  IOException
Setup this component by getting the (required) "url" parameter and the (optional) "path" parameter. If path is not specified, the request URI will be used and forwarded. TODO: handle query string

Specified by:
setup in interface SitemapModelComponent
Overrides:
setup in class AbstractGenerator
Throws:
ProcessingException
SAXException
IOException
See Also:
SitemapModelComponent.setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)

generate

public void generate()
              throws IOException,
                     SAXException,
                     ProcessingException
Get the request data, pass them on to the forwarder and return the result. TODO: much better header handling TODO: handle non XML and bodyless responses (probably needs a smarter Serializer, since some XML has to go through the pipeline anyway.

Throws:
IOException
SAXException
ProcessingException
See Also:
Generator.generate()


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.