public class WOPIResource extends Object implements org.exoplatform.services.rest.resource.ResourceContainer
| Modifier and Type | Class and Description |
|---|---|
static class |
WOPIResource.Operation
The Enum Operation.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ACCESS_TOKEN
The Constant ACCESS_TOKEN.
|
protected static String |
API_VERSION
The Constant API_VERSION.
|
static String |
EDITOR_CONFIG_ATTRIBUTE
The Constant ACCESS_TOKEN.
|
protected static String |
FILE_CONVERSION
The Constant FILE_CONVERSION.
|
protected static String |
INVALID_FILE_NAME_ERROR
The Constant INVALID_FILE_NAME_ERROR.
|
protected static String |
ITEM_VERSION
The Constant ITEM_VERSION.
|
protected static String |
LOCK
The Constant LOCK.
|
protected static org.exoplatform.services.log.Log |
LOG
The Constant LOG.
|
protected static String |
MAX_EXPECTED_SIZE
The Constant MAX_EXPECTED_SIZE.
|
protected static String |
OLD_LOCK
The Constant OLD_LOCK.
|
protected static String |
OVERRIDE
The Constant OVERRIDE.
|
protected static String |
OVERWRITE_RELATIVE_TARGET
The Constant OVERWRITE_RELATIVE_TARGET.
|
protected static String |
PROOF
The Constant PROOF.
|
protected static String |
PROOF_OLD
The Constant PROOF_OLD.
|
protected static String |
RELATIVE_TARGET
The Constant RELATIVE_TARGET.
|
protected static String |
REQUESTED_NAME
The Constant REQUESTED_NAME.
|
protected static String |
SUGGESTED_TARGET
The Constant SUGGESTED_TARGET.
|
protected static String |
TIMESTAMP
The Constant TIMESTAMP.
|
protected static String |
URL_TYPE
The Constant URL_TYPE.
|
protected WOPIService |
wopiService
The editor service.
|
static String |
WRONG_TOKEN_ATTRIBUTE
The Constant WRONG_TOKEN.
|
| Constructor and Description |
|---|
WOPIResource(WOPIService wopiService)
Instantiates a new WOPI service.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addItemVersionHeader(javax.ws.rs.core.Response.ResponseBuilder response,
EditorConfig config)
Adds the item version header.
|
javax.ws.rs.core.Response |
available()
Endpoint for checking if WOPI is available.
|
javax.ws.rs.core.Response |
checkFileInfo(javax.ws.rs.core.UriInfo uriInfo,
javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletContext context)
Check file info.
|
protected String |
convertStreamToString(InputStream inputStream) |
javax.ws.rs.core.Response |
files(javax.ws.rs.core.UriInfo uriInfo,
javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletContext context,
WOPIResource.Operation operation,
String fileId)
Files.
|
protected String |
getClientHost(javax.servlet.http.HttpServletRequest request)
Gets the client host.
|
protected String |
getClientIpAddr(javax.servlet.http.HttpServletRequest request)
Gets the client ip addr.
|
protected EditorConfig |
getEditorConfig(javax.servlet.ServletContext context)
Gets the editor config.
|
javax.ws.rs.core.Response |
getFile(javax.ws.rs.core.UriInfo uriInfo,
javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletContext context,
String fileId)
Files.
|
protected boolean |
isValidHost(String host)
Checks if is valid host.
|
protected boolean |
notEmpty(String str)
Check string is not empty.
|
javax.ws.rs.core.Response |
putFile(javax.ws.rs.core.UriInfo uriInfo,
javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletContext context,
WOPIResource.Operation operation,
String fileId)
Files.
|
protected javax.ws.rs.core.Response |
putUserInfo(EditorConfig config,
String userInfo) |
protected void |
verifyProofKey(javax.servlet.http.HttpServletRequest request)
Verify proof key.
|
javax.ws.rs.core.Response |
versionGet(javax.ws.rs.core.UriInfo uriInfo,
javax.servlet.http.HttpServletRequest request)
Return Office Online REST API version.
|
public static final String ACCESS_TOKEN
public static final String WRONG_TOKEN_ATTRIBUTE
public static final String EDITOR_CONFIG_ATTRIBUTE
protected static final String FILE_CONVERSION
protected static final String ITEM_VERSION
protected static final String LOCK
protected static final String MAX_EXPECTED_SIZE
protected static final String OLD_LOCK
protected static final String OVERRIDE
protected static final String PROOF
protected static final String PROOF_OLD
protected static final String RELATIVE_TARGET
protected static final String OVERWRITE_RELATIVE_TARGET
protected static final String REQUESTED_NAME
protected static final String SUGGESTED_TARGET
protected static final String INVALID_FILE_NAME_ERROR
protected static final String URL_TYPE
protected static final String TIMESTAMP
protected static final String API_VERSION
protected static final org.exoplatform.services.log.Log LOG
protected final WOPIService wopiService
public WOPIResource(WOPIService wopiService)
wopiService - the wopi servicepublic javax.ws.rs.core.Response putFile(@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
javax.servlet.http.HttpServletRequest request,
@Context
javax.servlet.ServletContext context,
@HeaderParam(value="X-WOPI-Override")
WOPIResource.Operation operation,
String fileId)
uriInfo - the uri inforequest - the requestcontext - the contextoperation - the operationfileId - the file idpublic javax.ws.rs.core.Response getFile(@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
javax.servlet.http.HttpServletRequest request,
@Context
javax.servlet.ServletContext context,
String fileId)
uriInfo - the uri inforequest - the requestcontext - the contextfileId - the file idpublic javax.ws.rs.core.Response available()
public javax.ws.rs.core.Response files(@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
javax.servlet.http.HttpServletRequest request,
@Context
javax.servlet.ServletContext context,
@HeaderParam(value="X-WOPI-Override")
WOPIResource.Operation operation,
String fileId)
uriInfo - the uri inforequest - the requestcontext - the contextoperation - the operationfileId - the file idprotected javax.ws.rs.core.Response putUserInfo(EditorConfig config, String userInfo)
public javax.ws.rs.core.Response checkFileInfo(@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
javax.servlet.http.HttpServletRequest request,
@Context
javax.servlet.ServletContext context)
uriInfo - the uri inforequest - the requestcontext - the contextprotected void verifyProofKey(javax.servlet.http.HttpServletRequest request)
throws ProofKeyValidationException
request - the requestProofKeyValidationException - the proof key validation exceptionprotected EditorConfig getEditorConfig(javax.servlet.ServletContext context) throws AuthenticationFailedException, EditorConfigNotFoundException
context - the contextAuthenticationFailedException - the authentication failed exceptionEditorConfigNotFoundException - the editor config not found exceptionpublic javax.ws.rs.core.Response versionGet(@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
javax.servlet.http.HttpServletRequest request)
uriInfo - - request with base URIrequest - the requestprotected String getClientIpAddr(javax.servlet.http.HttpServletRequest request)
request - the requestprotected String getClientHost(javax.servlet.http.HttpServletRequest request)
request - the requestprotected void addItemVersionHeader(javax.ws.rs.core.Response.ResponseBuilder response,
EditorConfig config)
response - the responseconfig - the configprotected boolean notEmpty(String str)
str - the strprotected boolean isValidHost(String host)
null, non
empty string and not "unknown" text.host - the host name or IP addressprotected String convertStreamToString(InputStream inputStream) throws IOException
IOExceptionCopyright © 2003–2020 eXo Platform SAS. All rights reserved.