This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

Summary: This document provides basic information about the extension providing HTML5/JavaScript support for Web applications.

Extension ID

com.castsoftware.html5

What's new?

Please see the following pages for information about new features/changes, fixed bugs, changes that will impact results etc.:

Description

In what situation should you install this extension?

The analyzer could be used if your application is a Web Application, has HTML/Javascript/CSS files and/or contains HTML/Javascript fragments embedded into JEE and .NET files (for example). The analyzer provides the following features:

  • Automated Function Point counting.
  • Checksum, number of code lines, number of comment lines, comments are present.
  • Local and global resolution is done when function is called directly through its name (inference engine resolution is not available).
  • For global resolution, caller is searched in all .js files. If only one callee is found, a link is created. If several callees are found, the analyzer watches inclusions in html files to see if it can filter the callee. If nothing is found in html files to filter, links are created to all possible callees.

Files analyzed

Icon(s)FileExtensionNote

HTML

*.html, *.htm, *.xhtml, *.ftl; *.ftlh; *.vm, *.ngt, *.vt, *.vtl
  • Supports HTML/XHTML versions 1 - 5.
  • creates one "HTML5 Source Code" object that is the caller of html to js links and a transaction entry point
  • broadcasts tags and attributes/values to other CAST extensions such as AngularJS. Other extensions will not need to analyze the files themselves.

Note:

Javascript*.js, *.jsx, *.mjs, *.jsm, *.cjs

Supports:

  • JavaScript 1 to 1.8.1.
  • JavaScript ECMA 6

See also JavaScript below for more information.

Note:

Cascading Style Sheet

*.css and *.scss (*.scss is supported from 2.0.17-funcrel)

*.less','*.sass', '*.styl', '*.stylus', '*.cssm', '*.pcss', '*.postcss

Supports CSS 1 - 3.

  • *.less','*.sass', '*.styl', '*.stylus', '*.cssm', '*.pcss', '*.postcss files are supported in releases ≥ 2.1.29-funcrel and CAIP  8.3.54.

Java Server Page*.jsp, *.jspx, *.jsf, *.jsff, *.jspf, *.tag, *.tags, *.tagf, *.tagx

Supports JSP 1.1 - 2.3.

See JSP below for more information.

Note that:

  • from release 2.0.2 of the extension, *.jsf and *.jsff will automatically be taken into account during the analysis.
  • from release 2.0.3 of the extension, *.jspx will automatically be taken into account during the analysis.
  • from release 2.1.27 of the extension, *.jspf, *.tag, *.tags, *.tagf and *.tagx will automatically be taken into account during the analysis.

They will be analyzed as .jsp files.

Active Server Page*.asp, *.aspx

See (Classic) ASP below for more information.

HTML Components*.htcHTC files contain html, javascript fragments that will be parsed. Created objects will be linked to the HTC file.

ASP.NET MVC Razor*.cshtml

See ASP.NET MVC Razor below for more information.

IBM EAD4J Jade*.jadeFiles related to the IBM EAD4J Jade framework.

Pug*.pugPug files.
-YAML (YAML Ain't Markup Language)*.yml, *.yaml, Files related to the YAML language, handled by the Node.js extension.
-Vue.JS*.vueFiles related to the Vue.js JavaScript language, handled by the Node.js and Vue.js extensions.
-Properties*.properties

--

-Template*.templateFiles related to serverless.template, handled by the Node.js extension.
-Handlebars*.hbs, *.handlebarsFiles related to Handlebars.js. See Specific case of handlebars file below.

Note that you may find that the number of files delivered is more than then number of files reported after analysis. This is due to the following:

  • by default some files are automatically excluded from the analysis, typically third-party frameworks which are not required. Please see the filters.json file located at the root of the extension folder for a complete list of default exclusions.
  • some bundled javascript files are automatically excluded from the analysis, typically minified files (extension.min.js) or disguised minified files (extension.js), but for files containing one or a few very long lines, a specific calculation is actioned by the analyzer). 
  • some files that have been included in the analysis may not be saved in the CAST Analysis Service schema because they do not contain any useful information, i.e. they do not contain any technical sections such as functions which would lead to the creation of a specific object.

Since version 2.1.14-funcrel, files which are excluded from analysis are considered as external libraries when they are included by analyzed code. For each file, a "HTML5 JavaScript Source Code" is created with the external property set to "True". This means that these files are not included in rule checks or other computations.

Technology support notes

(Classic) ASP

Click here to expand...

Although CAST AIP handles classic ASP (Active Server Pages) applications "out of the box" with the ASP analyzer, the HTML5 and JavaScript extension is also capable of analyzing classic ASP applications. Below is a comparison of the analysis of the same classic ASP application with results from the HTML5 and JavaScript extension on the left and results with the ASP analyzer embedded in CAST AIP on the right:

Some additional links are provided in certain situations:

But less information in other situations:

ASP.NET MVC Razor

Click here to expand...


Summary: This document provides basic information about the how the .NET technology ASP.NET MVC Razor is supported.

Introduction

ASP.NET MVC Razor is supported via the HTML5 and JavaScript extension, therefore you should ensure that a HTML5 and JavaScript Analysis Unit is configured to cover the relevant source code.

Features

  • Creates objects specific to Razor corresponding to requests to the .NET server, as services, embedded in .cshtml files.
  • Creates objects specific to ASP.NET corresponding to operations which are methods of controllers in the .NET server, embedded in .cs files. This part of the extension is launched by the .NET analyzer.
  • Creates call links between these two kinds of objects through the Web Services Linker. These two kinds of objects are identified by a URL, in order to be compatible with the Web Services Linker.

Server part (without specific routing)

The following objects are created:

ASP.NET Any Operation

ASP.NET Get Operation

HTML5 Razor Get service

ASP.NET Put Operation

ASP.NET Post Operation

HTML5 Razor Post service

ASP.NET Delete Operation

URL creation

URLs are created as follows:

"Course/Edit" for the Edit method of this CourseController class. This is an operation which may correspond to any type of request from the client, then a CAST_AspDotNet_AnyOperation is created:

public class CourseController : Controller
{ 
	public ActionResult Edit(int? id)
 	{
	}
}

"Course/Edit"  for the Edit method of this CourseController class, first Edit corresponds to a POST operation, then a CAST_AspDotNet_PostOperation is created.  The second Edit corresponds to any of the other operation types,and depending on this a CAST_AspDotNet_GetOperation object, CAST_AspDotNet_PutOperation object or CAST_AspDotNet_DeleteOperation are created:

public class CourseController : Controller
{ 
	[HttpPost]
	public ActionResult Edit(int? id)
 	{
	}

	public ActionResult Edit(other params)
 	{
	}
}

"Course/Edit"  for the Edit method of this CourseController class, this is a POST operation:

public class CourseController : Controller
{ 
	[HttpPost, ActionName("Edit")]
	public ActionResult EditPost(int? id)
 	{
	}
}

In this case, the url is "CourseEdit", and not "CourseEditPost" because of the attribute "ActionName" presence, which contains an alias (click to enlarge):

Server part (with specific routing)

This section is the same as the previous one (Server part (without specific routing)), except that URLs are modified depending on a specific config routing. Specific routings are present in the following files:

App_Start/RouteConfig.cs files:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace ContosoUniversity
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
or some files named <name>AreaRegistration.cs files:
using System.Web.Mvc;

namespace XL.XLI.ScoringWebAppTool.WebUI.Areas.DesignProfessional
{
    public class DesignProfessionalAreaRegistration : AreaRegistration 
    {
        public override string AreaName 
        {
            get { return "DesignProfessional"; }
        }
        
        /* Order is important, as the engine uses fall-through matching logic. */
        public override void RegisterArea(AreaRegistrationContext context) 
        {
            context.MapRoute
            (
                "DesignProfessional_Default2",
                "DesignProfessional/{controller}/{action}/{id}",
                new
                {
                    controller = "PreRenewal",
                    action     = "Index",
                    id         = UrlParameter.Optional
                }
            );
            context.MapRoute
            (
                "DesignProfessional_Default",
                "DesignProfessional/PreRenewal",
                new
                {
                    controller = "PreRenewal",
                    action     = "Index",
                    id         = UrlParameter.Optional
                }
            );
        }
    }
}

Razor Client part

Creates object specific to Razor corresponding to requests to the NET server, as services, embedded in .cshtml files. The following objects are created:

HTML5 Razor Get service

HTML5 Razor Post service

Code examples

Html.ActionLink call

This code in a .cshtml file located in a directory named "Course" will create an object of type CAST_HTML5_Razor_GetService whose URL is "Course/Delete/{}". The presence of "{}" is due to the presence of a parameter of type "new {}" containing a word equals to "id" or ending with "id":

@Html.ActionLink("Delete", "Delete", new { id = item.CourseID })

Url.Action call

This code in a .cshtml file located in a directory named "Student" will create an object of type CAST_HTML5_Razor_GetService whose URL is "Student/Index":

@Html.PagedListPager(Model, page => Url.Action("Index",
	new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))

Html.ActionLinkWithAccess call

This code in a .cshtml file located in a directory named "StaffIncreaseProfilePeriod" will create an object of type CAST_HTML5_Razor_GetService whose URL is "StaffIncreaseProfilePeriod/Create":

<li>@Html.ActionLinkWithAccess(__("Add increase profile"), "Create", null, new { @class = "btn popupLink", data_popupsize = "big" })</li>

Html.Action call

This code in a .cshtml file located in a directory named "Account" will create an object of type CAST_HTML5_Razor_GetService whose URL is "Account/ExternalLoginsList".

@Html.Action("ExternalLoginsList", new { ReturnUrl = ViewBag.ReturnUrl })

Ajax.ActionLink call

This code in a .cshtml file located in a directory named "NotificationMessenger" will create an object of type CAST_HTML5_Razor_PostService whose URL is "NotificationMessenger/Delete/{}".

@Ajax.ActionLink("x", "Delete", "NotificationMessenger", new { notific.Id }, new AjaxOptions() { HttpMethod = "POST", OnComplete = "DismissNotification" }, new { @class = "notification-close" })

Html.RenderAction call

This code in a .cshtml file located in a directory named "Holidays" will create an object of type CAST_HTML5_Razor_PostService whose url is "Holidays/ColorsLegend".

@{ Html.RenderAction("ColorsLegend"); }

Html.BeginForm call

This code in a .cshtml file will create an object of type CAST_HTML5_Razor_PostService whose url is "Student/Index".

   @using (Html.BeginForm("Index", "Student", FormMethod.Get))
{
    <p>
        Find by name: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string)
        <input type="submit" value="Search" />
    </p>
}

Ajax.BeginForm call

This code in a .cshtml file will create an object of type CAST_HTML5_Razor_PostService whose url is "Missions/SynthesisAjaxHandler/{}".

@using (Ajax.BeginForm(
"SynthesisAjaxHandler", //actionName
"Missions", //controllerName
new { //routeValues
missionId = Model.Mission.Id,
dayId = Model.MissionDayId,
method="GET"
},
new AjaxOptions { //Ajax setup
UpdateTargetId = "synthesisLinesDiv",
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
},
new { //htmlAttributes
Id = "form-selectSynthesis",
//method="get"
}
))

JavaScript

Click here to expand...

CAST AIP has provided support for analyzing JavaScript via its JEE and .NET analyzers (provided out of box in CAST AIP) for some time now. The HTML5/JavaScript extension also provides support for JavaScript but with a focus on web applications. CAST highly recommends that you use this extension if your Application contains JavaScript and more specifically if you want to analyze a web application, however you should take note of the following when using the extension with CAST AIP ≤ 8.2.x

  • You should ensure that you configure the extension to NOT analyze the back end web client part of a .NET or JEE application.
  • You should ensure that you configure the extension to ONLY analyze the front end web application built with the HTML5/JavaScript that communicates with the back end web client part of a .NET or JEE application.
  • If the back end web client part of a .NET or JEE application is analyzed with the HTML5/JavaScript extension and with the native .NET/JEE analyzers, then your results will reflect this - there will be duplicate objects and links (i.e. from the analyzer and from the extension) therefore impacting results and creating erroneous Function Point data.
Note that in CAST AIP 8.3.x, support for analyzing JavaScript has been withdrawn from the JEE and .NET analyzers.

Support of JavaScript in this extension

  • JavaScript (1 to 1.8.1):
    • Javascript call(), function(), bind(), prototype and prototype inheritance are supported
    • creates Functions, Classes and Constructors
    • local call links between function calls and functions inside each JavaScript file are created

JSP

Click here to expand...

CAST recommends using the HTML5 and JavaScript extension to analyze classic JSP applications (JSP versions 1.1 - 2.3) - this is because the JEE Analyzer is not capable of analyzing the JavaScript elements of the JSP application. Below is a screenshot of the analysis of a classic JSP application using the HTML5/JavaScript extension - click to enlarge:

Transaction configuration information

HTML5 source code: it represents the whole HTML file content.

Function Point, Quality and Sizing support

This extension provides the following support:

  • Function Points (transactions): a green tick indicates that OMG Function Point counting and Transaction Risk Index are supported
  • Quality and Sizing: a green tick indicates that CAST can measure size and that a minimum set of Quality Rules exist
Function Points
(transactions)
Quality and Sizing
(tick)(tick)

AIP Core compatibility

This extension is compatible with:

AIP Core compatibility
Supported
8.3.x(tick)

Supported DBMS servers

DBMSSupported?
CSS / PostgreSQL(tick)

Prerequisites

(tick)An installation of any compatible release of AIP Core (see table above)

Download and installation instructions

The extension will be automatically downloaded and installed in CAST Console. You can manage the extension using the Application - Extensions interface:

Packaging, delivering and analyzing your source code

Once the extension is downloaded and installed, you can now package your source code and run an analysis. The process of packaging, delivering and analyzing your source code is described below:

Click here to expand...

Packaging and delivery

Note that the HTML5/JavaScript extension does not contain any discoverers or extractors, however, the Web Files Discoverer extension will be automatically installed (it is a "shipped" extension which means it is delivered with AIP Core) and will automatically detect projects as HTML5 if specific files are delivered, therefore ensuring that Analysis Units are created for your source code.

Using CAST Console

Using CAST Management Studio

Click here to expand...
  • create a new Version
  • create a new Package for your HTML5/JavaScript source code using the Files on your file system option:

  • Define the root folder of your Application source code:

  • Run the Package action
  • Before delivering the source code, check the packaging results:
Without the Web Files Discover

If you are not using the Web Files Discoverer, the following will occur:

  • the CAST Delivery Manager Tool will not find any "projects" related to the HTML5/JavaScript application source code - this is the expected behaviour. However, if your HTML5/JavaScript related source code is part of a larger application (for example a JEE application), then other projects may be found during the package action (click to enlarge):

With the Web Files Discoverer

If you are using the Web Files Discoverer, the following will occur:

  • the CAST Delivery Manager Tool will automatically detect "HTML5 file projects" (see Web Files Discoverer for more technical information about how the discoverer works) related to the HTML5/JavaScript application source code. In addition, if your HTML5/JavaScript related source code is part of a larger application (for example a JEE application), then other projects may also be found during the package action (click to enlarge):

  • Deliver the Version

Analyzing

Using CAST Console

AIP Console exposes the technology configuration options once a version has been accepted/imported, or an analysis has been run. Click Universal Technology (3) in the Config (1) > Analysis (2) tab to display the available options for your HTML5 source code:

Then choose the relevant Analysis Unit (1) to view the configuration:

Using the CAST Management Studio

Click here to expand...


  • Accept and deploy the Version in the CAST Management Studio.
Without the Web Files Discover

If you are not using the Web Files Discoverer, the following will occur:

  • No Analysis Units will be created automatically relating to the HTML5/JavaScript source code - this is the expected behaviour. However, if your HTML5/JavaScript related source code is part of a larger application (for example a JEE application), then other Analysis Units may be created automatically:

  • In the Current Version tab, add a new Analysis Unit specifically for your HTML5/JavaScript source code, selecting the Add new Universal Analysis Unit option:

  • Edit the new Analysis Unit and configure in the Source Settings tab:
    • a name for the Analysis Unit
    • ensure you tick the HTML5/JavaScript option
    • define the location of the deployed HTML5/JavaScript source code (the CAST Management Studio will locate this automatically in the Deployment folder):

Do not add a dependency from this Analysis Unit to another client Analysis Unit.

  • Run a test analysis on the Analysis Unit before you generate a new snapshot.
With the Web Files Discoverer

If you are using the Web Files Discoverer, the following will occur:

  • "HTML5" Analysis Units will be created automatically (see Web Files Discoverer for more technical information about how the discoverer works) related to the HTML5/JavaScript application source code. In addition, if your HTML5/JavaScript related source code is part of a larger application (for example a JEE application), then other Analysis Units may also be created:

Do not add a dependency from this Analysis Unit to another client Analysis Unit.

  • There is nothing further to do, you can now run a test analysis on the Analysis Unit before you generate a new snapshot.

Using the filters.json file

The HTML5 and JavaScript extension is provided with a file called filters.json at the root of the extension folder. This file lists all items that will be ignored during an analysis. The file is pre-populated with items, but it is also possible to modify the file manually and add your own custom filters. See HTML5 and JavaScript - using the filters.json file.

Analysis warning and error messages

The following warnings and error messages may be displayed in the analysis log:

Click here to expand...


Message IDMessage Type

Logged during

ImpactRemediationAction
HTML5-001WarningAnalysisA jsp file has not been entirely analyzed because an internal issue.


if the jsp file is important for you, contact CAST Technical Support
HTML5-002WarningAnalysisAn asp/aspx/htc/cshtml file has not been entirely analyzed because an internal issue.


if the file is important for you, contact CAST Technical Support
HTML5-003WarningAnalysisA file has not been opened/analyzed.See if you have access rights to this file.
HTML5-004WarningAnalysisAn HTTP request has not been created, a transaction link could be missing between a client and a server.
if the file is important for you, contact CAST Technical Support
HTML5-005WarningAnalysisOne statement of a file has not been correctly parsed.
if the file is important for you and/or many objects/links have not been created about this file, contact CAST Technical Support
HTML5-006WarningPost analysesAn important sql query has failed when removing files skipped by analysis. Impact is that lines of code (LOC) will be higher than expected.
contact CAST Technical Support
HTML5-007WarningPost analysesAn important sql query has failed when removing bad links created by UA through grep (internal). Impact is that transactions will be badly altered by these bad links.
contact CAST Technical Support
HTML5-008WarningPost analysesMetrics of a file have not been reported (code lines, comment lines). LOC could be wrong for this file.
contact CAST Technical Support
HTML5-009WarningPost analysesA link useful for transactions has not been created between a file created by JEE analyzer and an object representing the same file created by HTML5/Javascript analyzer.
contact CAST Technical Support
HTML5-010WarningPost analysesObjects corresponding to jsp files could be counted twice because they were not set external in JEE project.
contact CAST Technical Support
HTML5-011WarningPost analysesObjects corresponding to asp files could be counted twice because they were not set external in DOTNET project.
contact CAST Technical Support
HTML5-012WarningPost analysesObjects corresponding to aspx files could be counted twice because they were not set external in DOTNET project.
contact CAST Technical Support
HTML-013WarningPost analysesObjects corresponding to htc files could be counted twice because they were not set external in DOTNET project.
contact CAST Technical Support



Message IDMessage Type

Logged during

ImpactRemediationAction
EXTDOTNET-001WarningAnalysisAn ASP DOTNET operation has not been created correctly.


Contact CAST Technical Support
EXTDOTNET-002WarningAnalysisA file has not been opened/analyzed.See if you have access rights to this file.

End of comment and File skipped messages for .js files

You may find that the analysis log contains the following messages for .js files:

Warning MODULMSG ; Job execution end of comment '\*\/' not found 0 ; 0 0 0 [Module name] 0 0 
Warning MODULMSG ; Job execution File skipped : K:\CAST\Ref\auto-refi2-staticresources\testing\inflow.js

These messages occur when the underlying Universal Analyzer raises a warning whenever it encounters what it considers a syntax error. The "End of comment" message is logged and then a following message is logged stating that the file has been "skipped". These warnings should be ignored as they have no impact: the HTML5/JavaScript extension will analyze the file and raise the following message in the analysis log:

Information MODULMSG ; Job execution [com.castsoftware.html5] Light parsing of file K:\CAST\CASTMS\Deploy\Test_source\Ref\auto-refi2-staticresources\testing\inflow.js

What results can you expect?

Once the analysis/snapshot generation has completed, you can view the results in the normal manner:

CAST Enlighten

Javascript ECMA6 Classes and Constructors example


Web Service calls in javascript code

The following libraries are supported for Web Service HTTP calls:

  • XMLHttpRequest
  • window.open
  • document.submit
  • location.href
  • Ext.Updater (Sencha)
  • EventSource
  • fetch
  • axios
  • superagent
  • aws-amplify
  • falcor
  • WLResourceRequest
  • WebSocket

Once the HTML5 extension analysis is finished, the analyzer will output the final number of web service calls created.

When urls could not be correctly evaluated, a HTTP call named "{}" will be created, except for:

  • window.open
  • window.location.href, 
  • document.location.href

These exceptions are due to very large number of statements, and they are not explicit calls as "ajax", "get", "post", "delete"... functions.

XMLHttpRequest

var xhttp = new XMLHttpRequest();
xhttp.open("GET", "ajax_info.txt", false);
xhttp.send();

window.open

url = "EditStandaloneWeb.do?url_name_id="+urlNameId;
popUpWindow = window.open(url,'popUpWindow','height=900,width=900,left=300,top=50,resizable=no,directories=no,status=no');

document.submit

addUpload.document.forms[1].action = "ciedit";
addUpload.document.forms[1].submit();
$("form[id='configurarClassificacaoProdutoForm']").action = '<s:url action="configurarClassificacaoProduto" method="excluir"/>';
$("form[id='configurarClassificacaoProdutoForm']").submit();
$form.prop('method', 'post');
$form.prop('action', '<c:out value="/toto" />');
$form.submit();

location.href

url = "//localization.att.com/loc/controller";
window.location.href = url;
url = "//localization.att.com/loc/controller";
document.location.href=url;

Ext.Updater (Sencha)

Ext.get(panelId).getUpdater().update({
	url:'actionUrl',
	params:params,
	method:'POST',
	failure: function(inResp) {}
});

EventSource

const eventsUrl = '/api/dashboard/events?token=' + localStorage.getItem('dashboard_token');
const serverEvents = new EventSource(eventsUrl);

fetch

fetch('/users', {
	method: 'POST',
	body: new FormData(form)
});

axios

axios.get('/user', {
	params: {
		ID: 12345
	}
})
.then(function (response) {
	console.log(response);
})
.catch(function (error) {
	console.log(error);
});
var http = require('axios');
http.get('/user', {
	params: {
	ID: 12345
	}
})
.then(function (response) {
	console.log(response);
})
.catch(function (error) {
	console.log(error);
});
axios.request({
	url : '/user',
	method : 'delete'
});
axios('/user/12345');
axios({
	method: 'post',
	url: '/user/12345',
	data: {
		firstName: 'Fred',
		lastName: 'Flintstone'
	}
});
var instance = axios.create({
	baseURL: 'https://api.example.com'
}); 
instance.get('/longRequest', {
	timeout: 5000
});

superagent

request
	.post('/api/pet')
	.send({ name: 'Manny', species: 'cat' })
	.set('X-API-Key', 'foobar')
	.set('Accept', 'application/json')
	.end(function(err, res){
		// Calling the end function will send the request 
	});
var myrequest = require('superagent');
myrequest
	.get('/some-url')
	.use(prefix) // Prefixes *only* this request 
	.use(nocache) // Prevents caching of *only* this request 
	.end(function(err, res){
		// Do something 
	});
request
	.head('/users')
	.query({ email: 'joe@smith.com' })
	.end(function(err, res){

	});
request('GET', '/users')
    .end(function(err, res){
    });
request('/search', (err, res) => {
});

aws-amplify

import {API} from 'aws-amplify';
API.get('ReactSample','/items/orders/' + sessionStorage.getItem('latestOrder')).then(response => {});

falcor

var falcor = require('falcor');
var model = new falcor.Model({source: new falcor.HttpDataSource('/model.json')});
model
	.get(["events", "byName", ["Midwest JS"], ['description']])
	.then(function(response) {
			document.getElementById('event-data').innerHTML = JSON.stringify(response, null, 2);
		}, 
		function(err) {
			console.log(err);
		});

WLResourceRequest

var request = new WLResourceRequest('/adapters/sampleAdapter/multiplyNumbers', WLResourceRequest.GET);
request.setQueryParameter('params', [5, 6]);
request.send().then(
		function(response) {
			// success flow, the result can be found in response.responseJSON
		},
		function(error) { 
			// failure flow 
			// the error code and description can be found in error.errorCode and error.errorMsg fields respectively 
		}
);
  adapterPath = new URI("/adapters/sampleAdapter/multiplyNumbers");
  var request = new WLResourceRequest(adapterPath, WLResourceRequest.GET);
  request.setQueryParameter('params', [5, 6]);
  request.send().then(function(response) {}, function(error) {});
  var request = new WLResourceRequest(URI("/adapters/sampleAdapter/multiplyNumbers"), WLResourceRequest.GET);
  request.setQueryParameter('params', [5, 6]);
  request.send().then(function(response) {}, function(error) {});

dojo

      var xhrArgs = {
        url: "dojo/LICENSE_NOT_THERE",
        handleAs: "text",
        preventCache: true,
        handle: function(error, ioargs){
        }
      }
      var deferred = dojo.xhr("POST", xhrArgs);
  var xhrArgs = {
    url: "dojo/LICENSE_NOT_THERE",
    handleAs: "text",
    preventCache: true,
    handle: function(error, ioargs){
    }
  }
  var deferred = dojo.xhrGet(xhrArgs); // or dojo.xhrPost, dojo.xhrPut, dojo.xhrDelete
  require(["dojo/request"], function(request){
    request("my_url").then(
        function(text){
        },
        function(error){
        }
    );
});
require(["dojo/request/node"], function(nodeRequest){
    nodeRequest("my_url").then(
        function(text){
            console.log("The file's content is: " + text);
        },
        function(error){
            console.log("An error occurred: " + error);
        }
    );
});
require(["dojo/request"], function(request){
    request.get("my_url").then(
        function(text){
            console.log("The file's content is: " + text);
        },
        function(error){
            console.log("An error occurred: " + error);
        }
    );
});	// or request.post, request.put, request.del

WebSocket

      var socket = new WebSocket('ws://game.example.com:12010/updates2');

Web Service calls in html/jsp code

The following libraries are supported for Web Service HTTP calls:

  • href
  • iframe.src
  • form.action
  • input.formaction
  • datamap
  • jsp.forward
  • jsp.pager
  • struts-html
  • struts tags-html
  • struts-tags
  • struts-nested
  • struts jqgrid
  • euamtags
  • spring

Once the HTML5 extension analysis is finished, the analyzer will output the final number of web service calls created.

href

<a href="@Url.Action("Edit", "MissionMandatoryDocuments", new
	{
		type = item.Key,
		nodeId = Model.NodeId
	})">
</a>

iframe.src

<iframe src="/greco/ValidationADP.do?hidden=doPerform" height="900" width="1000"></iframe>

form.action

<form action="@Url.Action("Export", "InterimBillsEvaluation")" method="post">
</form>
<form action="<c:out value="${epayCustomer.absoluteBaseWithContextPath}"/>/dlife/payBill.perform" method="GET">
</form>

input.formaction

<input type="submit" value="Save" name="Edit" formaction="@Url.Action("edit")" class="btn btn-default" />

datamap

<div id="map" data-request-url="@Url.Action("GetStops", "Home")" data-request-url2="@Url.Action("Driving", "Home")">
<script>
	function getStops() {
		var url = $('#map').data('request-url');
		window.open(url) 
	}
</script>

jsp.forward

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<jsp:forward page="/dispatcher/mainMenu"/>

jsp.pager

<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager"%>
<html>
	<pg:pager url="RolePaginationAction.do" items="<%= total_records %>" index="<%= index %>" maxPageItems="<%= maxPageItems %>" maxIndexPages="<%= maxIndexPages %>" isOffset="<%= true %>" export="offset,currentPageNumber=pageNumber" scope="request">
	</pg:pager>
</html>

struts-html

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html xhtml="true">
	<div align="center">
		<html:form action="/submitCustomerForm" method="GET" />
	</div>
</html:html>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html xhtml="true">
	<div align="center">
		<html:link page="/submitCustomerForm" />
	</div>
</html:html>

struts tags-html

<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<html:html xhtml="true">
	<div align="center">
		<html:link action="bookEdit.do?do=borrowBook" paramName="book" paramProperty="id" paramId="id">Borrow book</html:link>
	</div>
</html:html>

struts-tags

<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<s:url action="banque" method="consulter" var="urlAcceuil"/>
	<s:a href="%{urlAcceuil}">Retour à l'acceuil</s:a>
</html>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<body>
		<s:a action="compte" />
	</body>
</html>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<body>
		<s:form action="compte">
			<s:hidden name="contract_nbr" id="contract_nbr" value="%{mod.contract_nbr}"/>
		</s:form>
	</body>
</html>

struts-nested

<%@ taglib uri="/tags/struts-nested" prefix="nested" %>
<html:html xhtml="true">
	<div align="center">
		<nested:form action="modifyAccount.do" />
	</div>
</html:html>

struts jqgrid

<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
<html>
	<sjg:grid id="sjgrid" dataType="json" href="/url" caption="Grid Model" gridModel="gridModel" pager="true" navigator="true">
	</sjg:grid>
</html>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
<html>
	<sjg:grid id="sjgrid" dataType="json" editurl="/url" caption="Grid Model" gridModel="gridModel" pager="true" navigator="true">
	</sjg:grid>
</html>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
<html>
	<sjg:grid id="sjgrid" dataType="json" cellurl="/url" caption="Grid Model" gridModel="gridModel" pager="true" navigator="true">
	</sjg:grid>
</html>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
<html>
	<sjg:gridColumn id="sjgrid" surl="/url">
	</sjg:gridColumn>
</html>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
<html>
	<sjg:gridColumn id="sjgrid" editoptions="{dataUrl: '/url'}">
	</sjg:gridColumn>
</html>

euamtags

<%@ taglib uri="WEB-INF/euamtags.tld" prefix="Euam" %>
<div align="center">
	<Euam:form action="/submitCustomerForm" />
</div>

spring

<%@taglib uri = "http://www.springframework.org/tags/form" prefix = "form"%>
<html>
	<div align="center">
		<form:form method="POST" action="/HelloWeb/addStudent" />
	</div>
</html>
<%@taglib uri = "http://www.springframework.org/tags/form" prefix = "form"%>
<html>
	<div align="center">
		<form:form method="POST" commandName="changePassword" action="" />
	</div>
</html>

Web Service calls in razor code (cshtml)

  • Html.BeginForm
  • Ajax.BeginForm
  • Html.Action
  • Html.ActionLinkWithAccess
  • Html.ActionLink
  • Ajax.ActionLink
  • Html.RenderAction
  • Url.Action
  • Url.RouteUrl
  • Kendo

Once the HTML5 extension analysis is finished, the analyzer will output the final number of web service calls created.

Html.BeginForm

@using (Html.BeginForm("Setting", "Peopulse", FormMethod.Post, new { autocomplete = "off", id = "form-peopulseFtpSettings", @class = "block" }))
{
	<input type="submit" name="Submit" />
}

Ajax.BeginForm

@using (Ajax.BeginForm("Setting", "Peopulse", new { //routeValues
		missionId = Model.Mission.Id,
		dayId = Model.MissionDayId,
		method="GET"
	},
	new AjaxOptions { //Ajax setup
		UpdateTargetId = "synthesisLinesDiv",
		HttpMethod = "GET",
		InsertionMode = InsertionMode.Replace,
	},
	new { //htmlAttributes
		Id = "form-selectSynthesis",
		//method="get"
	}))
{
}

Html.Action

@Html.Action("Delete", "Ctrl", new { id = item.ID })

Html.ActionLinkWithAccess

@Html.ActionLinkWithAccess(__("Add frequency interim summary"), "AddFrenquencyInterimSummary", null, new {@class = "btn popupLink"})
@Html.ActionLink("Save", "SaveAction", "MainController", null, new { @class = "saveButton", onclick = "return false;" })

Ajax.ActionLink

@Ajax.ActionLink("x", "Delete", "NotificationMessenger", new { notific.Id }, new AjaxOptions() { HttpMethod = "POST", OnComplete = "DismissNotification" }, new { @class = "notification-close" })

Html.RenderAction

@Html.RenderAction("Delete", "Ctrl", new { id = item.ID })

Url.Action

@{ Html.RenderPartial("_EmployeesTable", @Url.Action("GetFrenquencyInterimSummary")); }
@using (Html.BeginForm("edit", "Employee", FormMethod.Post))
{
	<div class="form-horizontal">
		<div class="form-group">
			<div class="col-md-offset-2 col-md-10">
				<input type="submit" value="Save" name="Edit" formaction="@Url.Action("edit")" formmethod="post" class="btn btn-default"/>
			</div>
		</div>
	</div>
}
@Html.PagedListPager(Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter}))

Url.RouteUrl

<a href="@(Url.RouteUrl(new{ action="DownloadFile", controller="DPScoreResults", id=Model.QuoteId, scoreRunId=Model.ScoreRunId}))" class="popupLink ico">

Kendo

<div>
	@(Html.Kendo().Grid<ElementControle>()
		.Name("gridElementsControle")
		.DataSource(datasource =>
			datasource.Ajax()
				.Read(r => r.Action("GetElementsControle", "GestionUnitesTraitement"))
		)
	)
</div>

Specific case of handlebars file

In HTML5/Javascript ≥ 2.1.29, the analyzer supports handlebars files (https://handlebarsjs.com/). This templating can be used in any kind of file type (javascript, HTML, text, or any other type). A detection process is carried out by the HTML5 extension to identify which kind of file represents the file. This is why a specific metamodel type "Handlebars Source Code" is created, and a HTML or Javascript fragment is created under this handlebars source code:

 

External libraries

In HTML5/Javascript ≥ 2.1.21, the analyzer is capable of finding external libraries using package.json files (dependencies and devDependencies sections). It creates external libraries under a folder named "HTML5 external libraries" directly under the project root. One external library is created for each couple (library name, version), and include links are created from the javascript sources to these libraries. Only called libraries are created. Each library object contains a property for the version. These objects are of the type "HTML5 JavaScript Source Code".

External libraries are also created when code like <script src="http://..../jquery.1.2.3.min.js"> is found in html files. The version is searched in the url (here 1.2.3) and the name is extracted (here jquery).

Contents of "node_modules" folder

In HTML5/Javascript ≥ 2.1.14, the analyzer is capable of scanning the contents of the "node_modules" folder which contains third-party external libraries. For every external item in the "node_modules" which is called by analyzed source code, a corresponding object will be created by the HTML5/JavaScript analyzer and therefore exposed in the analysis results. The items in the "node_modules" folder are not actually analyzed as such and are still ignored via an entry in the filters.json file. This is one part of a project to expose (in analysis results) called external libraries located in the "node_modules" folder.

Note that by default, Console will ignore the "node_modules" folder (except in releases 2.5.x and 2.6.x) due to analysis performance issues. Therefore if you require this behaviour, you must manually remove the exclusion pattern knowing that your analysis times may increase:

Modern onboarding

Legacy onboarding

Objects

The following objects are displayed in CAST Enlighten:

 IconDescription ≤ 2.1.21Description ≥ 2.1.22

JavaScript fileJavaScript file

HTML5 Source CodeHTML Source Code

HTML5 Source Code FragmentHTML FragmentHTML fragment present inside javascript code

HTML5 ASP ContentASP Content

HTML5 ASPX ContentASPX Content

HTML5 CSHTML ContentCSHTML Content

HTML5 CSS Source Code

CSS Source Code
HTML5 CSS Source Code FragmentCSS Source Code Fragment

HTML5 HTC ContentHTC Content

HTML5 JavaScript Source CodeJavaScript Source Code

HTML5 JSX source codeJSX Source Code

HTML5 Jade source codeJade Source Code

HTML5 Pug source codePug Source Code


Handlebars Source Code
HTML5 JavaScript Source Code FragmentJavaScript Source Code Fragment


HTML Source Code FragmentHTML fragment inside template files like .hbs files

HTML5 JavaScript FunctionJavaScript Function

HTML5 Javascript MethodJavaScript Method

HTML5 Javascript ClassJavaScript Class

HTML5 Javascript Class ConstructorJavaScript Constructor

HTML5 WebSocket service

JavaScript WebSocket Service

HTML5 Get XMLHttpRequest Service

HTML5 Get HttpRequest Service

HTML5 Razor Get service

XMLHttpRequest Get Service

JavaScript HttpRequest Get Service

Razor Get Service


HTML5 Update XMLHttpRequest Service

HTML5 Update HttpRequest Service

XMLHttpRequest Update Service

JavaScript HttpRequest Update Service


HTML5 Post XMLHttpRequest Service

HTML5 Post HttpRequest Service

HTML5 Razor method call

XMLHttpRequest Post Service

JavaScript HttpRequest Post Service

Razor Method Call


HTML5 Delete XMLHttpRequest Service

HTML5 Delete HttpRequest Service

XMLHttpRequest Delete Service

JavaScript HttpRequest Delete Service


HTML5 Applet class reference

Java Applet Class Reference

J2EE HTML5 AppletJava Applet

Structural Rules

2.1.29-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.29-funcrel
2.1.28-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.28-funcrel
2.1.27-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.27-funcrel
2.1.26-funcrelExtension withdrawn.
2.1.25-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.25-funcrel
2.1.24-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.24-funcrel
2.1.23-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.23-funcrel
2.1.22-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.22-funcrel
2.1.21-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.21-funcrel
2.1.20-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.20-funcrel
2.1.19-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.19-funcrel
2.1.18-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.18-funcrel
2.1.17-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.17-funcrel
2.1.16-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.16-funcrel
2.1.15-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.15-funcrel
2.1.14-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.14-funcrel
2.1.13-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.13-funcrel
2.1.12-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.12-funcrel
2.1.11-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.11-funcrel
2.1.10-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.10-funcrel
2.1.9-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.9-funcrel
2.1.8-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.8-funcrel
2.1.7-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.7-funcrel
2.1.6-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.6-funcrel
2.1.5-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.5-funcrel
2.1.4-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.4-funcrel
2.1.3-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.3-funcrel
2.1.2-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.2-funcrel
2.1.1-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.1-funcrel
2.1.0-funcrelhttps://technologies.castsoftware.com/rules?sec=srs_html5&ref=||2.1.0-funcrel

A global list is also available here: https://technologies.castsoftware.com/rules?sec=t_1020000&ref=||.

Known Limitations

  • Creation and detection of object using "prototype" is not supported.
  • When HTML5/JavaScript source code is used as the "source" or "destination" in a Reference Pattern (configured in the CAST Management Studio) it will be ignored when the analysis is run - this is due to a limitation in the way the analyzer functions. However, when testing the Reference Pattern using the test option in the CAST Management Studio, the pattern will appear to match.