Java Reference
In-Depth Information
L
ISTING
7.11
Continued
return this;
}
/** Implements the related Deploylet method */
public Deploylet getClient() {
return client;
}
/** Implements the related Deploylet method */
public void setClient(Deploylet d) {
client = d;
7
}
/** Implements the related Deploylet method */
public void setServer(Deploylet d) {
// do nothing
}
/** Implements the related Deploylet method */
public String getName() {
return serverDeployletName;
}
}
Its implementation of the
requestService
method supports only
DebugService
requests (line
100 of Listing 7.11). The method
processDebugService
(beginning at line 110 of Listing
7.11) simply writes the
DebugService
argument on the standard output. In a real-world appli-
cation, it could save its content (that reports an exception fired on the relative client applet) on
a text file for successive use. At line 79 of Listing 7.11, the
serverDeploylet
is dismissed
when the related client-side applet is stopped. In the constructor (lines 21-34 of Listing 7.11),
the newly created
ServerDeploylet
instance is published on the RMI registry with the name
obtained at line 27.
Another important piece in our framework is represented by the servlet that dynamically
responds to Web browser's requests and supplies Plug-In-enabled applets. In Listing 7.12, the
LaunchServlet
class is shown.
L
ISTING
7.12
The
LaunchServlet
Class
package com.marinilli.b2.c7.deploylet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;