public abstract class IlvManagerServletSupport extends IlvServletSupport
<servletpath>request=image &bbox=x,y,width,height (manager coordinate system) &layer=layer1, layer2 &width= resulting image width &height= resulting image height &format=JPEG | PNG [&bgcolor=0xffffff] [&transparent=false]This request returns an image corresponding to the (x,y,width,height) area of the manager.
<servletpath>request=capabilities &format=[json|octect-stream]This request returns informations on the manager.
Capabilities informations are rendered in JSON:
{'minx':0.0,'miny':0.0,'maxx':1024.0,'maxy':512.0, 'themes':['a layer name', 'another one'], 'overviewthemes':[true, false], 'maxZoom':6}Once the HTML page is loaded by the client browser, the JavaScript code is executed. You can then query the JavaScript variables. Since JViews 8.0, zoom levels and dynamic capabilities are also provided.
Modifier and Type | Field and Description |
---|---|
static String |
ImageMapAreaGeneratorProperty
The name of the property that is used during the generation of an image
map.
|
Constructor and Description |
---|
IlvManagerServletSupport(javax.servlet.ServletContext context)
Creates a manager servlet support.
|
Modifier and Type | Method and Description |
---|---|
protected void |
additionalCapabilities(javax.servlet.http.HttpServletRequest request,
PrintWriter out,
String mimeFormat)
Deprecated.
beginning with JViews 8.1 use
getAdditionalCapabilities(HttpServletRequest) instead. |
protected void |
additionalCapabilities(javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletOutputStream out,
String mimeFormat)
Deprecated.
beginning with JViews 8.1 use
getAdditionalCapabilities(HttpServletRequest) instead. |
void |
addServerActionListener(ServerActionListener listener)
Deprecated.
|
void |
addServerActionListener(String actionName,
ServerActionListener listener)
Adds the specified listener to receive events when an action
is requested from the client.
|
protected void |
beforeDraw(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Called before the image is created.
|
protected IlvPopupMenuServletSupport |
createPopupMenuSupport()
Creates a new instance of pop-up menu servlet support.
|
protected IlvSelectionSupport |
createSelectionSupport()
Creates a new instance of selection servlet support.
|
protected void |
encodeImage(BufferedImage image,
OutputStream ostream,
String formatName)
This method performs the encoding of the
BufferedImage using
the given image format. |
protected BufferedImage |
generateImage(javax.servlet.http.HttpServletRequest request,
IlvRect bbox,
int width,
int height,
String[] requestedLayers,
Color bgColor,
boolean transparent)
Generates the image.
|
protected BufferedImage |
generateImageWhenSessionExpired(int width,
int height)
Generates an image that indicates that the session expired.
|
protected Map |
getAdditionalCapabilities(javax.servlet.http.HttpServletRequest request)
Allows you to add more capabilities to the capability request.
|
boolean |
getAntialiasing()
Returns
true if the manager view is antialiased when the image
is generated. |
boolean |
getContentLengthEnable()
Returns
true if the servlet support is bufferized. |
javax.servlet.ServletContext |
getContext()
Returns the servlet context.
|
protected String |
getDefaultImageMapHREF(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Returns the HREF that corresponds to the background of the image map.
|
IlvManagerLayer[] |
getDynamicLayers(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Returns an array of
IlvManagerLayer instances that are known to be dynamic. |
protected long |
getExpirationDate(javax.servlet.http.HttpServletRequest request)
Returns the expiration date, in milliseconds, used by the
setImageResponseCachePolicy(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) method. |
protected Comparator<IlvGraphic> |
getGraphicObjectComparator(IlvManagerLayer layer,
IlvManagerView view,
javax.servlet.http.HttpServletRequest request)
Returns a
Comparator implementation that will be used to
sort the IlvGraphic instances in the given layer that need to
have their image map generated. |
IlvHitmapSupport |
getHitmapSupport()
Returns the hitmap support.
|
protected IlvImageMapAreaGenerator |
getImageMapAreaGenerator(javax.servlet.http.HttpServletRequest request,
IlvGraphic obj,
IlvManagerView view,
IlvTransformer t)
Returns the area generator for the specified graphic object.
|
Object |
getInternalLock(javax.servlet.http.HttpServletRequest request) |
float |
getJPEGQuality()
Returns the quality of the produced JPEG file.
|
protected Object |
getKey(javax.servlet.http.HttpServletRequest request)
Returns the key used to identify a tile managed by the
IlvTileManager . |
IlvManagerLayer[] |
getLayers(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Returns the list of layers that are allowed to be rendered.
|
protected Object |
getLock(javax.servlet.http.HttpServletRequest request)
Returns a locking object that is used to lock the content of the manager
while it is being rendered.
|
protected IlvRect |
getManagerBBox(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Computes the bounding box of the manager.
|
protected Comparator<IlvManagerLayer> |
getManagerLayerComparator(IlvManagerView view,
javax.servlet.http.HttpServletRequest request)
Returns a
Comparator implementation that will be used to
sort the IlvManagerLayer that are used to generate
the image map when requested. |
abstract IlvManagerView |
getManagerView(javax.servlet.http.HttpServletRequest request)
Returns the manager view used for the specified request.
|
protected double |
getMaxZoomLevel(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Returns the maximum zoom level authorized by the servlet.
|
protected double |
getMinZoomLevel(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Returns the minimum zoom level authorized by the servlet.
|
IlvPopupMenuServletSupport |
getPopupMenuSupport()
Returns the pop-up menu servlet support that handles pop-up menu requests.
|
IlvSelectionSupport |
getSelectionSupport()
Returns the servlet support that manages selection requests.
|
protected IlvTileManager |
getTileManager(javax.servlet.http.HttpServletRequest request)
Retrieves the tile manager.
|
double[] |
getZoomLevels(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Returns the zoom levels that a client of this servlet should use to take
advantage of the tiling and caching mechanisms.
|
boolean |
handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Responds to HTTP requests.
|
protected boolean |
isOverviewLayer(javax.servlet.http.HttpServletRequest request,
IlvManagerLayer layer)
Returns
true if the specified layer returned by
getLayers should be displayed in an overview window. |
boolean |
isPopupEnabled()
Returns
true if the servlet is set to handle pop-up menu
requests. |
boolean |
isSelectionEnabled()
Returns
true if the servlet is set to handle selection
requests. |
boolean |
isVerbose()
Returns
true if the servlet is on verbose mode. |
protected void |
prepareManagerView(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Allows you to prepare the manager view content before the image is
generated or the capabilities are computed.
|
void |
removeServerActionListener(ServerActionListener listener)
Deprecated.
|
void |
removeServerActionListener(String actionName,
ServerActionListener listener)
Removes the specified listener so that it no longer receives events
generated from the client.
|
void |
setAntialiasing(boolean value)
Sets the antialiasing of the manager view when the image generated.
|
void |
setContentLengthEnable(boolean value)
Sets the flag that switches the servlet support in a bufferized mode.
|
protected void |
setImageResponseCachePolicy(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sets the response cache policy when generating an image.
|
void |
setJPEGQuality(float quality)
Sets the quality of the produced JPEG file.
|
void |
setPopupEnabled(boolean popupEnabled)
Enables or disables the support of pop-up menu requests.
|
void |
setSelectionEnabled(boolean selectionEnabled)
Enables or disables the support of selection requests.
|
void |
setVerbose(boolean value)
Turns the verbose mode on and off.
|
protected boolean |
shouldGenerateImageMap(javax.servlet.http.HttpServletRequest request,
IlvManagerLayer layer,
IlvManagerView view,
IlvTransformer t)
Returns
true if image map information should be
generated for the specified layer. |
protected boolean |
useTileManager(javax.servlet.http.HttpServletRequest request)
Indicates whether a tile manager should be used by this servlet support.
|
doGetScriptMessage, getParameterValidationListener, getScriptMessageSupport, setParameterValidationListener
public static final String ImageMapAreaGeneratorProperty
IlvImageMapAreaGenerator
,
Constant Field Valuespublic IlvManagerServletSupport(javax.servlet.ServletContext context)
context
- The Servlet Context.public javax.servlet.ServletContext getContext()
getContext
in class IlvServletSupport
null
when there is no servlet
context.public final void setVerbose(boolean value)
value
- The new value for verbose.isVerbose()
public final boolean isVerbose()
true
if the servlet is on verbose mode.setVerbose(boolean)
public void setPopupEnabled(boolean popupEnabled)
This method must be called to support either static or dynamic pop-up menus.
See the user documentation for more details.
popupEnabled
- The new value for pop-up enabled.getPopupMenuSupport()
public final boolean isPopupEnabled()
true
if the servlet is set to handle pop-up menu
requests.setPopupEnabled(boolean)
public final IlvPopupMenuServletSupport getPopupMenuSupport()
If the pop-up menu is dynamic, you must set a menu factory through the
setMenuFactory(IlvMenuFactory)
on the pop-up menu support
returned by this method.
See the user documentation for more details.
null
if
the support for pop-up menu is disabled.setPopupEnabled(boolean)
protected IlvPopupMenuServletSupport createPopupMenuSupport()
public final boolean isSelectionEnabled()
true
if the servlet is set to handle selection
requests.setSelectionEnabled(boolean)
public void setSelectionEnabled(boolean selectionEnabled)
See the user documentation for more details.
isSelectionEnabled()
public final IlvSelectionSupport getSelectionSupport()
null
if the
support for selection is disabled.setSelectionEnabled(boolean)
protected IlvSelectionSupport createSelectionSupport()
This implementation returns null
. Subclasses must override
this method to support selection requests.
public final void setAntialiasing(boolean value)
value
- The new antialising state of the manager view.getAntialiasing()
public final boolean getAntialiasing()
true
if the manager view is antialiased when the image
is generated.
The default value is true.setAntialiasing(boolean)
public final void setContentLengthEnable(boolean value)
value
- The bufferized flag.getContentLengthEnable()
public final boolean getContentLengthEnable()
true
if the servlet support is bufferized.
The default value is false.setContentLengthEnable(boolean)
public final void setJPEGQuality(float quality)
quality
- can be in the [0,1]
range, 0
for
poor quality and high compression, 1
for high
quality and poor compression.
The default value is 0.75
.getJPEGQuality()
public final float getJPEGQuality()
setJPEGQuality(float)
public abstract IlvManagerView getManagerView(javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
request
- The current HTTP request.javax.servlet.ServletException
protected IlvRect getManagerBBox(javax.servlet.http.HttpServletRequest request, IlvManagerView view) throws javax.servlet.ServletException
request
- The current HTTP request.view
- The manager view returned by getManagerView
.javax.servlet.ServletException
protected double getMaxZoomLevel(javax.servlet.http.HttpServletRequest request, IlvManagerView view)
request
- The current HTTP request.view
- The manager view returned by getManagerView
.protected double getMinZoomLevel(javax.servlet.http.HttpServletRequest request, IlvManagerView view)
request
- The current HTTP request.view
- The manager view returned by getManagerView
.public IlvManagerLayer[] getLayers(javax.servlet.http.HttpServletRequest request, IlvManagerView view) throws javax.servlet.ServletException
request
- The current HTTP request.view
- The manager view (returned by getManagerView
).javax.servlet.ServletException
protected boolean isOverviewLayer(javax.servlet.http.HttpServletRequest request, IlvManagerLayer layer)
true
if the specified layer returned by
getLayers
should be displayed in an overview window.
The default implementation always return true
.request
- The current HTTP request.layer
- A manager layer.getLayers(HttpServletRequest, IlvManagerView)
protected Object getLock(javax.servlet.http.HttpServletRequest request)
The default implementation returns an object that identifies the manager
view. This allows the getManagerView
method to always return the same
IlvManagerView
without leading to multithreading problems.
This lock must never be taken on the AWT/Swing thread, otherwise deadlocks may occur.
request
- The current HTTP request.getManagerView(javax.servlet.http.HttpServletRequest)
public Object getInternalLock(javax.servlet.http.HttpServletRequest request)
request
- @Deprecated public final void addServerActionListener(ServerActionListener listener)
IlvView.performAction()
method
is called. This method queries the server for a new image but
additional parameters are sent in the image request so that an action such
as adding, removing or selecting objects can be performed before the image
is generated. An action is defined by a name and a list of parameters. To
implement the action on the client side, you will implement the
ServerActionListener
interface and check the action name and
parameters in the event.listener
- The listener.removeServerActionListener(ilog.views.servlet.ServerActionListener)
public final void addServerActionListener(String actionName, ServerActionListener listener)
IlvView.performAction()
method
is called. This method queries the server for a new image but
additional parameters are sent in the image request so that an action such
as adding, removing or selecting objects can be performed before the image
is generated. An action is defined by a name and a list of parameters. To
implement the action on the client side, you will implement the
ServerActionListener
interface and check the action name and
parameters in the event.actionName
- the action name which is the same name of the client side.listener
- The listener.@Deprecated public final void removeServerActionListener(ServerActionListener listener)
listener
- The listener.addServerActionListener(ilog.views.servlet.ServerActionListener)
public final void removeServerActionListener(String actionName, ServerActionListener listener)
actionName
- The action name.listener
- The listener.addServerActionListener(String actionName, ServerActionListener listener)
protected BufferedImage generateImage(javax.servlet.http.HttpServletRequest request, IlvRect bbox, int width, int height, String[] requestedLayers, Color bgColor, boolean transparent) throws javax.servlet.ServletException
request
- The current HTTP request.bbox
- The area of the manager to draw.width
- The width of the image.height
- The height of the image.requestedLayers
- An array of layer names to draw.bgColor
- The background color of the imagetransparent
- Indicates if the image should be transparent.javax.servlet.ServletException
protected final BufferedImage generateImageWhenSessionExpired(int width, int height)
protected Object getKey(javax.servlet.http.HttpServletRequest request)
IlvTileManager
.
This implementation returns an IlvRect
that identifies the tile.request
- The current HttpServletRequest
.protected boolean useTileManager(javax.servlet.http.HttpServletRequest request)
request
- The current HTTP request.true
if the request contains a parameter with a
'tile' parameter set to true
, otherwise returns false
.protected IlvTileManager getTileManager(javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
null
.
Subclasses must override this method to provide a tile manager.request
- The current HTTP request.IlvTileManager
or null
if no tile
manager was found.javax.servlet.ServletException
protected String getDefaultImageMapHREF(javax.servlet.http.HttpServletRequest request, IlvManagerView view)
null
meaning no HREF.request
- The current HTTP request.view
- The manager view for the specified request.protected Comparator<IlvGraphic> getGraphicObjectComparator(IlvManagerLayer layer, IlvManagerView view, javax.servlet.http.HttpServletRequest request)
Comparator
implementation that will be used to
sort the IlvGraphic
instances in the given layer that need to
have their image map generated.
When used, the Comparator
should yield an ordered collection in
descending order with the IlvGraphic
instances of higher
priority being listed first.
A null
value can be returned to indicate that no sorting needs
to take place.layer
- The layer that contains IlvGraphic
instances
to be potentially sorted.request
- The current HTTP request.view
- The manager view for the specified request.Comparator
that will be used to sort the
IlvGraphic
instances that need to have their
image map generated. Or null
if no sorting
is needed.protected Comparator<IlvManagerLayer> getManagerLayerComparator(IlvManagerView view, javax.servlet.http.HttpServletRequest request)
Comparator
implementation that will be used to
sort the IlvManagerLayer
that are used to generate
the image map when requested.
When used, the Comparator
should yield an ordered collection in
descending order with the IlvManagerLayer
instances of higher
priority being listed first.
A null
value can be returned to indicate that no sorting needs
to take place.request
- The current HTTP request.view
- The manager view for the specified request.Comparator
that will be used to sort the
IlvManagerLayer
that are used to generate the
image map when requested. Or null
if no sorting
is needed.protected IlvImageMapAreaGenerator getImageMapAreaGenerator(javax.servlet.http.HttpServletRequest request, IlvGraphic obj, IlvManagerView view, IlvTransformer t)
request
- The current HTTP request.obj
- The graphic object for which the area will be generated.view
- The manager view for the specified request.t
- The transformer used to draw the view.protected boolean shouldGenerateImageMap(javax.servlet.http.HttpServletRequest request, IlvManagerLayer layer, IlvManagerView view, IlvTransformer t)
true
if image map information should be
generated for the specified layer.request
- The current HTTP request.layer
- The layer.view
- The manager view for the specified request.t
- The transformer used to draw the view.protected void encodeImage(BufferedImage image, OutputStream ostream, String formatName) throws IOException
BufferedImage
using
the given image format. It supports all encoding formats supported by
the javax.imageio
API.
It can be redefined to change the way the encoding is performed.image
- The image to encode.ostream
- The OutputStream
to which the encoded image
must be output.formatName
- a String containing the informal name of the image format.IOException
- If encoding failed.ImageIO
protected void setImageResponseCachePolicy(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
response.setHeader("pragma", "no-cache"); response.setHeader("Cache-Control", "no-cache");If the request is a tile request (containing an attribute named 'tile') whose value is true, an expiration date is set.
request
- The http request.response
- The http response to configure.protected long getExpirationDate(javax.servlet.http.HttpServletRequest request)
setImageResponseCachePolicy(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
method.request
- The current HttpServletRequest.public IlvHitmapSupport getHitmapSupport()
public double[] getZoomLevels(javax.servlet.http.HttpServletRequest request, IlvManagerView view)
null
.request
- The current HTTP request.view
- The view returned by getManagerView()
.null
if no zoom level is
provided.public IlvManagerLayer[] getDynamicLayers(javax.servlet.http.HttpServletRequest request, IlvManagerView view)
IlvManagerLayer
instances that are known to be dynamic.
This implementation returns the layers that have an index greater or equal
to the value returned by IlvManagerView.getTripleBufferedLayerCount()
.
request
- The current HttpServletRequest
.view
- The IlvManagerView
returned by getManagerView()
.IlvManagerView.getTripleBufferedLayerCount()
@Deprecated protected void additionalCapabilities(javax.servlet.http.HttpServletRequest request, PrintWriter out, String mimeFormat)
getAdditionalCapabilities(HttpServletRequest)
instead., 'myprop1' : 'myvalue1', 'myprop2' : 'myvalue2'
request
- The current HTTP request.out
- The PrintWriter stream for writing additional
capabilities.mimeFormat
- since JViews 8.1 always set to "json"@Deprecated protected void additionalCapabilities(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletOutputStream out, String mimeFormat)
getAdditionalCapabilities(HttpServletRequest)
instead., 'myprop1' : 'myvalue1', 'myprop2' : 'myvalue2'
request
- The current HTTP request.out
- The servlet output stream for writing additional
capabilities.mimeFormat
- since JViews 8.1 always set to "json"protected Map getAdditionalCapabilities(javax.servlet.http.HttpServletRequest request)
Map
should contain pairs of propertyName
and propertyValue
for each additional capability.request
- The current HTTP request.null
if none).protected void beforeDraw(javax.servlet.http.HttpServletRequest request, IlvManagerView view) throws javax.servlet.ServletException
request
- The current HTTP request.view
- The manager view returned by getManagerView
.javax.servlet.ServletException
protected void prepareManagerView(javax.servlet.http.HttpServletRequest request, IlvManagerView view) throws javax.servlet.ServletException
request
- The current HTTP request.view
- The manager view returned by getManagerView
.javax.servlet.ServletException
public boolean handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
false
if the request is not a request
recognized by this servlet.handleRequest
in class IlvServletSupport
request
- The current HTTP request.response
- The HTTP response.false
when the request is not recognized by this
servlet.IOException
- The IOException
javax.servlet.ServletException
- The ServletException
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.