cURL execution from Java program

cURL is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNETand TFTP). The command is designed to work without user interaction.

With AEM, you can use cURL commands to modify repository, download json, access OSGi information etc.

Snippet to download a json file via cURL:

While majority of the AEM’s content information can be downloaded via HTTP connection,  cURL command can be used to download information from AEM’s OSGi console.

In the shared example, we have used cURL to get information about all the bundles installed in AEM.

Snippet to execute a cURL command:

The follwoing snippet contains acURL command that has been converted in a format to be used in Java snippet.

The cURL command used here is meant to lock page “/content/geometrixx/en/toolbar/contacts” :

curl -u admin:admin -X POST -F cmd=”lockPage” -F path=”/content/geometrixx/en/toolbar/contacts” -F “_charset_”=”utf-8” http://localhost:4502/bin/wcmcommand

For more samples of cURL commands, please refer to:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s