Installing the ArcGIS JavaScript 3.1 API library on an IIS Web Server

1286
5
08-06-2012 03:46 PM
SharathNarasimhan
New Contributor
Is there an updated installation manual for local deployment of ArcGIS JavaScript 3.1 API library ? The following instructions in the manual appear to be no longer valid:

Configuration options for normal build:
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.1\jsapi\init.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.1/jsapi/"
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.1\jsapi\js\dojo\dojo\dojo.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.1/jsapi/"
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.1\jsapi\js\dojo\dojo\dojo.js.uncompressed.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.1/jsapi/"

Please help me out in this regard.

Thanks,
0 Kudos
5 Replies
gaolei
by
New Contributor
I found the text in v3.0 is "[HOSTNAME_AND_PATH_TO_JSAPI]js/dojo/dojo",
but in v3.1 is "serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/dojo/dojo",maybe the newly instruction hasn't updated.

I can't find "dojo.js.uncompressed.js " in v3.1, and I found the file v3.1 is 15MB,but v3.0 is 26MB, any error?
0 Kudos
SharathNarasimhan
New Contributor
Well yes, there is no "dojo.js.uncompressed.js " in v3.1. I get an error saying dojo is undefined, since the http://<my_server>/arcgis_js_api/library/3.1/jsapi/?v=3.1" is not accessible. (Because there is no default.ashx / index.jsp files ?)

I found the text in v3.0 is "[HOSTNAME_AND_PATH_TO_JSAPI]js/dojo/dojo",
but in v3.1 is "serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/dojo/dojo",maybe the newly instruction hasn't updated.

I can't find "dojo.js.uncompressed.js " in v3.1, and I found the file v3.1 is 15MB,but v3.0 is 26MB, any error?
0 Kudos
__Rich_
Occasional Contributor III
Looks like someone forgot to include the handlers in the zip, unless something radical has changed, the ones from v3.0 should be fine.

@Sharath - default.ashx is the one for you, place the file under the jsapi directory (or jsapicompact if you're using the compact build) then set the default document in IIS for that directory.

HTH

P.S. this is pretty poor, especially since additionally, as correctly observed above, the instructions are invalid i.e. the [HOSTNAME_AND_PATH_TO_JSAPI] strings aren't present.

P.P.S. You can avoid this (URL replacement) step anyway if you correctly set the baseUrl up-front.
0 Kudos
JanJeske
New Contributor III
To install it u have to replace 'serverapi.arcgisonline.com' with your path.
as example you have then

yourserver.de/jsapi/arcgis/3.1/js/dojo/dojo

yourserver.de/libraries/jsapi/3.1/jsapicompact/js/dojo/dojo

this should be made in the files init.js and js/dojo/dojo/dojo.js

to include the jsapi include 'yourserver.de/libraries/jsapi/3.1/jsapicompact/init.js' or if you want to do it like the other versions < 3.1

create a file you want

for php:
<?php
header("Content-type:application/x-javascript");
readfile("js/dojo/dojo/dojo.js");
readfile("js/esri/jsapi.js");
?>


for .net:
<%@ WebHandler Language="C#" Class="jsapi" %>

using System;
using System.Web;
using System.IO;

public class jsapi : IHttpHandler {
  public void ProcessRequest (HttpContext context) {
  
    // GZIP if supported
    string AcceptEncoding = HttpContext.Current.Request.Headers["Accept-Encoding"];
    if (!string.IsNullOrEmpty(AcceptEncoding) && AcceptEncoding.Contains("gzip")) {
      context.Response.AppendHeader("Content-Encoding", "gzip");
      context.Response.Filter = new System.IO.Compression.GZipStream(context.Response.Filter, System.IO.Compression.CompressionMode.Compress);
    }

    context.Response.ContentType = "application/x-javascript";
    context.Response.Expires = 1800;

    context.Response.WriteFile(context.Server.MapPath("js\\dojo\\dojo\\dojo.js"));
    context.Response.WriteFile(context.Server.MapPath("js\\esri\\jsapi.js"));
  }
 
  public bool IsReusable {
    get {
      return false;
    }
  }
}


or for JSP:
<%@page contentType="application/x-javascript; charset=utf-8" session="false" %>
<jsp:include page="js/dojo/dojo/dojo.js" />
<jsp:include page="js/esri/jsapi.js" />


save your createt file and set it as default for that path.

Now you can call the jsapi 'yourserver.de/libraries/jsapi/3.1/jsapicompact/'
0 Kudos
SharathNarasimhan
New Contributor
Thanks for the replies. Adding the web handler and replacing the URLs in files init.js and dojo.js seems to work for me.
0 Kudos