Class WopiHostService


  • @DeclareRoles("org.imixs.ACCESSLEVEL.MANAGERACCESS")
    @RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS")
    @Path("/wopi")
    @Produces("application/json")
    public class WopiHostService
    extends Object
    The WopiHostService implements a Rest Service for the Wopi protocol.

    A WOPI host does not need to implement every WOPI operation. WOPI hosts express their capabilities using properties in CheckFileInfo, such as SupportsLocks. In addition, WOPI actions specify the WOPI operations that must be supported in order to use that action, in the form of Action requirements.

    This service implements a minimum set of operations required in order to support the two major WOPI scenarios - viewing and editing.

    The files are contained in a workflow instance (workitem) or in a snapshot ItemCollection.

    The /id/ in the Rest API URLs is a combination a workitem $uniqueID followed by the filename

    /wopi/xxxxxxx-0000-0000-0000-yyyy_{FILENAME}

    If a snapshot exits than the API automatically loads the file content from the snapshot.

    Version:
    1.0
    Author:
    rsoika
    • Constructor Detail

      • WopiHostService

        public WopiHostService()
    • Method Detail

      • ping

        @GET
        @Path("/ping")
        public String ping()
        GET Method just to test the service readiness
        Parameters:
        requestBodyStream -
        Returns:
      • getFileInfo

        @GET
        @Path("/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}/files/{file}")
        @Produces("application/json")
        public javax.ws.rs.core.Response getFileInfo​(@PathParam("uniqueid")
                                                     String uniqueid,
                                                     @PathParam("file")
                                                     String file,
                                                     @QueryParam("access_token")
                                                     String accessToken)
        Returns the file details.

        The method expects an id consisting of a $uniqueid followed by the filename

        /wopi/xxxxxxx-0000-0000-0000-yyyy_{FILENAME}

        Parameters:
        name - - A string that specifies a file
        response - - The response to a CheckFileInfo call is JSON (as specified in RFC 4627) containing a number of properties, most of which are optional.
        Returns:
      • getFileContents

        @GET
        @Path("/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}/files/{file}/contents")
        public javax.ws.rs.core.Response getFileContents​(@PathParam("uniqueid")
                                                         String uniqueid,
                                                         @PathParam("file")
                                                         String file,
                                                         @QueryParam("access_token")
                                                         String accessToken)
        Opens a file and returns the file content as an octet-stream

        The method expects an id consisting of a $uniqueid followed by the filename

        /wopi/xxxxxxx-0000-0000-0000-yyyy_{FILENAME}

        If the file content was already modified before, the content is fetched from the local wopi file cache

        Parameters:
        name - - the file name to be opened
        Returns:
      • postFileContents

        @POST
        @PUT
        @Path("/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}/files/{file}/contents")
        public javax.ws.rs.core.Response postFileContents​(@PathParam("uniqueid")
                                                          String uniqueid,
                                                          @PathParam("file")
                                                          String file,
                                                          InputStream contentStream,
                                                          @QueryParam("access_token")
                                                          String accessToken,
                                                          @Context
                                                          javax.ws.rs.core.UriInfo info)
        This method stores a modified file content form the wopi client into the local wopi file cache.

        The method expects a $uniqueID and filename

        /wopi/xxxxxxx-0000-0000-0000-yyyy/files/{FILENAME}/contents

        The method returns a json file info object

        Parameters:
        name -
        content -