@Test(dependsOnMethods = {"testUploadMedia"}) public void testGetMedia() throws WxErrorException { File file = this.wxService.getMediaService().getMedia(this.mediaId); assertNotNull(file); System.out.println(file.getAbsolutePath()); }
@Override public File getMedia(String mediaId) throws WxErrorException { try { RequestExecutor<File, String> executor = BaseMediaDownloadRequestExecutor .create(this.wxMaService.getRequestHttp(), Files.createTempDirectory("wxma").toFile()); return this.wxMaService.execute(executor, MEDIA_GET_URL, "media_id=" + mediaId); } catch (IOException e) { throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e); } }
WxMaMediaServiceImpl implements WxMaMediaService { @Override public File getMedia(String mediaId) throws WxErrorException { try { RequestExecutor<File, String> executor = BaseMediaDownloadRequestExecutor .create(this.wxMaService.getRequestHttp(), Files.createTempDirectory("wxma").toFile()); return this.wxMaService.execute(executor, MEDIA_GET_URL, "media_id=" + mediaId); } catch (IOException e) { throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e); } } }
WxMaMediaServiceImpl implements WxMaMediaService { @Override public File getMedia(String mediaId) throws WxErrorException { try { RequestExecutor<File, String> executor = BaseMediaDownloadRequestExecutor .create(this.wxMaService.getRequestHttp(), Files.createTempDirectory("wxma").toFile()); return this.wxMaService.execute(executor, MEDIA_GET_URL, "media_id=" + mediaId); } catch (IOException e) { throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e); } } WxMaMediaServiceImpl(WxMaService wxMaService); }
WxMaMediaServiceImpl implements WxMaMediaService { @Override public File getMedia(String mediaId) throws WxErrorException { try { RequestExecutor<File, String> executor = BaseMediaDownloadRequestExecutor .create(this.wxMaService.getRequestHttp(), Files.createTempDirectory("wxma").toFile()); return this.wxMaService.execute(executor, MEDIA_GET_URL, "media_id=" + mediaId); } catch (IOException e) { throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e); } } WxMaMediaServiceImpl(WxMaService wxMaService); @Override WxMediaUploadResult uploadMedia(String mediaType, String fileType, InputStream inputStream); @Override WxMediaUploadResult uploadMedia(String mediaType, File file); @Override File getMedia(String mediaId); }
WxMaMediaServiceImpl implements WxMaMediaService { @Override public File getMedia(String mediaId) throws WxErrorException { try { RequestExecutor<File, String> executor = BaseMediaDownloadRequestExecutor .create(this.wxMaService.getRequestHttp(), Files.createTempDirectory("wxma").toFile()); return this.wxMaService.execute(executor, MEDIA_GET_URL, "media_id=" + mediaId); } catch (IOException e) { throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e); } } WxMaMediaServiceImpl(WxMaService wxMaService); @Override WxMediaUploadResult uploadMedia(String mediaType, String fileType, InputStream inputStream); @Override WxMediaUploadResult uploadMedia(String mediaType, File file); @Override File getMedia(String mediaId);  }