jBox Java applet
Richard Greenwood
richard.greenwood at GMAIL.COM
Mon Nov 22 09:15:04 PST 2004
On Mon, 22 Nov 2004 10:10:33 -0500, Andhare, Manjiri
<mandhare at state.pa.us> wrote:
> Hi Rich,
> Thanks for correcting me the way I have specified the archive. I have
> changed the code base to "c:/Inetpub/wwwroot/MapServer/java/jBox"
> And archive to "jBoxPNG.jar.
That's not correct. The codebase has to point to an HTTP address, not
to a file system directory. This is becasue the web page holding the
java applet is fetching the applet.
> But after hitting the "initialize" button, when I looked at the
> generated source code , I found that the path to the png map image
> generated by Mapserver was incorrect. Previously,I had put the code for
> displaying the map image as:
> <param name="image" value="http://[host][img]">
> But my image was in heep://localhost/MapServer/Docs/tmp folder.
> So I changed that line to:
> <param name="image" value="http://[host]/MapServer/Docs/[img]"
> But the problem is, when mapserver put the value for [img], it creates
> it as: " \tmp\ITASCA11011353302004.png"
> Therefore I'm getting the value for the map image in the source as:
> <param name="image"
> value="http://localhost/MapServer/Docs/\tmp\ITASCA11011353302004.png">
> But I'm not getting the way so that the mapserver could correctly get
> the path to the image.
> An after doing all these changes, I neither see the map in the browser
> not the java consol error. So, I'm not sure whether the java applet is
> being called and executed or not.
Again, I think you are confusing HTTP addresses with file system
addresses. In your .map file you should have something like:
IMAGEPATH c:/Inetpub/wwwroot/MapServer/Docs/tmp/
# this is the file system directory where mapserver puts the images,
# it should also be an IIS virtual directory
IMAGEURL /tmp/
# this is the HTTP address that the client browser reads from.
I may not have those exactly right because I am guessing at your
directory structure. But when set correctly
<param name="image" value="http://[host][img]">
should look something like this after being parced by mapserv.exe:
<param name="image" value="http://localhost/tmp/ITASCA11011353302004.png">
You should be able to put the replaced values from [host][img] into
your browser's address bar an see the image. If you can't do that,
then you have an error in your .map file and/or your virtual directory
assignments in IIS. If you can't fetch the image in this way, then
there is no way that jBox will be able to get it either.
Rich
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com
> -----Original Message-----
> From: Richard Greenwood [mailto:richard.greenwood at gmail.com]
> Sent: Thursday, November 18, 2004 2:36 PM
> To: Andhare, Manjiri
> Cc: mapserver-users at lists.umn.edu
> Subject: Re: [UMN_MAPSERVER-USERS] jBox Java applet
>
> Looks like there are problems with your codebase and archive
> parameters. You have:
> codebase="java\jBox"
> archive="jBoxPNG.jar,png.jar"
>
> The way you have codebase, the 'java' directory will not be found. I
> assume that 'mapserver' is an IIS virtual directory, so try:
> 'codebase=/mapserver/java/jbox'
> Forward slashes, not back slashes, as this is a URI, not a DOS path.
>
> I'm a little unclear on the specification of two jar files in the
> archive parameter. Is that legal? Where'd you come up with that? And
> you have the .jar files in /mapserver/java/jbox/ not a subdirectory,
> right?
>
> You might want to start with GIFs and the standard jBox, rather than
> jBoxPNG which requries the sixlegs library. If you're using the Sun
> Java VM, you don't need six-legs anyway.
>
> I am cc'ing the mapserver-users list as others may spot something that I
> missed.
>
> Rich
> --
> Richard Greenwood
> richard.greenwood at gmail.com
> www.greenwoodmap.com
>
> On Thu, 18 Nov 2004 09:49:02 -0500, Andhare, Manjiri
> <mandhare at state.pa.us> wrote:
> > Yes I have JVM and after running the demo, if I check the java
> console,
> > I get following:
> > ----------------------------------------------------
> > load: class jBoxPNG.class not found.
> >
> > java.lang.ClassNotFoundException: jBoxPNG.class
> >
> > at sun.applet.AppletClassLoader.findClass(Unknown Source)
> >
> > at java.lang.ClassLoader.loadClass(Unknown Source)
> >
> > at sun.applet.AppletClassLoader.loadClass(Unknown Source)
> >
> > at java.lang.ClassLoader.loadClass(Unknown Source)
> >
> > at sun.applet.AppletClassLoader.loadCode(Unknown Source)
> >
> > at sun.applet.AppletPanel.createApplet(Unknown Source)
> >
> > at sun.plugin.AppletViewer.createApplet(Unknown Source)
> >
> > at sun.applet.AppletPanel.runLoader(Unknown Source)
> >
> > at sun.applet.AppletPanel.run(Unknown Source)
> >
> > at java.lang.Thread.run(Unknown Source)
> >
> > Caused by: java.io.IOException: open HTTP connection failed.
> >
> > at sun.applet.AppletClassLoader.getBytes(Unknown Source)
> >
> > at sun.applet.AppletClassLoader.access$100(Unknown Source)
> >
> > at sun.applet.AppletClassLoader$1.run(Unknown Source)
> >
> > at java.security.AccessController.doPrivileged(Native Method)
> >
> > ... 10 more
> >
> > Manjiri Andahre
> > GIS co-ordinator
> > PA Fish & Boat commission
> > tel: (814)3595182
> > fax:(814)3595153
> >
> >
> >
> > -----Original Message-----
> > From: Richard Greenwood [mailto:richard.greenwood at gmail.com]
> > Sent: Thursday, November 18, 2004 9:43 AM
> > To: Manjiri Andhare
> > Subject: Re: [UMN_MAPSERVER-USERS] jBox Java applet
> >
> > Do you have a Java Virtual machine installed?
> > Get one here:
> >
> > http://www.java.com/en/download/installed.jsp
> >
> > Rich
> > --
> > Richard Greenwood
> > richard.greenwood at gmail.com
> > www.greenwoodmap.com
> >
> > On Thu, 18 Nov 2004 07:29:16 -0600, Manjiri Andhare
> > <mandhare at state.pa.us> wrote:
> > > Hi!
> > > I was looking for the functionality to draw a rectangle for zooming
> in
> > on
> > > the map. I found jBox by Steve Lime on
> > > http://mapserver.gis.umn.edu/contributed.html
> > > I have Windows 2000 and I'm running mapserver 4.2 on IIS.
> > > I follwed the steps from jBox HOWTO 4.2 to test it with the workshop
> > demo.
> > > But when i try to run the workshop demo with "Basic application"
> > option, in
> > > the status bar of Browser(I'm using IE 6.0) I get the message as;
> > > Loading Java Applet Failed..
> > > And I'm not getting the reason behind this..
> > > Here is the changed portion of itasca_basic.html file:
> > > ***************************************
> > >
> > > <html>
> > > <head>
> > > <title>MapServer - Itasca Application</title>
> > > <script language="javascript">
> > >
> > > function setbox_handler(name,minx,miny,maxx,maxy)
> > > {
> > > document.mapserv.imgbox.value = minx + " " + miny
> > > + " " + maxx + " " + maxy;
> > > document.mapserv.imgxy.value = minx + " " + miny;
> > > //additional code can go here prior to the form
> > > submit, below
> > > //for example, form validation code.
> > > document.mapserv.submit();
> > > }
> > > function seterror_handler(message)
> > > {
> > > alert(message);
> > > }
> > > </script>
> > > </head>
> > > <body bgcolor="#ffffff">
> > >
> > > <center><h1>MapServer - Itasca Application</h1></center>
> > > <hr>
> > > <form method="GET" action="cgi-bin/mapserv.exe" name="mapserv" >
> > >
> > > <center>
> > > <table border="0" cellspacing="0" cellpadding="4">
> > > <tr>
> > > <td valign="top" align="center">
> > > <table width="390" border="0" cellspacing="0" cellpadding="4"
> > > align="center" bgcolor="#666666">
> > > <tr>
> > > <td colspan="2">
> > > <applet
> > > codebase="java\jBox"
> > > archive="jBoxPNG.jar,png.jar"
> > > code="jBoxPNG.class"
> > > width="600"
> > > height="600"
> > > name="jBox"
> > > MAYSCRIPT>
> > > <param name="image" value="http:\\[host][img]">
> > > </applet>
> > > </td>
> > > </tr>
> > > <tr><td bgcolor="#666666">
> > > <img title="scalebar (mi)" alt="scalebar (mi)"
> src="[scalebar]">
> > > </td></tr>
> > > </table>
> > > </td>
> > > <td valign="top" bgcolor="#ffffff">
> > > <table cellpadding="5" cellspacing="0" border="0"
> bgcolor="#ffffff">
> > > <tr><td>
> > > <center><input type="submit" value="Refresh/Query"></center>
> > > <p>
> > >
> > > <input type="radio" name="mode" value="browse" checked>
> > <b>Browse
> > > map</b><br>
> > > <input type="radio" name="mode" value="query"> <b>Query
> > > feature</b><br>
> > > <input type="radio" name="mode" value="nquery"> <b>Query
> > multiple
> > > features</b>
> > >
> > > <hr>
> > >
> > > <p>
> > > <b>Select Layers to Display: </b><br>
> > > <select multiple name="layer" size=3>
> > > <option value="airports" [airports_select]> Airports
> > > <option value="cities" [cities_select]> Cities
> > > <option value="lakespy2" [lakespy2_select]> Lakes & Rivers
> > > <option value="dlgstln2" [dlgstln2_select]> Streams
> > > <option value="roads" [roads_select]> Roads
> > > <option value="twprgpy3" [twprgpy3_select]> Townships
> > > <option value="drgs" [drgs_select]> USGS 1:250,000 Quads
> > > </select>
> > >
> > > <p>
> > > Zoom In <input type=radio name=zoomdir value=1
> > [zoomdir_1_check]>
> > > Pan <input type=radio name=zoomdir value=0 [zoomdir_0_check]>
> > > Zoom Out <input type=radio name=zoomdir value=-1
> > [zoomdir_-1_check]>
> > > <p>
> > > Zoom Size <input type=text name=zoomsize size=4
> > value=[zoomsize]>
> > > <p>
> > >
> > > <font size=+1><b>Legend</b></font><br><hr>
> > > <img src="[legend]"><hr>
> > >
> > > <p>
> > > <center>
> > > <input name="ref" type="image" src="[ref]"
> > > border="0"></center>
> > > </td></tr></table>
> > >
> > > </td></tr>
> > > </table>
> > > </center>
> > > <input type="hidden" name="imgbox" value="-1 -1 -1 -1">
> > >
> > > ***************************************************
> > >
> > > I have placed the jBox as:
> > > c:\Inetpub\wwwroot\MapServer\java\jBox
> > > And I have placed the jar files, class files and java source files
> > from
> > > lib,classes and src folders respectively under
> > > c:\Inetpub\wwwroot\MapServer\java\jBox
> > >
> > > If somebody could point out what i'm missing,it'll be great!!
> > > Thank you,
> > > Manjiri Andhare
> > > GIS Coordinator
> > > PA Fish & Boat Commission
> > > U.S.A.
More information about the MapServer-users
mailing list