2017-12-15 8 views
-1

실제로 Adobe Flash Player가 포함 된 프로젝트에서 일하고 있습니다. 일부 Flex에서는 pdf 파일을 생성하는 서비스를 사용하는 spring mvc 컨트롤러에 포함 된 휴식 서비스를 호출합니다. 재스퍼 보고서. 여기 지원되지 않는 미디어 유형, Http 오류 415

는 ActionScript 메서드는 웹 서비스 호출 : 또한

private function editerCourrier():void{ 

//Security.loadPolicyFile("http://appserv01.siege.xm:4040/Editions/RetardLivraison/crossdomain.xml"); 
if(this.gridActivated == "mailing"){ 
    var request:URLRequest = new 

URLRequest("http://10.102.22.143:8280/edition_sc_retards_livraisons/Export/RetardLivraisonLettre"); 
     var hdr:URLRequestHeader = new URLRequestHeader("Content-type", "application/json"); 
     request.method = URLRequestMethod.POST; 
     request.requestHeaders.push(hdr); 
     var jsonArray:Array = new Array(); 
     jsonArray.push({ 
      "civilite" : "Mr.", 
      "destNom" : "TAMBE", 
      "destPrenom" : "JOEL", 
      "destAdresseFull" : "54 rue des Cocotiers", 
      "destCP" : "93270", 
      "destVille" : "ANTONY", 
      "nomPays" : "FRANCE", 
      "pjPath" : "http://192.168.200.97/intranet/e107_files/mail_attachement/MAIL_AVENANT_TEMPORAIRE_1507817106_1534679.txt" 
     }); 
     request.data = jsonArray; 
     navigateToURL(request,"win_cour"); 
    } 
} 

을, 여기에서 요청 헤더가 아니라 "콘텐츠"의 Content-Type "이름을 지정해야합니다

@Api 
@Controller 
public class RetardLivraisonLettreControllerImpl implements RetardLivraisonLettreController { 

    private static Logger logger = Logger.getLogger(RetardLivraisonLettreControllerImpl.class); 

    private final EditionConfig editionConfig; 

    private final EditionService editionService; 

    private static final String SUCCESS = "success"; 

    private static final String ERROR = "error"; 

    public RetardLivraisonLettreControllerImpl(EditionConfig editionConfig, EditionService editionService) { 
     this.editionConfig = editionConfig; 
     this.editionService = editionService; 
    } 

    @RequestMapping(value = "/Export/RetardLivraisonLettre", method = RequestMethod.POST, produces = "application/pdf", consumes = { 
      "application/json", 
      "application/x-www-form-urlencoded;charset=ISO-8859-1" }, headers = "Accept=application/x-www-form-urlencoded") 
    @Override 
    public ResponseEntity<String> retardLivraisonLettre(@RequestBody RetardLivraisonLettreBean bean, 
      HttpServletResponse response) throws InvalidParameterException { 

     logger.debug("appel retardLivraisonLettre"); 

     String nomCible = editionConfig.getNomCible(); 

     try { 
      // Download du PDF 
      logger.debug("Download du PDF"); 

      editionService.retardLivraisonLettre(bean, response.getOutputStream()); 

      response.setContentType("application/x-download"); 
      response.setHeader("Content-Disposition", "attachment; filename=" + nomCible); 
      response.getWriter().close(); 
      response.setHeader(SUCCESS, "Edition du PDF de la lettre de retard de livraison effectué avec succès"); 

     } catch (IOException e) { 
      logger.error(e.getMessage(), e); 
      response.setHeader(ERROR, "Erreur lors de l'édition du PDF de la lettre de retard de livraison effectué"); 
      return new ResponseEntity<String>(response.getHeader(ERROR), HttpStatus.BAD_REQUEST); 
     } 
     return new ResponseEntity<String>(response.getHeader(SUCCESS), HttpStatus.ACCEPTED); 
    } 
} 
+0

내 버튼이 이제 새 탭을 새로 열도록 트리거했기 때문에 제 질문을 편집했습니다. 하지만 http 415 오류가 발생했습니다. 도와주세요. –

답변

0

나머지 컨트롤러 -유형".

관련 문제