ilog.views.sdm.servlet
Class IlvSDMServletSupport

java.lang.Object
  extended by ilog.views.servlet.IlvManagerServletSupport
      extended by ilog.views.sdm.servlet.IlvSDMServletSupport
Direct Known Subclasses:
IlvDiagrammerServletSupport

public class IlvSDMServletSupport
extends IlvManagerServletSupport

This class is a helper class for IlvSDMServlet. It adds functionalities to IlvManagerServletSupport that make it possible to implement a ready-to-use servlet based on SDM facilities.

This basic implementation works in two modes:

  1. In monosession mode, only one SDM engine is created for all the sessions connected to this servlet. This mode is appropriate if the SDM engine always displays the same static data.
  2. In multisession mode, a new SDM engine is created for each new session connected to this servlet. You can use this mode if the user is allowed to load a new data file or a different style sheet, or if editing capabilities are provided.

The servlet accepts the following configuration parameters:

Since:
JViews 4.0

Field Summary
 
Fields inherited from class ilog.views.servlet.IlvManagerServletSupport
ImageMapAreaGeneratorProperty
 
Constructor Summary
IlvSDMServletSupport()
          Deprecated. Beginning with ILOG JViews 8.0, use IlvSDMServletSupport(ServletContext) instead.
IlvSDMServletSupport(javax.servlet.ServletContext context)
          Creates a new SDM servlet support instance in mono-session mode.
 
Method Summary
protected  String findFile(String file)
          Finds a data file on the server given a relative URL.
 String getDataURL()
          Returns the URL of the directory where the data files (such as icon files, style sheets, and XML files) are located.
 String getDefaultStyleSheet()
          Returns the default style sheet file.
 String getDefaultXmlFile()
          Returns the default XML data file.
protected  IlvImageMapAreaGenerator getImageMapAreaGenerator()
          Returns the current image map area generator.
 IlvManagerLayer[] getLayers(javax.servlet.http.HttpServletRequest request, IlvManagerView view)
          Returns only the nonempty layers.
protected  Object getLock(javax.servlet.http.HttpServletRequest request)
          Returns a locking object that is used to lock the contents of the manager.
 IlvManagerView getManagerView(javax.servlet.http.HttpServletRequest request)
          Returns the SDM view associated with the request session.
 IlvSDMView getSDMView(javax.servlet.http.HttpServletRequest request)
          Returns the SDM view associated with this servlet.
protected  Object getValue(javax.servlet.http.HttpServletRequest request, String key)
          This method is used to retrieve any data that is used by the implementation of the servlet.
 boolean handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Responds to HTTP requests.
protected  void initSDMView(javax.servlet.http.HttpServletRequest request, IlvSDMView view)
          Initializes the SDM view after it is created for a given session.
 void installImageMapAreaGenerator(IlvSDMView view)
          Installs the image map generator.
 boolean isMultiSession()
          Returns if the servlet is in multisession mode.
protected  void prepareManagerView(javax.servlet.http.HttpServletRequest request, IlvManagerView view)
          This method is overridden to set the reference zoom of the view and to add support for IlvJComponentGraphic objects.
 void setDataURL(String url)
          Sets the URL of a directory where the data files (such as icon files, style sheets, and XML files) are located.
 void setDefaultStyleSheet(String styleSheet)
          Sets the default style sheet file.
 void setDefaultXmlFile(String xmlFile)
          Sets the default XML data file.
 void setMultiSession(boolean multiSession)
          Sets whether the servlet is in multisession mode.
 void setStyleSheet(javax.servlet.http.HttpServletRequest request, String styleSheet)
          Sets the style sheet of the SDM engine.
protected  void setValue(javax.servlet.http.HttpServletRequest request, String key, Object value)
          This method is used to store any data that is used by the implementation of the servlet.
 void setXmlFile(javax.servlet.http.HttpServletRequest request, String xmlFile)
          Loads an XML data file in the SDM engine.
 
Methods inherited from class ilog.views.servlet.IlvManagerServletSupport
additionalCapabilities, addServerActionListener, beforeDraw, createPopupMenuSupport, createSelectionSupport, encodeImage, generateImage, getAdditionalCapabilities, getAntialiasing, getContentLengthEnable, getContext, getDefaultImageMapHREF, getDynamicLayers, getExpirationDate, getGraphicObjectComparator, getImageMapAreaGenerator, getInternalLock, getJPEGQuality, getKey, getManagerBBox, getManagerLayerComparator, getMaxZoomLevel, getMinZoomLevel, getPopupMenuSupport, getSelectionSupport, getTileManager, getZoomLevels, isOverviewLayer, isPopupEnabled, isSelectionEnabled, isVerbose, removeServerActionListener, setAntialiasing, setContentLengthEnable, setImageResponseCachePolicy, setJPEGQuality, setPopupEnabled, setSelectionEnabled, setVerbose, shouldGenerateImageMap, useTileManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvSDMServletSupport

public IlvSDMServletSupport()
Deprecated. Beginning with ILOG JViews 8.0, use IlvSDMServletSupport(ServletContext) instead.

Creates a new SDM servlet support in mono-session mode.


IlvSDMServletSupport

public IlvSDMServletSupport(javax.servlet.ServletContext context)
Creates a new SDM servlet support instance in mono-session mode.

Parameters:
context - The servlet context.
Since:
JViews 7.5
Method Detail

setMultiSession

public void setMultiSession(boolean multiSession)
Sets whether the servlet is in multisession mode. In multisession mode (that is, if the multiSession parameter is true), a new SDM view will be created for each different session connected to this servlet. Otherwise, only one SDM view is created, and it is shared by all sessions.

Parameters:
multiSession - true for multisession mode, and false for monosession mode.

isMultiSession

public boolean isMultiSession()
Returns if the servlet is in multisession mode.

See Also:
setMultiSession(boolean)

setDefaultStyleSheet

public void setDefaultStyleSheet(String styleSheet)
Sets the default style sheet file. This method does not actually change the style sheet of any SDM engine. It is meant to be called from the IlvSDMServlet.init(javax.servlet.ServletConfig) method of the servlet to initialize the default style sheet used to initialize the SDM engine when a new client connects to the servlet.

Parameters:
styleSheet - The new default style sheet file.

getDefaultStyleSheet

public String getDefaultStyleSheet()
Returns the default style sheet file.


setDefaultXmlFile

public void setDefaultXmlFile(String xmlFile)
Sets the default XML data file. This method does not actually change the XML data file displayed by any SDM engine. It is meant to be called from the IlvSDMServlet.init(javax.servlet.ServletConfig) method of the servlet to initialize the default XML file used to initialize the SDM engine when a new client connects to the servlet.

Parameters:
xmlFile - The new default XML data file.

getDefaultXmlFile

public String getDefaultXmlFile()
Returns the default XML data file.


setDataURL

public void setDataURL(String url)
Sets the URL of a directory where the data files (such as icon files, style sheets, and XML files) are located.

Parameters:
url - The URL.

getDataURL

public String getDataURL()
Returns the URL of the directory where the data files (such as icon files, style sheets, and XML files) are located.


getSDMView

public IlvSDMView getSDMView(javax.servlet.http.HttpServletRequest request)
Returns the SDM view associated with this servlet.

Parameters:
request - The request being processed.

initSDMView

protected void initSDMView(javax.servlet.http.HttpServletRequest request,
                           IlvSDMView view)
Initializes the SDM view after it is created for a given session.

The default implementation loads the default CSS and XML files if any.

Parameters:
request - The request being processed.
view - The new SDM view.
Since:
JViews 6.0

getLock

protected Object getLock(javax.servlet.http.HttpServletRequest request)
Returns a locking object that is used to lock the contents of the manager. The default implementation of this method depends on whether the servlet is in monosession or in multisession mode:

Overrides:
getLock in class IlvManagerServletSupport
Parameters:
request - The current HTTP request.
See Also:
setValue(HttpServletRequest, String, Object), getValue(HttpServletRequest, String)

setStyleSheet

public void setStyleSheet(javax.servlet.http.HttpServletRequest request,
                          String styleSheet)
Sets the style sheet of the SDM engine. This method actually changes the style sheet file of the SDM engine associated with the request.

Parameters:
request - The request being processed.
styleSheet - The style sheet file or URL.

setXmlFile

public void setXmlFile(javax.servlet.http.HttpServletRequest request,
                       String xmlFile)
Loads an XML data file in the SDM engine. This method actually changes the XML data file of the SDM engine associated with the request.

Parameters:
request - The request being processed.
xmlFile - The name or URL of the XML file containing the data.

handleRequest

public boolean handleRequest(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws IOException,
                             javax.servlet.ServletException
Responds to HTTP requests. This method responds to image or capabilities requests. It returns false if the request is not a request recognized by this servlet.

Overrides:
handleRequest in class IlvManagerServletSupport
Parameters:
request - The current HTTP request.
response - The HTTP response.
Returns:
false when the request is not recognized by this servlet.
Throws:
IOException
javax.servlet.ServletException

getLayers

public IlvManagerLayer[] getLayers(javax.servlet.http.HttpServletRequest request,
                                   IlvManagerView view)
Returns only the nonempty layers.

Overrides:
getLayers in class IlvManagerServletSupport
Parameters:
request - The current HTTP request.
view - The manager view.

getManagerView

public IlvManagerView getManagerView(javax.servlet.http.HttpServletRequest request)
                              throws javax.servlet.ServletException
Returns the SDM view associated with the request session.

Specified by:
getManagerView in class IlvManagerServletSupport
Parameters:
request - The current HTTP request.
Throws:
javax.servlet.ServletException

prepareManagerView

protected void prepareManagerView(javax.servlet.http.HttpServletRequest request,
                                  IlvManagerView view)
                           throws javax.servlet.ServletException
This method is overridden to set the reference zoom of the view and to add support for IlvJComponentGraphic objects.

Overrides:
prepareManagerView in class IlvManagerServletSupport
Parameters:
request - The current HTTP request.
view - The manager view.
Throws:
javax.servlet.ServletException

getValue

protected Object getValue(javax.servlet.http.HttpServletRequest request,
                          String key)
This method is used to retrieve any data that is used by the implementation of the servlet. The default implementation of this method depends on whether the servlet is in monosession or in multisession mode:

If you want to implement another strategy to allocate views to sessions, you need to override this method and the setValue(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.Object) method.

Parameters:
request - The current HTTP request.
key - The key.

setValue

protected void setValue(javax.servlet.http.HttpServletRequest request,
                        String key,
                        Object value)
This method is used to store any data that is used by the implementation of the servlet. The default implementation of this method depends on whether the servlet is in monosession or in multisession mode:

If you want to implement another strategy to allocate views to sessions, you need to override this method and the getValue(javax.servlet.http.HttpServletRequest, java.lang.String) method.

Parameters:
request - The current HTTP request.
key - The key.
value - The value.

findFile

protected String findFile(String file)
Finds a data file on the server given a relative URL.

This method uses the base URL specified by setDataURL(java.lang.String) to find data files on the server.

Parameters:
file - The relative URL of the file to find on the server.
Returns:
The absolute URL of the file, or null if the file could not be found.
Since:
JViews 6.0

installImageMapAreaGenerator

public void installImageMapAreaGenerator(IlvSDMView view)
Installs the image map generator.

Parameters:
view - The SDM view.
Since:
JViews 5.5

getImageMapAreaGenerator

protected IlvImageMapAreaGenerator getImageMapAreaGenerator()
Returns the current image map area generator. This method is useful to be overridden if another image map generator is used.

Since:
JViews 5.5


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.