Chapter 14 Other InterSystems %Net Tools

Here is a short list of some other useful classes in %Net:

%Net.URLParser

InterSystems IRIS provides a utility class % net.urlParser that you can use to parse URL strings into their components. This is useful, for example, when you redirect HTTP requests.

The class contains a class method Parse() that takes a string containing the URL value and returns an array containing the parts of the URL by reference. Such as:

/// w ##class(PHA.TEST.HTTP).URLParser()
ClassMethod URLParser(a)
{
	Set url = "https://www.google.com/search?q=Java+site%3Adocs.intersystems.com&oq=Java+site%3Adocs.intersystems.com"
	Do ##class(%Net.URLParser).Parse(url.components)
	zw components
}
Copy the code
DHC-APP>w ##class(PHA.TEST.HTTP).URLParser()
components("fragment")=""
components("host")="www.google.com"
components("netloc")="www.google.com"
components("params")=""
components("path")="/search"
components("query")="q=Java+site%3Adocs.intersystems.com&oq=Java+site%3Adocs.intersystems.com"
components("scheme")="https"
 
Copy the code

When returned, the component will contain an array of parts of this URL:

Element Value Description
components("fragment") null Fragment of URL (after # character)
components("host") www.google.com Host of the URL request
components("netloc") www.google.com The network address of the URL
components("params") URL parameter contained in the URL
components("path") /search URL file path
components("query") q=Java+site%3Adocs.intersystems.com&oq=Java+site%3Adocs.intersystems.com The query string contained in the URL
components("scheme") https The transport scheme specified by this URL

%Net.Charset

You can use % net.charset to represent MIME character sets within InterSystems IRIS and map these character sets to the InterSystems IRIS locale. This class includes the following class methods:

  • GetDefaultCharset()Returns the default character set for the current InterSystems IRIS locale.
  • GetTranslateTable()Returns the name of the InterSystems IRIS conversion table for the given input character set.
  • TranslateTableExists()Indicates whether the conversion table for the given character set has been loaded.

%Net.TelnetStream

Windows NT telnet.exe handshake behavior can be simulated using % net.telnetStream.

%Net Security Classes

The %Net package provides a number of classes for authentication and security.