Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

More Java Pitfalls Share Reactor - Daconta M,C.

Daconta M,C. More Java Pitfalls Share Reactor - Wiley publishing, 2003. - 476 p.
ISBN: 0-471-23751-5
Download (direct link): morejavapitfallssharereactor2003.pdf
Previous << 1 .. 80 81 82 83 84 85 < 86 > 87 88 89 90 91 92 .. 166 >> Next

07 if (x) javawsInstalled = 1;
08 } else {
09 isIE = "true";
10 }
11
12 function insertLink(url, name) {
13 if (javawsInstalled) {
14 document.write("<a href=" + url + ">" + name + "</a> ’);
15 } else {
16 document.write("Need to install Java Web Start");
17 }
18 }
19 </SCRIPT>
20
21 <SCRIPT LANGUAGE="VBScript">
22 on error resume next
23 If isIE = "true" Then
24 If Not(IsObject(CreateObject("JavaWebStart.IsInstalled"))) 2
Then
25 javawsInstalled = 0
26 Else
27 javawsInstalled = 1
28 End If
29 End If
30 </SCRIPT>
31
Listing 26.2 Script to check for Java Web Start
Figure 26.3 is an example of how the deployment of a Java Web Start application is handled.
So, Java Web Start is really cool and makes great sense as a mechanism for centrally managing cross-platform applications, but there is also a full set of APIs that allow the application developer to control the Java Web Start functionality in his or her application.
When Applets Go Bad 233
Figure 26.3 Java Web Start application deployment.
Here are some examples of the services in the javax.jnlp package:
BasicService. This service provides functionality like AppletContext, which allows the user to do things like kicking off the environments default browser to display a URL.
ClipboardService. This service provides access to the system's clipboard. If the user is operating inside the sandbox, he will be warned about the security risk.
DownloadService. This service manages the downloading and caching of Web Start JAR files.
FileOpenService. Browsers have the functionality in Web pages to allow the user to browse for a file to open. You most often see this in file upload forms. This service does a similar thing even from inside the sandbox.
FileSaveService. This replicates the "Save as" functionality of Web browsers, even within the sandbox.
PersistenceService. This can be thought of like a cookie, which allows certain information to be stored even within the browser security model.
PrintService. This allows the user to print files from the Web Start application, after accepting the Print Service prompt.
Looking at the JNLP API, we note all of these services are defined as interfaces. Listing 26.3, from Sun's documentation (http://java.sun.com/products/javawebstart /1.2/docs/developersguide.html), shows how you can get an object that implements these interfaces and also demonstrates using it for controlling the DownloadService.
234 Item 26
01 import javax.jnlp.*;
02
03
04 DownloadService ds;
05
06 try {
07 ds = 2
(DownloadService)ServiceManager.lookup("javax.jnlp.DownloadService") ;
08 } catch (UnavailableServiceException e) {
09 ds = null;
10 }
11
12 if (ds != null) {
13
14 try {
15 // determine if a particular resource is cached
16 URL url =
17 new 2
URL("http://java.sun.com/products/javawebstart/lib/draw.jar");
18 boolean cached = ds.isResourceCached(url, "1.0");
19 // remove the resource from the cache
20 if (cached) {
21 ds.removeResource(url, "1.0");
22 }
23 // reload the resource into the cache
24 DownloadServiceListener dsl = 2
ds getDefaultProgressWindow();
25 ds.loadResource(url, "1.0", dsl);
26 } catch (Exception e) {
27 e.printStackTrace();
28 }
29 }
30
Listing 26.3 Example using DownloadService
Looking at these services, we see that it begins to look like Java Web Start is a pseudo Web browser. Consider the evolution of applets. Many saw them as the answer to centrally managed applications deployed over HTTP in a Web browser. However, this model of running within the context of a browser became very inconsistent and buggy. Therefore, the answer was to reengineer the entire solution, looking at the disadvantages and determining how to effectively handle this problem. Java Web Start and the Java Native Launching Protocol is the answer to this problem.
Transactional LDAP-Don't Make that Commitment 235
Item 27: Transactional LDAP—Don't Make that Commitment
The advent of distributed Web applications has created new channels for people to perform business transactions and to communicate with one another. These online dealings spawned the need for authentication mechanisms to ensure end users were properly recognized so that they would be privy to proprietary content. Eventually, this led to the creation of profile files that captured user roles inside and outside of an organization so that Web site content could be targeted properly during operations.
The practice of role assignments and efforts to define user communities evolved into a process called personalization. Personalization was predicated on an understanding of a user's preferences and role information. Back-end matching algorithms were developed so that pertinent data could be rendered to users based on their preferences and roles.
Profile data often constituted generic data about users (name, address, phone number), and role information often indicated his or her position inside and outside a corporation. When users did not belong to an organization, they were afforded the status of guest.
Previous << 1 .. 80 81 82 83 84 85 < 86 > 87 88 89 90 91 92 .. 166 >> Next