|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.cocoon.xml.AbstractXMLProducer org.apache.cocoon.xml.AbstractXMLPipe org.apache.cocoon.transformation.AbstractTransformer org.apache.cocoon.portal.transformation.ProxyTransformer
public class ProxyTransformer
This transformer is used to insert the XHTML data from an request to an external application at the specified element ("envelope-tag" parameter). Nesessary connection data for the external request like sessionid, cookies, documentbase, the uri, etc. will be taken from the application coplet instance data.
Field Summary | |
---|---|
protected int |
configuredEncoding
The encoding (JTidy constant) if configured |
static String |
COOKIE
|
static String |
COPLET_ID_PARAM
|
static String |
COPLETID
|
protected CopletInstanceData |
copletInstanceData
The coplet instance data |
protected String |
defaultEnvelopeTag
The default value for the envelope Tag |
static String |
DOCUMENT_BASE
|
protected String |
documentBase
The document base uri |
static String |
ENVELOPE_TAG_PARAMETER
Parameter for specifying the envelope tag |
protected String |
envelopeTag
This tag will include the external XHMTL |
protected InputModuleHelper |
imHelper
Helper for resolving input modules. |
protected String |
link
The current link to the external application |
static String |
LINK
|
protected ServiceManager |
manager
The Avalon component manager |
protected Parameters |
parameters
The sitemap parameters |
static String |
PORTAL_NAME_PARAM
|
static String |
PORTALNAME
|
static String |
PROTOCOL_HANDLER_PARAMETER
Parameter for specifying the java protocol handler (used for https) |
static String |
PROXY_PREFIX
|
protected Request |
request
The original request to the portal |
static String |
SESSIONTOKEN
|
static String |
START_URI
|
protected String |
userAgent
The user agent identification string if confiugured |
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
---|
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer |
Fields inherited from interface org.apache.cocoon.transformation.Transformer |
---|
ROLE |
Constructor Summary | |
---|---|
ProxyTransformer()
|
Method Summary | |
---|---|
protected boolean |
appendParameter(StringBuffer buffer,
boolean firstparameter,
boolean post,
String name,
String value)
|
protected String |
checkForRedirect(Document doc,
String documentBase)
Analyses the XHTML response document for redirects in <meta http-equiv="refresh"> elements. |
protected String |
checkForRedirect(HttpURLConnection connection,
String documentBase)
Check the http status code of the http response to detect any redirects. |
protected HttpURLConnection |
connect(Request request,
String uri,
String query,
boolean post)
Establish the HttpURLConnection to the given uri. |
void |
dispose()
|
static CopletInstanceData |
getInstanceData(ServiceManager manager,
Map objectModel,
Parameters parameters)
Method getInstanceData. |
static CopletInstanceData |
getInstanceData(ServiceManager manager,
String copletID,
String portalName)
|
void |
parameterize(Parameters parameters)
For the proxy transformer the envelope-tag parameter can be specified. |
protected void |
processRequest()
Processes the request to the external application |
protected Document |
readXML(HttpURLConnection connection)
Reads the HTML document from given connection and returns a correct W3C DOM XHTML document |
void |
recycle()
Recycle the producer by removing references, and resetting handlers to null (empty) implementations. |
static String |
resolveURI(String uri,
String documentBase)
Resolve the possibly relative uri to an absolue uri based on given document base. |
void |
service(ServiceManager manager)
|
void |
setup(SourceResolver resolver,
Map objectModel,
String src,
Parameters parameters)
Set the SourceResolver , objectModel Map ,
the source and sitemap Parameters used to process the request. |
void |
startElement(String uri,
String name,
String raw,
Attributes attributes)
Receive notification of the beginning of an element. |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe |
---|
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping |
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.xml.sax.ContentHandler |
---|
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping |
Methods inherited from interface org.xml.sax.ext.LexicalHandler |
---|
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity |
Methods inherited from interface org.apache.cocoon.xml.XMLProducer |
---|
setConsumer |
Field Detail |
---|
public static final String ENVELOPE_TAG_PARAMETER
public static final String PORTALNAME
public static final String COPLETID
public static final String PROXY_PREFIX
public static final String COPLET_ID_PARAM
public static final String PORTAL_NAME_PARAM
public static final String SESSIONTOKEN
public static final String COOKIE
public static final String START_URI
public static final String LINK
public static final String DOCUMENT_BASE
public static final String PROTOCOL_HANDLER_PARAMETER
protected String documentBase
protected String link
protected String defaultEnvelopeTag
protected String envelopeTag
protected ServiceManager manager
protected CopletInstanceData copletInstanceData
protected Request request
protected int configuredEncoding
protected String userAgent
protected Parameters parameters
protected InputModuleHelper imHelper
Constructor Detail |
---|
public ProxyTransformer()
Method Detail |
---|
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)
public void dispose()
dispose
in interface Disposable
Disposable.dispose()
public void parameterize(Parameters parameters)
parameterize
in interface Parameterizable
Parameterizable.parameterize(Parameters)
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws ProcessingException, SAXException, IOException
SitemapModelComponent
SourceResolver
, objectModel Map
,
the source and sitemap Parameters
used to process the request.
setup
in interface SitemapModelComponent
ProcessingException
SAXException
IOException
SitemapModelComponent.setup(SourceResolver, Map, String, Parameters)
public void recycle()
AbstractXMLProducer
recycle
in interface Recyclable
recycle
in class AbstractXMLProducer
Recyclable.recycle()
public void startElement(String uri, String name, String raw, Attributes attributes) throws SAXException
AbstractXMLPipe
startElement
in interface ContentHandler
startElement
in class AbstractXMLPipe
uri
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace
processing is not being performed.name
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.raw
- The raw XML 1.0 name (with prefix), or the empty string if
raw names are not available.attributes
- The attributes attached to the element. If there are no
attributes, it shall be an empty Attributes object.
SAXException
ContentHandler.startElement(String, String, String, Attributes)
protected void processRequest() throws SAXException
SAXException
protected boolean appendParameter(StringBuffer buffer, boolean firstparameter, boolean post, String name, String value) throws UnsupportedEncodingException
UnsupportedEncodingException
protected String checkForRedirect(HttpURLConnection connection, String documentBase) throws IOException
connection
- The HttpURLConnectiondocumentBase
- The current documentBase (needed for relative redirects)
IOException
- if exceptions occure while analysing the responseprotected String checkForRedirect(Document doc, String documentBase) throws MalformedURLException
doc
- The W3C DOM document containing the XHTML responsedocumentBase
- The current document base (needed for relative redirects)
MalformedURLException
- if the redirect uri is malformed.protected Document readXML(HttpURLConnection connection) throws SAXException
connection
- hte HttpURLConnection to read from
SAXException
protected HttpURLConnection connect(Request request, String uri, String query, boolean post) throws IOException
request
- the original requesturi
- the remote uriquery
- the remote query stringpost
- true if request method was POST
IOException
- on any exceptionpublic static String resolveURI(String uri, String documentBase) throws MalformedURLException
uri
- the uri to resolvedocumentBase
- the current document base
MalformedURLException
- if uri or document base is malformed.public static CopletInstanceData getInstanceData(ServiceManager manager, String copletID, String portalName) throws ProcessingException
ProcessingException
public static CopletInstanceData getInstanceData(ServiceManager manager, Map objectModel, Parameters parameters) throws ProcessingException
manager
- objectModel
- parameters
-
ProcessingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |