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 jQuery support for Web applications.

Extension ID

com.castsoftware.jquery

What's new?

See jQuery - 2.3 - Release Notes for more information.

Description

This extension provides support for jQuery.

In what situation should you install this extension?

If your Web application contains jQuery source code and you want to view these object types and their links with other objects, then you should install this extension:

  • Creates jQuery events and access points to services:
    • jQuery events: they represent a query in DOM tree
    • jQuery access points to web services: CAST_JQuery_GetResourceService, CAST_JQuery_PutResourceService, CAST_JQuery_PostResourceService
  • Creates links (direct or indirect) from jQuery events to jQuery access points to services (these links are created by the jQuery extension and the HTML5/JavaScript extension).
  • Links from the jQuery access points to services to different servers written in other languages are then created by the WBSlinker extension (an internal extension).
  • The following declarations will create a jQuery event:
$('#advancedLoginOptionsLink').bind('click', dm.login.toggle_advanced);
$('#advancedLoginOptionsLink').click(dm.login.toggle_advanced);
$('#advancedLoginOptionsLink').on('click', this.destroy.bind(this));....

Transaction configuration

Default entry point is the HTML file content.

Supported jQuery versions

VersionsSupported?

1.0 - 3.x

(tick)

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 SizingSecurity
(tick)(tick)(tick)

Comparison with existing support for JavaScript

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 (on which the jQuery extension depends) 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:

  • 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 jQuery 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.

AIP Core compatibility

This extension is compatible with:

AIP Core release
Supported
8.3.x(tick)

Supported DBMS servers

DBMSSupported?
CSS / PostgreSQL(tick)

Prerequisites

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

Dependencies with other extensions

Some CAST extensions require the presence of other CAST extensions in order to function correctly. The jQuery extension requires that the following other CAST extensions are also installed:

Note that when using the CAST Extension Downloader to download the extension and the Manage Extensions interface in CAST Server Manager to install the extension, any dependent extensions are automatically downloaded and installed for you. You do not need to do anything.

Download and installation instructions

The extension will be automatically downloaded and installed in AIP Console (it is a "shipped" extension which means it is delivered with AIP Core). You can also manually install the extension using the Application - Extensions interface. When installed, follow the instructions below to run a new analysis/snapshot to generate new results:

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 AngularJS extension does not contain any CAST Delivery Manager Tool discoverers or extractors, therefore, no "AngularJS" projects will be detected. 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 jQuery 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 AngularJS application source code - this is the expected behaviour. However, if your jQuery 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 jQuery application source code. In addition, if your jQuery 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 AIP 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 jQuery 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 AngularJS source code - this is the expected behaviour. However, if your jQuery 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 AngularJS 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 (the AngularJS extension depends on the HTML5 and JavaScript extension - and therefore the Universal Analyzer language for the jQuery extension is set as HTML5/JavaScript)
    • define the location of the deployed jQuery source code (the CAST Management Studio will locate this automatically in the Deployment folder):

  • 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 jQuery application source code. In addition, if your jQuery related source code is part of a larger application (for example a JEE application), then other Analysis Units may also be created:

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

What results can you expect?

Once the analysis/snapshot generation has completed, you can view the results in the normal manner (for example via CAST Enlighten):

Web Service calls

The following libraries are supported for Web Service HTTP calls:

  • $.ajax
  • $.get
  • $.post
  • jQuery.sap.syncGet
  • jQuery.sap.syncGetJSON
  • jQuery.sap.syncGetText
  • jQuery.sap.syncPost
  • Ajax.Request
  • Ext.Ajax.request
  • CQ.Ext.Ajax.request

Once the JQuery extension analysis is finished, the analyzer will give the output, i.e., the final number of web service calls created.

These web services are resolved to web service operations on the server side for the following supported frameworks: Node.js, JAX-RS, Spring MVC:

$.ajax

$.ajax({
	type: 'POST',
	url: val ? '_auth/login' : '_auth/logout',
	data: {assertion: assertion},
	success: function(res, status, xhr) { window.location.reload(); },
	error: function(xhr, status, err) {
		box.remove();
		navigator.id.logout();
		alert('Login failure: ' + err);
	}
});

$.get

$.get("ajax/test.html", function( data ) 
	{ 
		$( ".result" ).html( data ); 
		alert( "Load was performed." ); 
	}
);

$.post

$.post( "ajax/test.html", function( data ) { $( ".result" ).html( data ); });

jQuery.sap.syncGet

jQuery.sap.syncGet("syncGet_url", { dataType: "json" });

jQuery.sap.syncGetJSON

jQuery.sap.syncGetJSON("syncGetJSON_url", { dataType: "json" });

jQuery.sap.syncGetText

jQuery.sap.syncGetText("syncGetText_url", { dataType: "json" });

jQuery.sap.syncPost

jQuery.sap.syncPost("syncPost_url", { dataType: "json" });

Ajax.request

new Ajax.Request('/your/url', {
  onSuccess: function(response) {
    // Handle the response content...
  }
});

Ext.Ajax.request

Ext.Ajax.request({
            url: '/api/students',
            method: 'GET',
            timeout: 60000,
            params:
            {
                id: 1 // loads student whose Id is 1
            },
            headers:
            {
                'Content-Type': 'application/json'
            },
            success: function (response) {
            
            },
            failure: function (response) {
                Ext.Msg.alert('Status', 'Request Failed.');

            }
        });

CQ.Ext.Ajax.request

CQ.Ext.Ajax.request({
   url: 'foo.php',
   success: someFn,
   failure: otherFn,
   headers: {
       'my-header': 'foo'
   },
   params: { foo: 'bar' }
});

Objects

The following specific objects are displayed in CAST Enlighten:

IconDescription
jQuery Selector

jQuery $.ajax, $.get, $.getJSON, $.getScript

jQuery SAP sjax, syncGet, syncGetJSON, syncGetText

Get Resource Service

jQuery $.ajax, $.get, $.getJSON, $.getScript

 jQuery SAP syncPost Post Resource Service

jQuery $.ajax, $.get, $.getJSON, $.getScript Put Resource Service
jQuery $.ajax, $.get, $.getJSON, $.getScript Delete Resource Service

Structural Rules

The following structural rules are provided: