org.apache.cocoon.portal.reading
Class ProxyReader

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.reading.AbstractReader
          extended by org.apache.cocoon.reading.ServiceableReader
              extended by org.apache.cocoon.portal.reading.ProxyReader
All Implemented Interfaces:
Poolable, Recyclable, Component, LogEnabled, Serviceable, Reader, SitemapModelComponent, SitemapOutputComponent

public class ProxyReader
extends ServiceableReader

This reader is used to retrieve non XML content from external applications routet via the portal site. Requests from external resources are marked with a proxy prefix and have coplet id and portal name attached as request parameters. The portal name and coplet id are used to look up necessary connection data for the external request (like session id, cookies, document base, etc.) from the application coplet instance data.

Version:
CVS $Id: ProxyReader.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Gernot Koller, Friedrich Klenner

Field Summary
protected  CopletInstanceData copletInstanceData
          The coplet instance data
protected  String prefix
          The prefix
protected  Request request
          The origninal HTTP request
protected  Response response
          The HTTP response
 
Fields inherited from class org.apache.cocoon.reading.ServiceableReader
manager
 
Fields inherited from class org.apache.cocoon.reading.AbstractReader
objectModel, out, parameters, resolver, source
 
Fields inherited from interface org.apache.cocoon.reading.Reader
ROLE
 
Constructor Summary
ProxyReader()
           
 
Method Summary
protected  HttpURLConnection connect(Request request, String uri)
          Establish the HttpURLConnection to the given uri.
 void generate()
          Send the request to the external WebServer
 void recycle()
          Recycle the component
protected  void sendData(InputStream in)
          Copy the data to the original response stream
 void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
          Set the SourceResolver the object model Map, the source and sitemap Parameters used to process the request.
 
Methods inherited from class org.apache.cocoon.reading.ServiceableReader
service
 
Methods inherited from class org.apache.cocoon.reading.AbstractReader
getLastModified, getMimeType, setOutputStream, shouldSetContentLength
 
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
 

Field Detail

copletInstanceData

protected CopletInstanceData copletInstanceData
The coplet instance data


response

protected Response response
The HTTP response


request

protected Request request
The origninal HTTP request


prefix

protected String prefix
The prefix

Constructor Detail

ProxyReader

public ProxyReader()
Method Detail

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws ProcessingException,
                  SAXException,
                  IOException
Description copied from class: AbstractReader
Set the SourceResolver the object model Map, the source and sitemap Parameters used to process the request.

Specified by:
setup in interface SitemapModelComponent
Overrides:
setup in class AbstractReader
Throws:
ProcessingException
SAXException
IOException
See Also:
SitemapModelComponent.setup(SourceResolver, Map, String, Parameters)

recycle

public void recycle()
Description copied from class: AbstractReader
Recycle the component

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractReader
See Also:
Recyclable.recycle()

generate

public void generate()
              throws IOException
Send the request to the external WebServer

Throws:
IOException - on any exception that occures
See Also:
Reader.generate()

sendData

protected void sendData(InputStream in)
                 throws IOException
Copy the data to the original response stream

Parameters:
in - the response from external request to read from
Throws:
IOException - on any exception

connect

protected HttpURLConnection connect(Request request,
                                    String uri)
                             throws IOException
Establish the HttpURLConnection to the given uri.

Parameters:
request - the original request
uri - the remote uri
Returns:
the established HttpURLConnection
Throws:
IOException - on any exception


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