public abstract class IlxWController
extends javax.servlet.http.HttpServlet
implements ilog.webui.dhtml.IlxWConstants
When creating a Web Application using the web components, you must
provide a controller servlet and give its path in the
ilog.webui.dhtml.controller_path context parameter. You will
typically provide this information in the WEB-INF/web.xml
deployment descriptor of your Web Application (see
Servlet 2.2 Specification for
more details on Web Applications and deployment descriptors).
The controller you provide must be a subclass
of IlxWController, namely either the
IlxWDefaultController class or your own subclass.
Here is an example of a controller servlet subclass:
public class MyController extends IlxWController {
public void handleError(HttpRequest req,
HttpResponse resp,
IlxWControllerError error,
String updateRequest) {
resp.sendError(HttpResponse.SC_INTERNAL_SERVER_ERROR,
error.getMessage());
}
}
... and typically, you reference this servlet in your
WEB-INF/web.xml file as follows:
... <context-param> <param-name>ilog.webui.dhtml.controller_path</param-name> <param-value>/servlet/myservlets.MyController</param-value> </context-param> <servlet> <servlet-name>MyController</servlet-name> <servlet-class>myservlets.MyController</servlet-class> </servlet> <servlet-mapping> <servlet-name>MyController</servlet-name> <url-pattern>/servlet/myservlets.MyController</url-pattern> </servlet-mapping> ...
To understand how communication between the client side and the server side of a web component is managed, let's have a look at a scenario of a user interaction. Suppose a user performs an action on a Web browser, for instance, clicks on a link of the Syntactic Editor. When this action is performed, a JavaScript proxy method is called. This method first registers the data representing the modification applied to the component in a queue stored in the JavaScript environment of the client. We call this queue the modified component queue. Next time a request is sent to the controller servlet, the data of the modified component queue will be added to the request and the server-side ,component object will be updated accordingly. In this way, components are synchronized between their client side and their server side.
The major issue on the client side is whether to redisplay the HTML page or not. The JavaScript proxy applies modifications to the HTML page by evaluating the user action. There are three possible conditions that may arise:
XMLHttpRequest ActiveX object. This allows us to implement a smart
redisplaying mechanism, because only the modified parts of the component_self as the target.
After processing the modified component queue, the controller servlet
forwards the request to the
servlet or JSP page that displayed the component which triggered the
action.
In this class, the service() method handles all requests
regardless of their type. Overriding doGet,
doPost, doPut, etc. has no effect.
IlxWComponent,
IlxWPort,
IlxWManager,
Serialized Form| Constructor and Description |
|---|
IlxWController() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
handleError(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
IlxWControllerError error,
java.lang.String requestPath)
Handles the errors thrown by the
service method of this
servlet. |
protected void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Redefines
HttpServlet.service(). |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, serviceprotected void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
java.io.IOException
HttpServlet.service().
You should not have to redefine this method.service in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionjava.io.IOExceptionprotected abstract void handleError(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
IlxWControllerError error,
java.lang.String requestPath)
throws java.io.IOException,
javax.servlet.ServletException
service method of this
servlet.java.io.IOExceptionjavax.servlet.ServletExceptionerror - The controller error object.request - The current request.response - The current response.requestPath - The path of the request that has been called
just before the servlet controller.© Copyright IBM Corp. 1987, 2017