Http sink

Attributes

URI:http://www.xmlpipe.org/xpe/sink/http
Type:sink
Namespace:http://www.xml.org/pipe/HTTP
Owner:http://www.xmlpipe.org/xpe

Description

Introduction

This sink models a HTTP response. It uses three different methods of seralisation: xml, html, and xhtml.

The xml method

This mode is activated when the method property of the sink is set to "xml" . In this mode, the sink simply outputs XML as it is.

The html method

In this mode, elements not inside the http://www.xml.org/pipe/HTTP namespace will be seralised as it is. HTML elements will be seralised according to the HTML 4.01 standard. The sink will ignore any elements inside the http://www.xml.org/pipe/HTTP namesapce except the following elements:

Setting response headers


   <h:header  name="{header name}"  value="{header value}"  xmlns:h="http://www.xml.org/pipe/HTTP" />

Note that the name of the element is "header" as opposed to "head" used by the http source. The reason is that the sink is designed to ignore any elements produced by the http source.

Storing cookie


   <h:cookie  name="{cookie name}"  store="{true|false}"  xmlns:h="http://www.xml.org/pipe/HTTP" >
   </h:cookie>

If the store attribute is not set or its value is not true, the cookie element will be simply ignored.

Redirecting URI


   <h:redirect  to="{target uri}"  xmlns:h="http://www.xml.org/pipe/HTTP" >
   </h:redirect>

The redirect element instructs the sink to send a redirect instruction to its client. If you have more than one redirect element, only the first one is effective. It should appear after any cookie and header elements.

Returning HTTP error


   <h:error  code="{http error code}"  xmlns:h="http://www.xml.org/pipe/HTTP" />

You should only have one error element and it should appear after any cookie and header elements.

The xhtml method

Same as the html method except that all html elements will be automatically wrapped inside the XHTML namespace.

Parameters

Parameter nameDescriptionExample
method
Generates HTML, XHTML or XML responses

   <xnode  type="http://www.xmlpipe.org/xpe/sink/http"  xmlns="http://www.xml.org/xml/pipe" >
      <property  name="method"  value="xml" />
   </xnode>
encoding
Encodes the response using the encoding defined

   <xnode  type="http://www.xmlpipe.org/xpe/sink/http"  xmlns="http://www.xml.org/xml/pipe" >
      <property  name="encoding"  value="UTF-8" />
   </xnode>