Beispiel: Auf Daten basierter Inline-Aufruf

Für diesen Ansatz werden folgende Anpassungen für die Lösungsvorlage benötigt, sodass die Anwendung „Korrespondenz erstellen“ diese Parameter über eine POST-Anforderung akzeptieren kann:
  1. Ändern Sie die JSP-Vorlage „Korrespondenz erstellen“. Die JSP-Datei „Korrespondenz erstellen“ (@ CorrespondenceManagementSolutionTemplate/CreateCorrespondence/html-template/ccr.jsp) kann geändert werden, um diese Parameter zu akzeptieren und sie als Flash-Variablen, die in der Anwendung „Korrespondenz erstellen“ gelesen werden können, zu kodieren. Beispiel:
    // used from InvokeParams.as 
    String _PREFIX = "cm"; 
    String URLPARAM_LETTERID = _PREFIX + "LetterId"; 
    String URLPARAM_LETTERNAME = _PREFIX + "LetterName"; 
    String URLPARAM_LETTERVERSION = _PREFIX + "LetterVersion"; 
    String URLPARAM_USELATEST = _PREFIX + "UseLatest"; 
    String URLPARAM_USETESTDATA = _PREFIX + "UseTestData"; 
    String URLPARAM_DATA = _PREFIX + "Data"; 
    String URLPARAM_DATAURL = _PREFIX + "DataUrl"; 
    String URLPARAM_PREVIEW = _PREFIX + "Preview"; 
    // used from InvokeParams.as 
     
    String encodedFlashVars = "localeChain=" + localeChain; 
     
    String letterId = (String) request.getParameter(URLPARAM_LETTERID); 
    if (letterId != null && !"".equals(letterId)) 
        encodedFlashVars += "&" + URLPARAM_LETTERID + "=" + URLEncoder.encode(letterId); 
     
    String letterName = (String) request.getParameter(URLPARAM_LETTERNAME); 
    if (letterName != null && !"".equals(letterName)) 
        encodedFlashVars += "&" + URLPARAM_LETTERNAME + "=" + letterName; 
     
    String letterVersion = (String) request.getParameter(URLPARAM_LETTERVERSION); 
    if (letterVersion != null && !"".equals(letterVersion)) 
        encodedFlashVars += "&" + URLPARAM_LETTERVERSION + "=" + letterVersion; 
     
    String useLatest = (String) request.getParameter(URLPARAM_USELATEST); 
    if (useLatest != null && !"".equals(useLatest)) 
        encodedFlashVars += "&" + URLPARAM_USELATEST + "=" + useLatest; 
     
    String useTestData = (String) request.getParameter(URLPARAM_USETESTDATA); 
    if (useTestData != null && !"".equals(useTestData)) 
        encodedFlashVars += "&" + URLPARAM_USETESTDATA + "=" + useTestData; 
     
    String data = (String) request.getParameter(URLPARAM_DATA); 
    if (data != null && !"".equals(data)) 
        encodedFlashVars += "&" + URLPARAM_DATA + "=" + URLEncoder.encode(data); 
     
    String dataUrl = (String) request.getParameter(URLPARAM_DATAURL); 
    if (dataUrl != null && !"".equals(dataUrl)) 
        encodedFlashVars += "&" + URLPARAM_DATAURL + "=" + URLEncoder.encode(dataUrl); 
     
    String preview = (String) request.getParameter(URLPARAM_PREVIEW); 
    if (preview != null && !"".equals(preview)) 
        encodedFlashVars += "&" + URLPARAM_PREVIEW + "=" + preview;
  2. Sie können dann die oben kodierten Flash-Variablen (Zeichenfolge) in einer JavaScript-Variable in der Datei „ccr.jsp“ erfassen und sie als Flash-Variablen zu Ihrer Anwendung (SWF-Datei) weiterleiten:
    • JavaScript
      <script language="JavaScript" type="text/javascript"> 
      .... 
       
      var flashVarsStr = "<%= encodedFlashVars %>"; 
       
      ....
    • SWF Loader
      .... 
          AC_FL_RunContent( 
                  "id",                     "ccrSwf", 
                  "name",                 "ccrSwf", 
                  "src",                     "${swf}", 
                  "flashVars",                             flashVarsStr, 
                  "width",                 "${width}", 
                  "height",                 "${height}", 
                  "align",                 "middle", 
                  "quality",                 "high", 
                  "bgcolor",                 "${bgcolor}", 
                  "wmode",                 dcWMode, 
                  "allowScriptAccess",    "sameDomain", 
                  "type",                 "application/x-shockwave-flash", 
                  "pluginspage",             "http://www.adobe.com/go/getflashplayer" 
          );
    • Die Datei „ccr.jsp“:
      <!-- saved from url=(0014)about:internet --> 
      <%@page import="java.util.*"%> 
      <%@page import="java.net.*"%> 
      <html lang="en"> 
      <!-- 
       * ADOBE SYSTEMS INCORPORATED 
       * ___________________________ 
       * 
       *  Copyright 2010 Adobe Systems Incorporated 
       *  All Rights Reserved. 
       * 
       * NOTICE:  All information contained herein is, and remains the property of Adobe Systems 
       * Incorporated and its suppliers, if any. The intellectual and technical concepts contained 
       * herein are proprietary to Adobe Systems Incorporated and its suppliers and may be covered 
       * by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright 
       * law. Dissemination of this information or reproduction of this material is strictly forbidden 
       * unless prior written permission is obtained from Adobe Systems Incorporated. 
       // --> 
       
      <!-- 
      Smart developers always View Source. 
       
      This application was built using Adobe Flex, an open source framework 
      for building rich Internet applications that get delivered via the 
      Flash Player or to desktops via Adobe AIR. 
       
      Learn more about Flex at http://flex.org 
      // --> 
       
      <head> 
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
       
      <!--  BEGIN Browser History required section --> 
      <link rel="stylesheet" type="text/css" href="${history_css}" /> 
      <!--  END Browser History required section --> 
       
      <title>Create Correspondence</title> 
      <script src="/apps/solutions/cm/ccr/AC_OETags.js" language="javascript"></script> 
      <script src="/apps/solutions/cm/ccr/dcScript.js"  language="javascript"></script> 
      <!--  BEGIN Browser History required section --> 
      <script src="/apps/solutions/cm/ccr/history/history.js" language="javascript"></script> 
      <!--  END Browser History required section --> 
       
      <style> 
      body { 
          margin: 0px; 
          overflow: hidden 
      } 
      </style> 
      <script language="JavaScript" type="text/javascript"> 
       
      //CM specific params 
      var helpUrl="http://www.adobe.com/go/learn_dep_correspondence_management_11"; 
      var reconnectWaitDuration = "20"; 
       
      <!-- 
      // ----------------------------------------------------------------------------- 
      // Globals 
      // Major version of Flash required 
      var requiredMajorVersion = 10; 
      // Minor version of Flash required 
      var requiredMinorVersion = 2; 
      // Minor version of Flash required 
      var requiredRevision = 0; 
      // ----------------------------------------------------------------------------- 
      // --> 
       
      </script> 
      </head> 
       
      <body scroll="no" onresize="doOnResize()"> 
      <% 
          String acceptLang = request.getHeader("accept-language"); 
          if(acceptLang == null || "".equals(acceptLang.trim())) 
              acceptLang = "en-US"; 
          acceptLang = acceptLang.trim(); 
       
          String[] locales = acceptLang.split(","); 
          List localeChainList = new ArrayList(); 
          for(int i=0; i<locales.length; i++) 
          { 
              String locale =locales[i]; 
              if(locale.trim().startsWith("en") && !localeChainList.contains("en_US")) 
                  localeChainList.add("en_US"); 
              if(locale.trim().startsWith("de") && !localeChainList.contains("de_DE")) 
                  localeChainList.add("de_DE"); 
              if(locale.trim().startsWith("ja") && !localeChainList.contains("ja_JP")) 
                  localeChainList.add("ja_JP"); 
              if(locale.trim().startsWith("fr") && !localeChainList.contains("fr_FR")) 
                  localeChainList.add("fr_FR"); 
          } 
       
          String localeChain = ""; 
          if (localeChainList.isEmpty()) 
              localeChain = "en_US"; 
          else 
          { 
              StringBuilder sb = new StringBuilder(); 
              String delimiter =","; 
              for (int j=0; j<localeChainList.size(); j++) 
              { 
                  String x = (String)localeChainList.get(j); 
                  sb.append(x + delimiter); 
              } 
              sb.delete(sb.length()-delimiter.length(), sb.length()); 
           
              localeChain = sb.toString(); 
          } 
           
           
           // used from InvokeParams.as 
              String _PREFIX = "cm"; 
              String URLPARAM_LETTERID = _PREFIX + "LetterId"; 
              String URLPARAM_LETTERNAME = _PREFIX + "LetterName"; 
              String URLPARAM_LETTERVERSION = _PREFIX + "LetterVersion"; 
              String URLPARAM_USELATEST = _PREFIX + "UseLatest"; 
              String URLPARAM_USETESTDATA = _PREFIX + "UseTestData"; 
              String URLPARAM_DATA = _PREFIX + "Data"; 
              String URLPARAM_DATAURL = _PREFIX + "DataUrl"; 
              String URLPARAM_PREVIEW = _PREFIX + "Preview"; 
              // used from InvokeParams.as 
               
              String encodedFlashVars = "localeChain=" + localeChain; 
               
              String letterId = (String) request.getParameter(URLPARAM_LETTERID); 
              if (letterId != null && !"".equals(letterId)) 
                  encodedFlashVars += "&" + URLPARAM_LETTERID + "=" + URLEncoder.encode(letterId); 
               
              String letterName = (String) request.getParameter(URLPARAM_LETTERNAME); 
              if (letterName != null && !"".equals(letterName)) 
                  encodedFlashVars += "&" + URLPARAM_LETTERNAME + "=" + letterName; 
                   
              String letterVersion = (String) request.getParameter(URLPARAM_LETTERVERSION); 
              if (letterVersion != null && !"".equals(letterVersion)) 
                  encodedFlashVars += "&" + URLPARAM_LETTERVERSION + "=" + letterVersion; 
                   
              String useLatest = (String) request.getParameter(URLPARAM_USELATEST); 
              if (useLatest != null && !"".equals(useLatest)) 
                  encodedFlashVars += "&" + URLPARAM_USELATEST + "=" + useLatest; 
                   
              String useTestData = (String) request.getParameter(URLPARAM_USETESTDATA); 
              if (useTestData != null && !"".equals(useTestData)) 
                  encodedFlashVars += "&" + URLPARAM_USETESTDATA + "=" + useTestData; 
                   
              String data = (String) request.getParameter(URLPARAM_DATA); 
              if (data != null && !"".equals(data)) 
                  encodedFlashVars += "&" + URLPARAM_DATA + "=" + URLEncoder.encode(data); 
                   
              String dataUrl = (String) request.getParameter(URLPARAM_DATAURL); 
              if (dataUrl != null && !"".equals(dataUrl)) 
                  encodedFlashVars += "&" + URLPARAM_DATAURL + "=" + URLEncoder.encode(dataUrl); 
                   
              String preview = (String) request.getParameter(URLPARAM_PREVIEW); 
              if (preview != null && !"".equals(preview)) 
              encodedFlashVars += "&" + URLPARAM_PREVIEW + "=" + preview; 
           
           
           
           
      %> 
       
      <script language="JavaScript" type="text/javascript"> 
      <!-- 
      var flashVarsStr = "<%= encodedFlashVars %>"; 
       
       
      // the windowPreExitHandler() function, defined in dcScript.js, is called when the Browser window is closed 
      window.onbeforeunload = windowPreExitHandler; 
       
      // fix-up for Safari PDF display that still allows accessibility under IE 
      var dcWMode = "window"; 
      if (navigator.userAgent.indexOf("IE") >= 0 || 
          navigator.userAgent.indexOf("Safari")  >= 0) 
          dcWMode = "transparent"; 
       
       
       
      // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) 
      var hasProductInstall = DetectFlashVer(6, 0, 65); 
       
      // Version check based upon the values defined in globals 
      var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); 
       
       
      if ( hasProductInstall && !hasRequestedVersion ) 
      { 
          // DO NOT MODIFY THE FOLLOWING FOUR LINES 
          // Location visited after installation is complete if installation is required 
          var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; 
          var MMredirectURL = window.location; 
          document.title = document.title.slice(0, 47) + " - Flash Player Installation"; 
          var MMdoctitle = document.title; 
       
          AC_FL_RunContent( 
              "id",                     "ccrSwf", 
              "name",                 "ccrSwf", 
              "src",                     "playerProductInstall", 
              "FlashVars",             "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"", 
              "width",                 "100%", 
              "height",                 "100%", 
              "align",                 "middle", 
              "quality",                 "high", 
              "bgcolor",                 "#869ca7", 
              "wmode",                 dcWMode, 
              "allowScriptAccess",    "sameDomain", 
              "type",                 "application/x-shockwave-flash", 
              "pluginspage",             "http://www.adobe.com/go/getflashplayer" 
          ); 
      } 
      else if (hasRequestedVersion) 
      { 
          AC_FL_RunContent( 
                  "id",                     "ccrSwf", 
                  "name",                 "ccrSwf", 
                  "src",                     "/apps/solutions/cm/ccr/index", 
                  "flashVars",                 flashVarsStr, 
                  "width",                 "100%", 
                  "height",                 "100%", 
                  "align",                 "middle", 
                  "quality",                 "high", 
                  "bgcolor",                 "#869ca7", 
                  "wmode",                 dcWMode, 
                  "allowScriptAccess",    "sameDomain", 
                  "type",                 "application/x-shockwave-flash", 
                  "pluginspage",             "http://www.adobe.com/go/getflashplayer" 
          ); 
      } 
      else        // Flash Player version is too old or we can't detect the plug-in 
      { 
          var alternateContent = '' 
                + 'This content requires the Adobe Flash Player. ' 
                 + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; 
          document.write(alternateContent);  // insert non-Flash content 
      } 
       
      <!-- Add the division that will contain the PDF --> 
      document.write("<div id='divContainingIFrame' style='position: absolute; border: 2px; visibility: visible;'><object width='1' height='1' type='application/pdf' data='/apps/solutions/cm/ccr.pdf' /></div>"); 
      // --> 
      </script> 
       
      <noscript> 
          <br/><br/><br/><br/> 
          <p>This web page requires that your browser have scripting enabled.</p> 
          <p>Please enable scripting, and/or contact your system administrator.</p> 
      </noscript> 
       
      </body> 
      </html>
  3. Ändern Sie das Hauptanwendungs-ActionScript von „Korrespondenz erstellen“. Ändern Sie die Hauptanwendungs-ActionScript-Klasse von „Korrespondenz erstellen“ (@ CorrespondenceManagementSolutionTemplate/CreateCorrespondence/src/main/flex/com/adobe/solutions/cmg/ccr/presentation/CCRApplication.as), um die Flash-Variablen zu akzeptieren und die InvokeParams für die Anwendung „Korrespondenz erstellen“ auszufüllen/zu initialisieren. Nachdem die InvokeParams instanziiert wurden, können Sie die Parameter aus dem, was zu den Flash-Variablen weitergeleitet wird, laden/überschreiben.
    .... 
    invocationParams = new InvokeParams(htmlUrl); // load the params from what's in the URL 
                 
    // now load the params from what's been POSTed - perference is given to the POST data (if present), so as to reject anything that the user tries to override from the URL  
    buildInvocationParamsFromRequest(invocationParams); 
    ....             
     
    } 
     
    private function _buildInvocationParamsFromRequest(invocationParams:InvokeParams):void 
            { 
                var letterId:String = FlexGlobals.topLevelApplication.parameters[InvokeParams.URLPARAM_LETTERID]; 
                if (letterId && letterId.length > 0) 
                    invocationParams.letterId = letterId; 
                 
                var letterName:String = FlexGlobals.topLevelApplication.parameters[InvokeParams.URLPARAM_LETTERNAME]; 
                if (letterName && letterName.length > 0) 
                    invocationParams.letterName = letterName; 
                 
                var letterVersion:String = FlexGlobals.topLevelApplication.parameters[InvokeParams.URLPARAM_LETTERVERSION]; 
                if (letterVersion && letterVersion.length > 0) 
                    invocationParams.letterVersion = parseInt(letterVersion); 
                 
                var useLatest:String = FlexGlobals.topLevelApplication.parameters[InvokeParams.URLPARAM_USELATEST]; 
                if (useLatest && useLatest.length > 0) 
                    invocationParams.useLatest = (parseInt(useLatest) != 0); 
                 
                var useTestData:String = FlexGlobals.topLevelApplication.parameters[InvokeParams.URLPARAM_USETESTDATA]; 
                if (useTestData && useTestData.length > 0) 
                    invocationParams.useTestData = (parseInt(useTestData) != 0); 
                 
                var data:String = FlexGlobals.topLevelApplication.parameters[InvokeParams.URLPARAM_DATA]; 
                if (data && data.length > 0) 
                    invocationParams.xmlData = XML(data); 
                 
                var dataUrl:String = FlexGlobals.topLevelApplication.parameters[InvokeParams.URLPARAM_DATAURL]; 
                if (dataUrl && dataUrl.length > 0) 
                    invocationParams.dataUrl = dataUrl; 
                 
                var preview:String = FlexGlobals.topLevelApplication.parameters[InvokeParams.URLPARAM_PREVIEW]; 
                if (preview && preview.length > 0) 
                    invocationParams.preview = (parseInt(preview) != 0); 
                 
            }
  4. Kopieren Sie „ccr.jsp“ in „ccr.POST.jsp“. Um auf POST-Methoden basierte URL-Auflösung zu ermöglichen, erstellen Sie eine Kopie der Datei „CorrespondenceManagementSolutionTemplate\CreateCorrespondence\html-template\ccr.jsp„ als “ccr.POST.jsp“ im selben Speicherort.

  5. Erstellen Sie zum Anzeigen der Änderungen die Lösungsvorlage neu und stellen Sie sie erneut bereit. Informationen zum erneuten Erstellen und Bereitstellen finden Sie unter Lösungsvorlage erstellen und bereitstellen.

Durch diese Änderungen kann Ihre Anwendung eine POST-basierte Datenübertragung verarbeiten.

Hinweis: Authentifizieren Sie für die POST-basierte Datenübertragung die Sitzung mit CRX, bevor Sie die Aufrufanforderung „Post“ initiieren. Dazu müssen Sie die Seite des benutzerdefinierten Portals in CRX bereitstellen bzw. erstellen und die Berechtigung „jcr:read“ für anonyme Benutzer für diesen Knoten verweigern.