13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5.8 Introducing RMI145almost ready to fire our system up and give it a try. But first, we’ll give yousome informati<strong>on</strong> about our sample envir<strong>on</strong>ment and talk very briefly aboutsecurity. 215.8.4.1 What RMI Servers and Clients Need to Be Able to DoRMI servers and clients need to be able to listen for c<strong>on</strong>necti<strong>on</strong>s <strong>on</strong> networkports, and they need to be able to initiate c<strong>on</strong>necti<strong>on</strong>s <strong>on</strong> network ports. Backin the Java 1.1 days, there were no limits <strong>on</strong> what RMI methods could do. TheCLASSPATH was assumed to be trusted. With the RMI 1.2 protocol specificati<strong>on</strong>,the ability to actually pass bytecodes between VMs over RMI was added.That means that it is possible for clients to pass code to servers. Obviously, thisopens a lot of possible security risks. For this reas<strong>on</strong>, RMI got a security managementlayer. It is the same security manager as the <strong>on</strong>e that applets use. Italso provides a default security manager class that has virtually all such capabilitiessafely turned off. We need to turn <strong>on</strong> some of these capabilities in orderto make our sample work.The RMI system expects Java classes to be made available through <strong>on</strong>e oftwo paths.1. The CLASSPATH, either the envir<strong>on</strong>ment variable or <strong>on</strong> the command line.2. Through a property that points at URL. This URL may be a file: URL,or an http: URL.We are going to do the simplest case for now. We will have our compiledcode installed <strong>on</strong> both our server system and our client system. The classes willall be referenced relative to the default classpath (in other words, relative to “.”,the current directory).This is not the typical case. The most comm<strong>on</strong> case will be for theclasses to be available in a JAR file via a Web server, and for thejava.rmi.server.codebase property to be set to point to the JAR file viaan http: URL.21. We’re going to gloss over this subject for now.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!