文章
· 六月 2, 2021 阅读大约需 2 分钟

第十四章 其他InterSystems %Net工具

第十四章 其他InterSystems %Net工具

下面是%Net中其他一些有用类的简短列表:

%Net.URLParser

InterSystems IRIS提供了一个实用程序类%Net.URLParser,可以使用它将URL字符串解析为其组成部分。例如,当您重定向HTTP请求时,这很有用。

该类包含一个类方法Parse(),它接受一个包含URL值的字符串,并通过引用返回一个包含URL各部分的数组。例如:

/// w ##class(PHA.TEST.HTTP).URLParser()
ClassMethod URLParser()
{
    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
}
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"

返回时,组件将包含此URL各部分的数组:

Element Value Description
components("fragment") null URL的片段(#字符后面)
components("host") www.google.com URL请求的主机
components("netloc") www.google.com URL的网络地址
components("params") URL中包含的URL参数
components("path") /search URL的文件路径
components("query") q=Java+site%3Adocs.intersystems.com&oq=Java+site%3Adocs.intersystems.com URL中包含的查询字符串
components("scheme") https 此URL指定的传输方案

%Net.Charset

可以使用%Net.Charset表示InterSystems IRIS内的MIME字符集,并将这些字符集映射到InterSystems IRIS区域设置。此类包括以下类方法:

  • GetDefaultCharset()返回当前InterSystems IRIS区域设置的默认字符集。
  • GetTranslateTable()返回给定输入字符集的InterSystems IRIS转换表的名称。
  • TranslateTableExists()指示是否已加载给定字符集的转换表。

%Net.TelnetStream

可以使用%Net.TelnetStream模拟Windows NT Telnet.exe的握手行为。

%Net Security Classes

%Net包提供了许多用于身份验证和安全性的类。

讨论 (0)1
登录或注册以继续