Product: MapXtreme Java
Version: 3.x/4.x
Platform: Not Platform Related
Category: Code Samples
Summary:
Accessing data on a host from a servlet deployed on a client.
Question:
Is it possible to access data via a servlet deployed on a machine separate from the host running the MapXtreme servlet and housing the data?
Answer:
There is an example of how to do this in the SimpleMap applet that ships with MapXtreme Java, where the loadMapDefinition() method takes an inputStream.
InputStream isRemoteFile = null;
try {
URL u = new URL(m_fileToLoad);
URLConnection conn = u.openConnection();
isRemoteFile = conn.getInputStream();
// Load the map
m_visualMapJ.getMapJ().loadMapDefinition(isRemoteFile);
// TODO: Specify an URL to a map file, such as "http://host.com/maps/uk.mdf"
// Or, instead of specifying this URL explicitly here, you can specify it
// in the HTML page that loads the applet (using the 'filetoload' param).
static String m_fileToLoad = "";
Last Modified:
|