|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet ilog.webui.dhtml.IlxWController
public abstract class IlxWController
The controller servlet for the web components. This servlet manages communication between the client side and the server side of the Web Components.
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 Summary | |
---|---|
IlxWController()
|
Method Summary | |
---|---|
protected abstract void |
handleError(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
IlxWControllerError error,
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() . |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IlxWController()
Method Detail |
---|
protected void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException
HttpServlet.service()
.
You should not have to redefine this method.
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
IOException
protected abstract void handleError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, IlxWControllerError error, String requestPath) throws IOException, javax.servlet.ServletException
service
method of this
servlet.
IOException
javax.servlet.ServletException
error
- 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.
|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |