|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
ilog.views.servlet.IlvManagerServlet
public abstract class IlvManagerServlet
An abstract servlet that can respond to HTTP request to
generate a JPEG image from a JViews manager.
This servlet can be used with the
JViews thin client library (see : ilog.views.thinclient) or
with the JViews thin client DHTML scripts.
The servlet supports two types of request.
The request for the image:
<servletpath>?request=image
&bbox=x,y,width,height (manager coordinate system)
&layer=layer1, layer2
&width= resulting image width
&height= resulting image height
&format=JPEG
[&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 information on the manager.
It can be of two different formats:
<html> <head> <script language="JavaScript"> var minx=0.0; var miny=0.0; var maxx=1024.0; var maxy=512.0; var themes=new Array(); var overviewthemes=new Array(); themes[0]="a layer name"; overviewthemes[0]=true; themes[1]="another layer"; overviewthemes[1]=true; themes[2]="a third layer"; overviewthemes[2]=true; var maxZoom=6; </script> </head> </body> </html>Once the HTML page is loaded by the client browser, the JavaScript code is executed. You can then query the JavaScript variables.
java.io.DataOutput
and is organized like this:
Float: Left coordinate of manager's bounding box. Float: Top coordinate of manager's bounding box. Float: Right coordinate of manager's bounding box. Float: Bottom coordinate of manager's bounding box. Int: Number of layers. For each layer: String (UTF format): Name of the layer. Boolean: Whether or not the layer is an overview layer. Float: Maximum zoom level
| Field Summary | |
|---|---|
static String |
ImageMapAreaGeneratorProperty
The name of the property that is used during the generation of an image map. |
| Constructor Summary | |
|---|---|
IlvManagerServlet()
Creates a IlvManagerServlet. |
|
IlvManagerServlet(IlvManagerServletSupport support)
Deprecated. Beginning with JViews 8.1 use a subclass and redefine createServletSupport(ServletContext) instead. |
|
| Method Summary | |
|---|---|
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)
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 IlvManagerServletSupport |
createServletSupport(javax.servlet.ServletContext context)
Returns a new instance of IlvManagerServletSupport. |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Responds to the servlet request. |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Responds to the servlet request. |
protected BufferedImage |
generateImage(javax.servlet.http.HttpServletRequest request,
IlvRect bbox,
int width,
int height,
String[] requestedLayers,
Color bgColor,
boolean transparent)
Generates the image. |
protected Map |
getAdditionalCapabilities(javax.servlet.http.HttpServletRequest request)
Allows you to put additional 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. |
protected String |
getDefaultImageMapHREF(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Returns the HREF that corresponds to the background of the image map. |
protected IlvImageMapAreaGenerator |
getImageMapAreaGenerator(javax.servlet.http.HttpServletRequest request,
IlvGraphic obj,
IlvManagerView view,
IlvTransformer t)
Returns the area generator for the specified graphic object. |
float |
getJPEGQuality()
Returns the quality of the produced JPEG file. |
protected 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 contents 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. |
abstract IlvManagerView |
getManagerView(javax.servlet.http.HttpServletRequest request)
Returns the manager view used for the specified request. |
protected float |
getMaxZoomLevel(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
Returns the maximum zoom level authorized by the servlet. |
protected IlvManagerServletSupport |
getServletSupport()
Returns the IlvManagerServletSupport instance. |
protected IlvManagerServletSupport |
getSupport()
Deprecated. Beginning with JViews 8.1 use getServletSupport() instead. |
protected boolean |
handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Responds to the servlet request. |
void |
init(javax.servlet.ServletConfig config)
Initializes the manager servlet. |
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 |
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. |
protected void |
prepareSession(javax.servlet.http.HttpServletRequest request)
Prepare a session for the client. |
void |
removeServerActionListener(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. |
void |
setJPEGQuality(float quality)
Sets the quality of the produced JPEG file. |
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. |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ImageMapAreaGeneratorProperty
IlvImageMapAreaGenerator,
Constant Field Values| Constructor Detail |
|---|
public IlvManagerServlet()
IlvManagerServlet.
public IlvManagerServlet(IlvManagerServletSupport support)
createServletSupport(ServletContext) instead.
support - The manager servlet support.| Method Detail |
|---|
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
init in interface javax.servlet.Servletinit in class javax.servlet.GenericServletconfig - The ServletConfig instance.
javax.servlet.ServletExceptionprotected final IlvManagerServletSupport getSupport()
getServletSupport() instead.
protected final IlvManagerServletSupport getServletSupport()
IlvManagerServletSupport instance.
The servlet delegates most operations to the servlet support.
Derived classes can access the servlet support to implement high level
functionality.
protected IlvManagerServletSupport createServletSupport(javax.servlet.ServletContext context)
IlvManagerServletSupport.
public final void setVerbose(boolean value)
isVerbose()public final boolean isVerbose()
true if the servlet is on verbose mode.
setVerbose(boolean)public final void setJPEGQuality(float quality)
quality - can be in the [0,1] range, 0 for bad 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 final void setAntialiasing(boolean value)
value - the new antialising state of the manager viewgetAntialiasing()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 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 float getMaxZoomLevel(javax.servlet.http.HttpServletRequest request,
IlvManagerView view)
request - The current HTTP request.view - The manager view returned by getManagerView.
protected 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(javax.servlet.http.HttpServletRequest, ilog.views.IlvManagerView)protected Object getLock(javax.servlet.http.HttpServletRequest request)
request - The current HTTP request.getManagerView(javax.servlet.http.HttpServletRequest)
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 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.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),
IlvView.performAction(java.lang.String, java.lang.String[])public final void removeServerActionListener(ServerActionListener listener)
listener - The listener.addServerActionListener(ilog.views.servlet.ServerActionListener),
IlvView.performAction(java.lang.String, java.lang.String[])
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 contains 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
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 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.
You may overwrite this method to handle a new type
of request, in this case you will have to call the super method.
request - the current Http request.response - the Http response.
IOException
javax.servlet.ServletExceptionprotected void prepareSession(javax.servlet.http.HttpServletRequest request)
request - the current request.
public void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws IOException,
javax.servlet.ServletException
prepareSession(javax.servlet.http.HttpServletRequest) then handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse). You normally
do not need to overwrite this method. To add a new type of request, you
can overwrite the method handleRequest.
doGet in class javax.servlet.http.HttpServletrequest - The current HTTP request.response - The HTTP response.
IOException
javax.servlet.ServletException
public void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws IOException,
javax.servlet.ServletException
doGet.
doPost in class javax.servlet.http.HttpServletrequest - The current HTTP request.response - The HTTP response.
IOException
javax.servlet.ServletExceptiondoGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||