Http sink

Attributes

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

Description

This sink models a HTTP response. It is mainly used for sending binary data back to a HTTP client.

Returning a resource


   <h:resource  href="{resource uri}"  mime="{mimetype}"  xmlns:h="http://www.xml.org/pipe/HTTP" />

The resource element instructs the sink to stream the resource specified by the href attribute to its client. If the mime attribute is not specified, the sink attempts to guess the mimetype of the resource by looking at the suffix of its filename.

The sink also reacts to 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.

Parameters

Parameter nameDescriptionExample
Content-Type
The mime type of the resource. Automatically set to the value specified by the mime attribute in resource element if not specified. The setting overrides the automatic setting.

   <xnode  type="http://www.xmlpipe.org/xpe/sink/http"  xmlns="http://www.xml.org/xml/pipe" >
      <property  name="Content-Type"  value="application/svg+xml" />
   </xnode>