Executing a web script from standalone Java program
There are different options to invoke a web script from a Java program. Here, we will take a detailed walkthrough of the Apache commons HttpClient API with code snippets to understand how a web script can be executed from the Java program, and will briefly mention some other alternatives that can also be used to invoke web scripts from Java programs.
HttpClient
One way of executing a web script is to invoke web scripts using org.apache.commons.httpclient.HttpClient
API. This class is available in commons-httpclient-3.1.jar
. Executing a web script with HttpClient API also requires commons-logging-*.jar
and commons-codec-*.jar
as supporting JARs. These JARs are available at the tomcat\webapps\alfresco\WEB-INF\lib
location inside your Alfresco installation directory. You will need to include them in the build path for your project. We will try to execute the hello world web script using the HttpClient from a standalone Java program. While using...