Skip to main content link. Accesskey S
  • Anonymous
  • Log on
  • Help
  • IBM logo
  • Lotus Expeditor wiki
  • All Wikis
  • Home
  • Community Articles
  • Product Documentation
  • Learning Center


Search

Advanced Search

Categories

Tag Cloud

  • 6.2.1
  • 6.2.2
  • 6.2.3
  • access services
  • accounts
  • administer
  • application
  • applications
  • broker
  • client
  • client for desktop
  • client management
  • cluster
  • collecting data
  • configuration
  • configure
  • data integrity check tools
  • database
  • db2
  • db2e
  • deleting log entries automatically
  • demo
  • demonstration
  • desktop overview
  • develop
  • device
  • device client
  • diagnosis of problems. See troubleshooting
  • diagnostic data
  • diagnostic tool
  • documentation
  • download
  • environment variables
  • error messages
  • expeditor
  • expeditor server
  • expeditor toolkit
  • files
  • fix pack
  • gettingstarted
  • Help
  • how-to
  • IBM Support
  • install
  • installation
  • integration
  • integrator
  • interaction services
  • Interrogation Windows Tab
  • introduce
  • introduction
  • log files
  • messaging
  • micro
  • mobile databases
  • mobile databases
  • mobile devices
  • mqe
  • nci
  • notes
  • OpenSpan
  • OpenSpan Scripting Container
  • OpenSpan Windows Container
  • overview
  • platform
  • portlet
  • prerequisites
  • presentation
  • problems with synchronization. See troubleshooting.
  • purging log entries automatically
  • Release Notes
  • replication
  • resources on the Web
  • rich client application
  • samples
  • scripts
  • security
  • server
  • software
  • software prerequisites
  • support
  • support troubleshooting
  • Sync Client
  • Sync Server
  • synchronization
  • synchronization problems
  • tool
  • toolkit
  • tools
  • trace files
  • trace level
  • troubleshoot
  • troubleshooting
  • tutorial
  • use
  • was
  • web services
  • What's New
  • xcm
  • xpdt
InformationInformation
You are currently viewing machine translated content. IBM translation might be available. Click IBM Translated Product Documentation to see what is available.X


Home > Expeditor Client for Desktop > Sample: HTTP Communication
Rate this article 1 starRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Sample: HTTP Communication 

expanded Abstract
collapsed Abstract
No abstract provided.
ShowTable of Contents
HideTable of Contents
  • 1 Overview
  • 2 URL Connections

Overview


The enhanced HTTP client in Expeditor allows developers to quickly create code that requests data from remote servers over HTTP or HTTPS. The enhanced client wraps the standard Java URLConnectionclasses such that authenticated requests leverage the Accounts framework and HTTPS requests provide a dialog to accept server certificates.

URL Connections


The following code very simply demonstrates the process of creating both HTTP and HTTPS connections and printing the returned content. To access authenticated content, simply create an account with a server value similar to those provided in the sample. By doing so, any requests made using the URLConnection classes will consult the Accounts framework to provide credentials along with the request. Again, the plugin's Activator class is used to start the code.

 public void start(BundleContext context) throws Exception {
	super.start(context);
	plugin = this;

	// two URLs to a web service running on WebSphere
	String HTTP_URL = "http://dpi-portvm.atlanta.ibm.com:10000/com.ibm.rcp.support.ws.remote/services/RemoteSystem";
	String HTTPS_URL = "https://dpi-portvm.atlanta.ibm.com:10002/com.ibm.rcp.support.ws.remote/services/RemoteSystem";

	URL httpUrl = new URL(HTTP_URL);
	URL httpsUrl = new URL(HTTPS_URL);

	// create HTTP and HTTPS connections
	HttpURLConnection httpConn = (HttpURLConnection) httpUrl
			.openConnection();
	HttpsURLConnection httpsConn = (HttpsURLConnection) httpsUrl
			.openConnection();

	URLConnection conns[] = { httpConn, httpsConn };

	// iterate over the connections and print the received content
	for (URLConnection conn : conns) {
		InputStream in = null;
		try {
			in = conn.getInputStream();

			BufferedReader br = new BufferedReader(
					new InputStreamReader(in));

			String line = null;
			while ((line = br.readLine()) != null) {
				System.out.println(line);
			}
		} finally {
			if (in != null) {
				in.close();
			}
		}
	}
}


expanded Article information
collapsed Article information
Category:
Expeditor Client for Desktop
Tags:
samples

This Version: Version 2 May 4, 2011 11:39:29 AM by Van Staub  IBMer

expanded Attachments (0)
collapsed Attachments (0)

 


expanded Versions (2)
collapsed Versions (2)
Version Comparison     
Version Date Changed by               Summary of changes
This version (2) May 4, 2011 11:39:29 AM Van Staub  
1 May 4, 2011 11:23:05 AM Van Staub  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedSubscribe to RSSHelpAbout
  • All Lotus and WebSphere Portal wikis
  • IBM developerWorks
  • IBM Software support
  • IBM Social Business User Experience Blog
  • IBMSocialBizUX on Twitter
  • IBMSocialBizUX on Facebook
  • Lotus product forums
  • IBM Social Business UX blog
  • IBM Collaboration Solutions
  • Recently added feedRecently added
  • Recently edited feedRecently edited
  • Recently added comments feedRecently Added Comments
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Contact IBM
  • IBM Terms of use
  • Wiki terms of use