cogHTTP utilities
TypeJAR
CategoryAPI
Developed by

slauriere

Active Installs9
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

This library eases simple HTTP operations from XWiki scripts, such as downloading a remote page as a string or as a a byte array. It delegates HTTP operations to the org.apache.http package.

Usage

{{velocity}}
## Download a page as text (the endpoint below is fake)
#set ($json = $services.http.getString("https://en.wikipedia.org/wiki/Meteorite?format=json"))
## Download a resource as bytes (e.g. an image, so that it can then get attached to an XWiki page)
#set ($bytes = $services.http.getBytes("https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/Namibie_Hoba_Meteorite_05.JPG/220px-Namibie_Hoba_Meteorite_05.JPG"))
{{/velocity}}

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.contrib:xwiki-http-lib 1.0):

Tags:
    

Get Connected