Package org.exoplatform.onlyoffice.rest
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.
Created by The eXo Platform SAS.
- Version:
- $Id: EditorService.java 00000 Feb 12, 2016 pnedonosko $
- Author:
- Peter Nedonosko
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe Constant API_VERSION.protected final OnlyofficeEditorServiceThe editors.The initiated.protected static final org.exoplatform.services.log.LogThe Constant LOG. -
Constructor Summary
ConstructorsConstructorDescriptionEditorService(OnlyofficeEditorService editors) REST cloudDrives usesOnlyofficeEditorServicefor actual job. -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.ResponseconfigPost(javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest request, String workspace, String path) Create configuration for Onlyoffice JS.javax.ws.rs.core.Responsecontent(javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest request, String userId, String key) Document content download link.protected StringgetClientHost(javax.servlet.http.HttpServletRequest request) Gets the client host.protected StringgetClientIpAddr(javax.servlet.http.HttpServletRequest request) Gets the client ip addr.javax.ws.rs.core.ResponsegetVersions(javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest request, String workspace, String key, int itemParPage, int pageNum) Getting versions of the given documentprotected booleanisValidHost(String host) Checks if is valid host.javax.ws.rs.core.ResponselocalState(javax.ws.rs.core.UriInfo uriInfo, String userId, String key) Editing document state in local storage.protected booleanCheck string is not empty.javax.ws.rs.core.Responsestatus(javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest request, String userId, String key, String statusText) Config status posted from the Document Server.javax.ws.rs.core.ResponseversionGet(javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest request) Return Onlyoffice REST API version.javax.ws.rs.core.ResponseviewerConfig(javax.servlet.http.HttpServletRequest request, String workspace, String fileId) Viewer config.
-
Field Details
-
API_VERSION
The Constant API_VERSION.- See Also:
-
LOG
protected static final org.exoplatform.services.log.Log LOGThe Constant LOG. -
editors
The editors. -
initiated
The initiated.
-
-
Constructor Details
-
EditorService
REST cloudDrives usesOnlyofficeEditorServicefor actual job.- Parameters:
editors- the editors
-
-
Method Details
-
status
public javax.ws.rs.core.Response status(@Context javax.ws.rs.core.UriInfo uriInfo, @Context javax.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 inforequest- the requestuserId- the user idkey- - config key generated when requested editor configstatusText- the status text- Returns:
Response
-
content
public javax.ws.rs.core.Response content(@Context javax.ws.rs.core.UriInfo uriInfo, @Context javax.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 inforequest- the requestuserId- the user idkey- - file key generated by /config method- Returns:
Response
-
viewerConfig
public javax.ws.rs.core.Response viewerConfig(@Context javax.servlet.http.HttpServletRequest request, String workspace, String fileId) Viewer config.- Parameters:
request- the requestworkspace- the workspacefileId- the file id- Returns:
- the response
-
configPost
@RolesAllowed("users") public javax.ws.rs.core.Response configPost(@Context javax.ws.rs.core.UriInfo uriInfo, @Context javax.servlet.http.HttpServletRequest request, String workspace, String path) Create configuration for Onlyoffice JS.- Parameters:
uriInfo- - request with base URIrequest- the requestworkspace- the workspacepath- the path- Returns:
- response with
-
versionGet
public javax.ws.rs.core.Response versionGet(@Context javax.ws.rs.core.UriInfo uriInfo, @Context javax.servlet.http.HttpServletRequest request) Return Onlyoffice REST API version.- Parameters:
uriInfo- - request with base URIrequest- 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 infouserId- the user idkey- - 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 javax.servlet.http.HttpServletRequest request, String workspace, String key, int itemParPage, int pageNum) Getting versions of the given document- Parameters:
uriInfo- the request inforequest- the requestworkspace- the document workspacekey- the document keyitemParPage- the versions par pagepageNum- the page number to load- Returns:
Response
-
getClientIpAddr
Gets the client ip addr.- Parameters:
request- the request- Returns:
- the client ip addr
-
getClientHost
Gets the client host.- Parameters:
request- the request- Returns:
- the client host
-
notEmpty
Check string is not empty.- Parameters:
str- the str- Returns:
- true, if not empty, false otherwise
-
isValidHost
Checks if is valid host. It's a trivial check fornull, non empty string and not "unknown" text.- Parameters:
host- the host name or IP address- Returns:
- true, if is valid host
-