public class SoftwareServerRestlet
extends org.restlet.resource.ServerResource
Constructor and Description |
---|
SoftwareServerRestlet() |
Modifier and Type | Method and Description |
---|---|
void |
executeTask(int session,
String application_alias,
String task_string,
String file,
String format)
Execute a task.
|
void |
executeTaskAtomically(int session,
String application_alias,
String task_string,
String file,
String format)
Execute a task (synchronized version).
|
void |
executeTaskLater(int session,
String application_alias,
String task_string,
String file,
String format)
Execute a task asynchronously.
|
String |
getApplications()
Get the applications available.
|
static org.json.JSONArray |
getApplicationsJson() |
String |
getApplicationStack()
Get an icon representation of the available software.
|
String |
getApplicationTaskInputs(String alias,
String task)
Get the input formats supported by the given task.
|
String |
getApplicationTaskInputsOutputs(String alias,
String task)
Get the input and output formats supported by the given task.
|
String |
getApplicationTaskOutputs(String alias,
String task)
Get the output formats supported by the given task.
|
String |
getApplicationTasks(String alias)
Get the tasks available for the given application.
|
String |
getConvertForm()
Get a web form interface for converting via this restful service.
|
static String |
getFilename(String filename)
Parse the filename from the cached public filename (leaves on prepended public output directories!).
|
static String |
getFilenameName(String filename,
boolean MULTIPLE_EXTENSIONS)
Get the name of a file from the cached public filename (i.e.
|
String |
getForm()
Get a web form interface for this restful service.
|
String |
getForm(boolean POST_UPLOADS,
String selected_application,
boolean HIDE_APPLICATIONS)
Get a web form interface for this restful service.
|
String |
getPublicIP()
Get the public IP determined by the software server.
|
static int |
getSession(String filename)
Parse the session id from the cached public filename (addressing that some may be in public output directories!).
|
Vector<SoftwareServerAuxiliary.Subtask> |
getTask(String application_alias,
String task_string,
String filename,
String output_format)
Get the task involved in using the given applications to convert the given file to the specified output format (treats all extensions as lower case).
|
org.restlet.representation.Representation |
httpGetHandler()
Handle HTTP GET requests.
|
org.restlet.representation.Representation |
httpPostHandler(org.restlet.representation.Representation entity) |
static void |
initialize()
Initialize.
|
static boolean |
isJSONRequest(org.restlet.Request request)
Check if the given request is for json only.
|
static boolean |
isPlainRequest(org.restlet.Request request)
Check if the given request is for plain text only.
|
static void |
main(String[] args)
Start the restful service.
|
void |
stop()
Stop the REST interface and underlying Software Server.
|
abort, commit, delete, delete, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doNegotiatedHandle, get, get, getAttribute, getDescription, getInfo, getInfo, getName, getOnSent, getPreferredVariant, getRole, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, options, patch, patch, post, post, put, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDescription, setDimensions, setExisting, setLocationRef, setLocationRef, setName, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensions
doError, doInit, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toString
public static void initialize()
public String getPublicIP()
public String getApplications()
public String getApplicationTasks(String alias)
alias
- the application aliaspublic String getApplicationTaskOutputs(String alias, String task)
alias
- the application aliastask
- the application taskpublic String getApplicationTaskInputs(String alias, String task)
alias
- the application aliastask
- the application taskpublic String getApplicationTaskInputsOutputs(String alias, String task)
alias
- the application aliastask
- the application taskpublic String getApplicationStack()
public String getForm(boolean POST_UPLOADS, String selected_application, boolean HIDE_APPLICATIONS)
POST_UPLOADS
- true if this form should use POST rather than GET for uploading filesselected_application
- the default applicationHIDE_APPLICATIONS
- true if applications menu should be hiddenpublic String getForm()
public String getConvertForm()
public Vector<SoftwareServerAuxiliary.Subtask> getTask(String application_alias, String task_string, String filename, String output_format)
application_alias
- the alias of the application to use.task_string
- the task to performfilename
- the file name of the cached file to convertoutput_format
- the output formatpublic void executeTask(int session, String application_alias, String task_string, String file, String format)
session
- the session id to use while executing the taskapplication_alias
- the application to usetask_string
- the task to perform (nothing assumed to be a conversion)file
- the URL of the file to convertformat
- the output formatpublic void executeTaskAtomically(int session, String application_alias, String task_string, String file, String format)
session
- the session id to use while executing the taskapplication_alias
- the application to usetask_string
- the task to perform (nothing assumed to be a conversion)file
- the URL of the file to convertformat
- the output formatpublic void executeTaskLater(int session, String application_alias, String task_string, String file, String format)
session
- the session id to use while executing the taskapplication_alias
- the application to usetask_string
- the task to perform (nothing assumed to be a conversion)file
- the URL of the input fileformat
- the output format@Get public org.restlet.representation.Representation httpGetHandler()
@Post public org.restlet.representation.Representation httpPostHandler(org.restlet.representation.Representation entity)
public void stop()
public static boolean isPlainRequest(org.restlet.Request request)
request
- the requestpublic static boolean isJSONRequest(org.restlet.Request request)
request
- the requestpublic static int getSession(String filename)
filename
- the cached public filenamepublic static String getFilename(String filename)
filename
- the cached public filename (either the local URL or the local filename without the cache path prepended. Assumes session ID is prepended!)public static String getFilenameName(String filename, boolean MULTIPLE_EXTENSIONS)
filename
- the cached public filename (either the local URL or the local filename without the cach path prepended. Assumes session ID is prepended!)MULTIPLE_EXTENSIONS
- true if files are allowed to have multiple extensionspublic static void main(String[] args)
args
- the input argumentspublic static org.json.JSONArray getApplicationsJson()
Copyright © 2016. All rights reserved.