2010-01-22 2 views
0

사용자 입력을 캡처하기 위해 flex 양식을 사용하는 어플리케이션이 있습니다. 사용자가 (도면 영역을 포함하는) 양식 데이터를 입력하면 응용 프로그램은 양식의 jpg 이미지를 생성하고 서버로 다시 전송합니다. 데이터는 민감하므로 https를 사용해야합니다. 또한 클라이언트는 jpg 및 pdf 버전의 양식을 모두 서버에 저장해야합니다.IE crossdomain 필터 on flex 어플리케이션

응용 프로그램은 세 단계

다시 데이터를 전송

1 - 주문 번호

2 jpg이 스냅 샷을 보내 - 포스트 데이터로 양식 데이터 필드를 보낼 수는 주소 표시 줄에 표시되지 않도록

3 - pdf 데이터를 보내십시오.

urlloader를 사용하여 jpg 데이터를 먼저 보내고 opperation 2와 3을 수행하기 전에 서버가 응답 할 때까지 기다렸다가 서버가 새로운 주문 번호.

이 코드는 http 이상의 IE에서 제대로 작동합니다. 그러나 https를 통해 응용 프로그램을 사용하려고하면 IE는 store jpg 단계에서 페이지 응답을 차단하고 urlloader의 complete 이벤트는 실행되지 않습니다. 응용 프로그램은 http 또는 https를 통해 FireFox에서 제대로 작동합니다. 여기

은 (I "는"인 도메인을 교체 한) crossdomain.xml이있다 :

여기
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> 

<cross-domain-policy> 

    <allow-access-from domain="*.<mydomain>.com" to-ports="*" secure="false"/> 
    <allow-http-request-headers-from domain="*.<mydomain>.com" headers="*"> 

</cross-domain-policy> 

사용자가 제출 누를 때 실행되는 코드이다 버튼 :

전용 loaderCompleteHandler 함수 (이벤트 이벤트) : 무효 {

  sendPDF(); 
      sendPatientData(); 
     } 


     private function submitOrder(pEvt:MouseEvent):void 
     { 
      //disable submit form so the order can't be submitted twice 
      formIsValid = false; 
      waitVisible = true; 

      //submit the jpg image first with the order number, userID, provID 
      //and order type. The receiveing asp will create the new order record 
      //and save the jpg file. jpg MUST be sent first. 
      orderNum = userID + "." + provID + "." + Date().toString() + "." + orderType; 

      var jpgURL:String = "https://orders.mydomain.com/orderSubmit.asp?sub=jpg&userID=" + userID + "&provID=" + provID + "&oNum=" + orderNum + "&oType=" + orderType; 

      var jpgSource:BitmapData = new BitmapData (vbxPrint.width, vbxPrint.height); 
      jpgSource.draw(vbxPrint); 
      var jpgEncoder:JPEGEncoder = new JPEGEncoder(100); 
      var jpgStream:ByteArray = jpgEncoder.encode(jpgSource); 

      var header:URLRequestHeader = new URLRequestHeader ("content-type", "application/octet-stream"); 

      //Make sure to use the correct path to jpg_encoder_download.php 
      var jpgURLRequest:URLRequest = new URLRequest (jpgURL);  
      jpgURLRequest.requestHeaders.push(header);    
      jpgURLRequest.method = URLRequestMethod.POST;    
      jpgURLRequest.data = jpgStream; 

      //navigateToURL(jpgURLRequest, "_blank"); 

      var jpgURLLoader:URLLoader = new URLLoader(); 

      try 
      { 
       jpgURLLoader.load(jpgURLRequest); 
      } 
      catch (error:ArgumentError) 
      { 
       trace("An ArgumentError has occurred."); 
      } 
      catch (error:SecurityError) 
      { 
       trace("A SecurityError has occurred."); 
      } 

      jpgURLLoader.addEventListener(Event.COMPLETE, loaderCompleteHandler); 

     } 


     private function sendPatientData():void 
     { 
      var dataURL:String = "https://orders.mydomain.com/orderSubmit.asp?sub=data&oNum=" + orderNum + "&oType=" + orderType; 

      //Make sure to use the correct path to jpg_encoder_download.php 
      var dataURLRequest:URLRequest = new URLRequest (dataURL);  
      dataURLRequest.method = URLRequestMethod.POST; 
      var dataUrlVariables:URLVariables = new URLVariables(); 

      dataUrlVariables.userID = userID 
      dataUrlVariables.provID = provID 
      dataUrlVariables.name = txtPatientName.text 
      dataUrlVariables.dob = txtDOB.text 
      dataUrlVariables.contact = txtPatientContact.text 
      dataUrlVariables.sex=txtSex.text 
      dataUrlVariables.ind=txtIndications.text 

      dataURLRequest.data = dataUrlVariables 
      navigateToURL(dataURLRequest, "_self");  

     } 

     private function sendPDF():void 
     { 
      var url:String = "https://orders.mydomain.com/pdfOrderForm.asp" 
      var fileName:String = "orderPDF.pdf&sub=pdf&oNum=" + orderNum + "&oType=" + orderType + "&f=2&t=1" + "&mid=" + ModuleID.toString() 
      var jpgSource:BitmapData = new BitmapData (vbxPrint.width, vbxPrint.height); 
      jpgSource.draw(vbxPrint); 
      var jpgEncoder:JPEGEncoder = new JPEGEncoder(100); 
      var jpgStream:ByteArray = jpgEncoder.encode(jpgSource); 

      myPDF = new PDF(Orientation.LANDSCAPE,Unit.INCHES,Size.LETTER); 
      myPDF.addPage(); 
      myPDF.addImageStream(jpgStream,0,0, 0, 0, 1,ResizeMode.FIT_TO_PAGE); 
      myPDF.save(Method.REMOTE,url,Download.ATTACHMENT,fileName); 

     } 

대상 ASP 페이지 t 제외하고, 데이터를 다시 전송하지 그는 기본 사이트 페이지 템플릿입니다.

누구든지이 IE 크로스 도메인 문제를 해결하는 방법을 알아낼 수 있습니까? IE 도구 보안 설정에서 XSS 필터를 해제했지만 여전히 문제가 해결되지 않았습니다.

고맙습니다

답변

1

https로 모든 것을 수행하십시오. https URL에서 swf를로드하십시오. https를 통해 초기 양식 게시를 보냅니다. https를 통해 이미지를 보냅니다.

+0

감사합니다. Sam. swf를로드하는 페이지는 https url에서 왔으며 flex 코드의 모든 URL은 명시 적으로 https : // url입니다. 최근에 X-XSS-Protection : 0 헤더를 서버 응답에 추가했습니다. 나는 여전히 URLLoader에서 Complete 이벤트를 얻는 것 같지 않습니다. –