Scheduled XAgent - NON SSL


import lotus.domino.AgentBase;

public class JavaAgent extends AgentBase {

	// Change these settings below to your setup as required.
	static final String	targetURL	= "http://URL_OF_YOUR_XPAGE_AND_OPTIONAL_QUERYSTRING";
	static final String	USER_AGENT	= "Mozilla/5.0";

	public void NotesMain() {
		try {
			final URL url = new URL(JavaAgent.targetURL);
			final HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection();

			httpUrlConnection.setRequestProperty("User-Agent", JavaAgent.USER_AGENT);

		} catch (final Exception e) {

Java Agent Code for hitting an XPage via NON-SSL encryption.
Hitting the XPage from a scheduled agent allows us to "trigger" the XAgent code on a scheduled basis.  
Note that for Anonymous ACL to work on the database containing the XAgent XPage, it must be set to at minimum of READER.
Also note that the scheduled agent code must be at minimum of security level 2 (Allow restricted operations), or it will not be able to connect to a URL.

Devin Olson
June 25, 2015 10:38 AM

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.

No comments yetLogin first to comment...