Citrix MetaFrame XP 1.0 for Windows with Feature Release 2

       

Использование скриптов веб-сервера


Этот раздел предназначен для пользователей, знакомых с написанием скриптов для Web и знакомых с объектами Java NFuse Classic.

Публикация контента использует новый метод findAppByExtension() на существующем объекте AppDataList object. Этот метод принимает адрес контента и просматривает список приложений в поиске того приложения, которое поддерживает этот тип контента. Например, если документ Microsoft Word опубликован в виде URL http://mywebsite/spec.doc, то следует использовать findAppByExtension(“http://mywebsite/spec.doc”).

Если приложение найдено, возвращается объект NFuse "App", описывающий опубликованное приложение. Это приложение затем может быть запущено посредством NFuse Classic, передавая в качестве параметра адрес опубликованного контента (в нашем примере http://mywebsite/spec.doc). Последние версии клиентов ICA (6.3 и более поздние) поддерживают спецификацию аргументов в командной строке используя настройку LongCommandLine (кроме ICA Java Client).

Основные шаги в написании скрипта:

  • Получить список опубликованных приложений, доступных пользователю
  • Найти приложение, ассоциированное с расширением контента
  • Запустить приложение, сгенерировав файл ICA.
  • Пример на ASP

    Получить список приложений Set credentials = Server.CreateObject("com.citrix.nfuse.ClearTextCredentials") credentials.initialize "user", "domain", "password" Set gateway = Server.CreateObject("com.citrix.nfuse.CitrixWireGateway") gateway.initialize credentials Set appList = gateway.getAppDataList() Найти приложение, ассоциированное с указанным типом Set contentApp = appList.findAppByExtension("http://mywebsite/spec.doc") Запустить приложение ' Создать объект TemplateParser (для генерации файла ICA) Set parser = Server.CreateObject("com.citrix.nfuse.TemplateParser") ' Настроить логин CookStr = "NFuse_User=user&NFuse_Domain=domain&NFuse_LogonMode=Explicit&NFuse_Password=password" ' Set these as cookie session fields parser.setCookieSessionFields(CookStr) ' Настроить опубликованное приложение на запуск контента urlSessionFields = "NFuse_Application=" & contentApp.getNameUrlEncoded & "&NFuse_AppFriendlyNameURLEncoded=" & contentApp.getFriendlyNameUrlEncoded ' Set these as URL session fields parser.setUrlSessionFields(UrlSessionFields) ' Set the address of the content to use as a command line argument parser.setSingleSessionField "NFuse_AppCommandLine", "http://mywebsite/spec.doc" ' Specify the template ICA file to use parser.setSingleSessionField "NFuse_Template", "template.ica" ' Generate the content of the ICA file and return as MIME type "x-ica" ' This will cause the browser to launch the ICA file and hence the ' published application. If parser.Parse() Then Response.ContentType = "application/x-ica" Continue = True While (Continue) HtmlString = parser.getNextDataBlock() If Len(HtmlString) = 0 Then Continue = False Else Response.write(HtmlString) End If Wend Else ' Parser failed. Attempt to display the published content using ' local (client side) application. Response.Redirect(docURL) End If


    Пример JSP

    Obtain the List of Applications ClearTextCredentials credentials = new ClearTextCredentials(); credentials.initialize("user", "domain", "password"); CitrixWireGateway gateway = new CitrixWireGateway(); gateway.initialize(credentials); AppDataList appList = gateway.getAppDataList(); Locate the Published Application Using File Type Association App contentApp = appList.findAppByExtension("http://mywebsite/spec.doc"); Launch the Application with the Content // Create a TemplateParser object (to generate the ICA file) TemplateParser parser = new TemplateParser(); // Set up the launching credentials String CookStr = "NFuse_User=user&NFuse_Domain=domain&NFuse_LogonMode=Explicit&NFuse_Password=password"; // Set these as cookie session fields parser.setCookieSessionFields(CookStr); // Set the published application to use for launching the content urlSessionFields = "NFuse_Application=" + contentApp.getNameUrlEncoded + "&NFuse_AppFriendlyNameURLEncoded=" + contentApp.getFriendlyNameUrlEncoded; // Set these as URL session fields parser.setUrlSessionFields(UrlSessionFields); // Set the address of the content to use as a command line argument parser.setSingleSessionField("NFuse_AppCommandLine", "http://mywebsite/spec.doc"); // Specify the template ICA file to use parser.setSingleSessionField("NFuse_Template", "template.ica"); // Generate the content of the ICA file and return as MIME type "x-ica" // This will cause the browser to launch the ICA file and hence the // published application. if (parser.Parse()) { String contentType = parser.getContentType(); response.setContentType(contentType); boolean continue = True; while (continue) { String HtmlString = parser.getNextDataBlock(); If (HtmlString.length() == 0) { continue = False; } else { out.println(HtmlString); } } } else { // Parser failed. Attempt to display the published content using // local (client side) application. response.sendRedirect(docURL); }

    Пример файла Template.ica

    [Encoding] InputEncoding=ISO8859_1 [WFClient] Version=2 ClientName=[NFuse_ClientName] RemoveICAFile=yes [ApplicationServers] [NFuse_AppName]= [[NFuse_AppName]] Address=[NFuse_AppServerAddress] InitialProgram=#[NFuse_AppName] LongCommandLine="[NFuse_AppCommandLine]" DesiredColor=[NFuse_WindowColors] TransportDriver=TCP/IP WinStationDriver=ICA 3.0 [NFuse_ClientLogon] [NFuse_SOCKSSettings] AutologonAllowed=ON [NFuse_Ticket] [NFuse_IcaAudio] [NFuse_IcaWindow] [NFuse_IcaEncryption] SessionsharingKey=[NFuse_SessionSharingKey]

    В начало


    Содержание раздела