JAVA WOPI:GetFileContent API的返回类型应该是什么? [英] JAVA WOPI : What should be the return type of GetFileContent API?

查看:305
本文介绍了JAVA WOPI:GetFileContent API的返回类型应该是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功使用Microsoft的Office Online客户端实现JAVA WOPI主机 Office
365云存储合作伙伴计划




现在我想使用Custom WOPI客户端实现相同的流程( Office
Web Apps Server )。 

我假设wopi主机代码的变化很小。到目前为止我已经实现了这些: 


  • 已部署的Office Web Server 在Windows Server 2012 R2上。
  • Up WOPI Host
  • GetFileInfo API是第一个应该调用的API,是的,它正在调用,我可以看到具有正确值的JSON。
  • GetFileContent API也在GetFileInfo API调用之后调用,但我无法在浏览器上看到该文件。 


下面是获取文件内容的JAVA代码片段,我可以看到这个方法调用并在字节流中发回文件内容,但是我无法在浏览器上看到该文件。  

Below is the JAVA code snippet for get file content, I can see this method gets invoke and sending back the file content in byte streams but I can't see the file on browser. 

    @GET
    @Path("/{fileName}/contents")
    @Produces(MediaType.APPLICATION_OCTET_STREAM)
    public Response getFileContent(@PathParam("fileName") String fileName,@Context HttpServletRequest httpRequest) {

    final String filePath = "C:/wopi-docs/"+fileName;
    File file = new File(filePath);

    byte[] content = null;
     try {  

        content = FileUtils.readFileToByteArray(file);      

    } catch (IOException e) {
        e.printStackTrace();
    }
     return Response.status(Response.Status.OK).entity(new ByteArrayInputStream(content)).build();
} 



这与我们在Office Online中使用它时的工作方式相同,但不适用于Office Web Apps Server。

This is the same method which is working when we use it with Office Online but doesn't work with Office Web Apps Server.


任何输入或指针都会非常感激。

Any input or pointers would be greatly appreciated.

推荐答案

根据您的描述,我会将您的主题移至相应的论坛。

Based on your description, I will move your thread to the corresponding forum.

问候,

Melon Chen

TechNet社区支持

Melon Chen
TechNet Community Support


这篇关于JAVA WOPI:GetFileContent API的返回类型应该是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆