Class EditorService

java.lang.Object
org.exoplatform.onlyoffice.rest.EditorService
All Implemented Interfaces:
org.exoplatform.services.rest.resource.ResourceContainer

public class EditorService extends Object implements org.exoplatform.services.rest.resource.ResourceContainer
REST service implementing Onlyoffice config storage service.
Created by The eXo Platform SAS.
Version:
$Id: EditorService.java 00000 Feb 12, 2016 pnedonosko $
Author:
Peter Nedonosko
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The Constant API_VERSION.
    protected final OnlyofficeEditorService
    The editors.
    protected final Map<UUID,Config>
    The initiated.
    protected static final org.exoplatform.services.log.Log
    The Constant LOG.
  • Constructor Summary

    Constructors
    Constructor
    Description
    REST cloudDrives uses OnlyofficeEditorService for actual job.
  • Method Summary

    Modifier and Type
    Method
    Description
    javax.ws.rs.core.Response
    configPost(javax.ws.rs.core.UriInfo uriInfo, jakarta.servlet.http.HttpServletRequest request, String workspace, String path)
    Create configuration for Onlyoffice JS.
    javax.ws.rs.core.Response
    content(javax.ws.rs.core.UriInfo uriInfo, jakarta.servlet.http.HttpServletRequest request, String userId, String key)
    Document content download link.
    protected String
    getClientHost(jakarta.servlet.http.HttpServletRequest request)
    Gets the client host.
    protected String
    getClientIpAddr(jakarta.servlet.http.HttpServletRequest request)
    Gets the client ip addr.
    javax.ws.rs.core.Response
    getVersions(javax.ws.rs.core.UriInfo uriInfo, jakarta.servlet.http.HttpServletRequest request, String workspace, String key, int itemParPage, int pageNum)
    Getting versions of the given document
    protected boolean
    Checks if is valid host.
    javax.ws.rs.core.Response
    localState(javax.ws.rs.core.UriInfo uriInfo, String userId, String key)
    Editing document state in local storage.
    protected boolean
    Check string is not empty.
    javax.ws.rs.core.Response
    status(javax.ws.rs.core.UriInfo uriInfo, jakarta.servlet.http.HttpServletRequest request, String userId, String key, String statusText)
    Config status posted from the Document Server.
    javax.ws.rs.core.Response
    versionGet(javax.ws.rs.core.UriInfo uriInfo, jakarta.servlet.http.HttpServletRequest request)
    Return Onlyoffice REST API version.
    javax.ws.rs.core.Response
    viewerConfig(jakarta.servlet.http.HttpServletRequest request, String workspace, String fileId)
    Viewer config.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • API_VERSION

      public static final String API_VERSION
      The Constant API_VERSION.
      See Also:
    • LOG

      protected static final org.exoplatform.services.log.Log LOG
      The Constant LOG.
    • editors

      protected final OnlyofficeEditorService editors
      The editors.
    • initiated

      protected final Map<UUID,Config> initiated
      The initiated.
  • Constructor Details

  • Method Details

    • status

      public javax.ws.rs.core.Response status(@Context javax.ws.rs.core.UriInfo uriInfo, @Context jakarta.servlet.http.HttpServletRequest request, String userId, String key, String statusText)
      Config status posted from the Document Server.
      WARNING! It is publicly accessible service but access from the Documents Server host can be restricted (by default).
      Parameters:
      uriInfo - - request info
      request - the request
      userId - the user id
      key - - config key generated when requested editor config
      statusText - the status text
      Returns:
      Response
    • content

      public javax.ws.rs.core.Response content(@Context javax.ws.rs.core.UriInfo uriInfo, @Context jakarta.servlet.http.HttpServletRequest request, String userId, String key)
      Document content download link.
      WARNING! It is publicly accessible service but access from the Documents Server host can be restricted (by default).
      Parameters:
      uriInfo - - request info
      request - the request
      userId - the user id
      key - - file key generated by /config method
      Returns:
      Response
    • viewerConfig

      public javax.ws.rs.core.Response viewerConfig(@Context jakarta.servlet.http.HttpServletRequest request, String workspace, String fileId)
      Viewer config.
      Parameters:
      request - the request
      workspace - the workspace
      fileId - the file id
      Returns:
      the response
    • configPost

      @RolesAllowed("users") public javax.ws.rs.core.Response configPost(@Context javax.ws.rs.core.UriInfo uriInfo, @Context jakarta.servlet.http.HttpServletRequest request, String workspace, String path)
      Create configuration for Onlyoffice JS.
      Parameters:
      uriInfo - - request with base URI
      request - the request
      workspace - the workspace
      path - the path
      Returns:
      response with
    • versionGet

      public javax.ws.rs.core.Response versionGet(@Context javax.ws.rs.core.UriInfo uriInfo, @Context jakarta.servlet.http.HttpServletRequest request)
      Return Onlyoffice REST API version.
      Parameters:
      uriInfo - - request with base URI
      request - the request
      Returns:
      response with
    • localState

      @RolesAllowed("users") public javax.ws.rs.core.Response localState(@Context javax.ws.rs.core.UriInfo uriInfo, String userId, String key)
      Editing document state in local storage.
      Parameters:
      uriInfo - - request info
      userId - the user id
      key - - config key generated when requested editor config
      Returns:
      Response
    • getVersions

      @RolesAllowed("users") public javax.ws.rs.core.Response getVersions(@Context javax.ws.rs.core.UriInfo uriInfo, @Context jakarta.servlet.http.HttpServletRequest request, String workspace, String key, int itemParPage, int pageNum)
      Getting versions of the given document
      Parameters:
      uriInfo - the request info
      request - the request
      workspace - the document workspace
      key - the document key
      itemParPage - the versions par page
      pageNum - the page number to load
      Returns:
      Response
    • getClientIpAddr

      protected String getClientIpAddr(jakarta.servlet.http.HttpServletRequest request)
      Gets the client ip addr.
      Parameters:
      request - the request
      Returns:
      the client ip addr
    • getClientHost

      protected String getClientHost(jakarta.servlet.http.HttpServletRequest request)
      Gets the client host.
      Parameters:
      request - the request
      Returns:
      the client host
    • notEmpty

      protected boolean notEmpty(String str)
      Check string is not empty.
      Parameters:
      str - the str
      Returns:
      true, if not empty, false otherwise
    • isValidHost

      protected boolean isValidHost(String host)
      Checks if is valid host. It's a trivial check for null, non empty string and not "unknown" text.
      Parameters:
      host - the host name or IP address
      Returns:
      true, if is valid host