Protocols

As well as being able to service http requests, Cocoon uses protocols to retrieve information from other sources. These include the standard protocols like http and file, as well as some special "internal" protocols.

"Internal" protocols

  • context:// - get a resource using the servlet context
  • cocoon:/ - get a pipeline from the current sitemap
  • cocoon:// - get a pipeline using the root sitemap
  • resource:// - get a resource from the context classloader

The cocoon: protocol supports the raw: subprotocol. When the subprotocol is appended, the request parameters of the original request are not forwarded to the internal pipelines.

The standard Java protocols

  • http: - get a resource from a web server
  • ftp: - get a resource from an ftp server
  • file: - get a resource from a file server
  • jar: - get a resource from inside a jar or zip file. JarProtocolExample

See Aggregator for more examples of how these can be used.

NOTE: It's possible to combine protocols and archives in one URI. For example, to get an jar archive via HTTP and to read the zipped picture "mypic.gif", located in "/mydata/pictures", you have to use an URI like this:

  http://localhost/mypictures.jar!/mydata/pictures/mypic.gif

It's important to use the ! after "mypictures.jar" to divide the path of the picture in the jar from the jar itself.

  • No labels