Using mapserv as a dynamic link library from a servlet

Graham Sims graham.sims at pavtech.co.nz
Mon Mar 26 15:43:10 EST 2001


G'day all,

I've also built an JNI dll from the mapscript source. I used swig 1.3a,
which sort of worked, and hacked the ouput around a bit to get it all to
compile. I've also started writing a java class library (package) which sits
on top of the JNI dll and rewraps the objects back up. My objective with
this, was not to produce servlets so much as to have a class library which
could be used by JSP's.

The dll and java classes can be downloaded from
http://urewera.boarsnest.net/MapScript/

Be warned though its all fairly untested and the java classes are not
complete. I've only been working on this as I've has spare time. The source
for the java classes are included in the jar file and i'd welcome any effort
to complete them and test them.

cheers,

--
Graham Sims
Analyst/Software Developer
PavTech NZ LTD

> -----Original Message-----
> From:	Stephen Lime [SMTP:steve.lime at dnr.state.mn.us]
> Sent:	Thursday, March 22, 2001 10:25 AM
> To:	Matthew.Wakely at dsto.defence.gov.au;
> mapserver-users at lists.gis.umn.edu
> Subject:	Re: Using mapserv as a dynamic link library from a servlet
> 
> Mapserv itself is built for CGI-only. You'd have better luck trying to
> develop java version
> of MapScript and then build servlets from that. I think I'd need to add a
> method to make
> a copy of a loaded mapObj that could be used with each request and then
> destroyed.
> 
> Swig 1.3a will kick out JNI code and I've gone so far as to get the shared
> library compiled.
> I ran into problems compiling the class specific (i.e. layerObj, classObj)
> code into class
> files. I just screwed around for an hour or so and didn't work at it much.
> 
> I'd love to see this work and will gladly try to accomodate code changes
> necessary to
> make it happen.
> 
> Steve
> 
> Stephen Lime
> Internet Applications Analyst
> 
> Minnesota DNR
> 500 Lafayette Road
> St. Paul, MN 55155
> 651-297-2937
> 
> >>> "Wakely, Matthew" <Matthew.Wakely at dsto.defence.gov.au> 03/21/01
> 03:43PM >>>
> Has anyone tried to convert mapserv to a .dll file and then call it using
> a
> java Servlet and Java Native Interface.
> 
> My problem is that the mapserv program only seems to run once. Usually
> this
> would be ok because CGI programs run once then die. However I cant do that
> from a servlet.
> Basicly all i did was convert the main() function in mapserv.c to a
> function
> "callMapserv()" i could call from Java. The problem is that the program
> seems to crash when it tries to parse using maplexxer.c and mapparser.c.
> 
> Has anyone encountered these problems before or could someone perhaps
> offer
> some advice. I suspect its because of all the global variables flying
> around
> within mapserv.
> 
> 
> 
NOTICE: The information contained in this electronic mail message and any
attachments is confidential to Pavilion Technologies, Inc. or one of its
subsidiaries and may contain proprietary information or be legally
privileged. This message and any attachments are intended only for the
personal and confidential use of the designated recipient(s). If you are not
the intended recipient or an agent responsible for delivering it to the
intended recipient, you are hereby notified that you have recieved this
message in error, and that any review, dissemination, distribution or
copying of this message and any attachments is unauthorized and strictly
prohibited. If you have received this message in error, please notify me
immediately by telephone and electronic mail, and delete this message, any
attachments, and all copies thereof. Thank you very much  





More information about the mapserver-users mailing list