Class RESTServer
java.lang.Object
ecmwf.ecpds.mover.service.RESTServer
The Class RESTServer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.Responseclose(jakarta.ws.rs.core.UriInfo ui, DataTransfer dataTransfer) Close.jakarta.ws.rs.core.ResponsedataFileDelete(jakarta.ws.rs.core.UriInfo ui, String authString, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) Data file delete.jakarta.ws.rs.core.ResponsedataFileGet(jakarta.ws.rs.core.UriInfo ui, String authString, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) Data file get.jakarta.ws.rs.core.ResponsedataFileHead(jakarta.ws.rs.core.UriInfo ui, String authString, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) Data file head.jakarta.ws.rs.core.ResponsedataFileOptions(String authString, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) Data file options (CORS preflight).jakarta.ws.rs.core.ResponsedataFilePost(jakarta.ws.rs.core.UriInfo ui, String authString, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename, InputStream in) Data file post.jakarta.ws.rs.core.ResponsedataListGet(jakarta.ws.rs.core.UriInfo ui, String authString, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.ws.rs.core.HttpHeaders headers, String filename) Data list get.voiddataListHead(jakarta.ws.rs.core.UriInfo ui, String authString, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) Data list head.jakarta.ws.rs.core.ResponseDel.jakarta.ws.rs.core.ResponsefileGet(jakarta.ws.rs.core.UriInfo ui, String authString, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.ws.rs.core.HttpHeaders headers) File get (if directory then list otherwise download).jakarta.ws.rs.core.ResponsefileGet(jakarta.ws.rs.core.UriInfo ui, String authString, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.ws.rs.core.HttpHeaders headers, String filename) File get (if directory then list otherwise download).jakarta.ws.rs.core.ResponsefileHead(jakarta.ws.rs.core.UriInfo ui, String authString, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) File get (if directory then list otherwise download).jakarta.ws.rs.core.ResponsefileHead(jakarta.ws.rs.core.UriInfo ui, String authString, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) File get (if directory then list otherwise download).jakarta.ws.rs.core.ResponsegetECauthToken(jakarta.ws.rs.core.UriInfo ui, String user) Gets the ecauth token.jakarta.ws.rs.core.ResponsegetHostReport(jakarta.ws.rs.core.UriInfo ui, Host host) Gets the host report.jakarta.ws.rs.core.ResponsegetMoverReport(jakarta.ws.rs.core.UriInfo ui) Gets the mover report.jakarta.ws.rs.core.ResponsehomeGet(jakarta.ws.rs.core.UriInfo ui, String user, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.ws.rs.core.HttpHeaders headers) File get (if directory then list otherwise download).jakarta.ws.rs.core.ResponsehomeGet(jakarta.ws.rs.core.UriInfo ui, String user, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.ws.rs.core.HttpHeaders headers, String filename) File get (if directory then list otherwise download).jakarta.ws.rs.core.ResponsehomeHead(jakarta.ws.rs.core.UriInfo ui, String user, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) File get (if directory then list otherwise download).jakarta.ws.rs.core.ResponsehomeHead(jakarta.ws.rs.core.UriInfo ui, String user, String range, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) File get (if directory then list otherwise download).jakarta.ws.rs.core.ResponsehomeOptions(String user, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) CORS preflight for home directory listing.jakarta.ws.rs.core.ResponsehomeOptions(String user, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) CORS preflight for home file download.jakarta.ws.rs.core.ResponseisValidDataFile(jakarta.ws.rs.core.UriInfo ui, Long dataFileId) Checks if is valid data file.jakarta.ws.rs.core.Responselogin(String username, String password, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) jakarta.ws.rs.core.Responsejakarta.ws.rs.core.Responselogout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) jakarta.ws.rs.core.ResponseproxyHostIsAlive(jakarta.ws.rs.core.UriInfo ui, String name) Proxy host is alive.jakarta.ws.rs.core.Responsepurge(jakarta.ws.rs.core.UriInfo ui, List<ExistingStorageDirectory> directories) Purge.jakarta.ws.rs.core.Responseput(jakarta.ws.rs.core.UriInfo ui, RESTClient.PutRequest request) Puts the.jakarta.ws.rs.core.ResponseregisterGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Registration page — serves the self-service account request form (no authentication required).jakarta.ws.rs.core.ResponseregisterPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String body) Registration submit — creates a pending account and sends a verification email.jakarta.ws.rs.core.ResponsesendMessage(jakarta.ws.rs.core.UriInfo ui, RESTClient.MonitorRequest request) Sends the message.jakarta.ws.rs.core.ResponseupdateData(jakarta.ws.rs.core.UriInfo ui, Host host) Update data.jakarta.ws.rs.core.ResponseupdateDataRequest(jakarta.ws.rs.core.UriInfo ui, RESTClient.UpdateDataRequest request) Update data.jakarta.ws.rs.core.ResponseupdateDataTransfers(jakarta.ws.rs.core.UriInfo ui, List<DataTransfer> transfers) Update data transfers.jakarta.ws.rs.core.ResponseupdateLocation(jakarta.ws.rs.core.UriInfo ui, Host host) Update location.jakarta.ws.rs.core.ResponseverifyGet(String token, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Email verification endpoint — called from the link in the verification email.jakarta.ws.rs.core.Responseversion(jakarta.ws.rs.core.UriInfo ui) Get version.
-
Constructor Details
-
RESTServer
public RESTServer()
-
-
Method Details
-
version
@GET @Produces("application/json") @Path("mover/getVersion") public jakarta.ws.rs.core.Response version(@Context jakarta.ws.rs.core.UriInfo ui) Get version.- Parameters:
ui- the ui- Returns:
- the response
-
del
@DELETE @Consumes("application/json") @Produces("application/json") @Path("mover/del") public jakarta.ws.rs.core.Response del(@Context jakarta.ws.rs.core.UriInfo ui, DataFile dataFile) Del.- Parameters:
ui- the uidataFile- the data file- Returns:
- the response
-
close
@DELETE @Consumes("application/json") @Produces("application/json") @Path("mover/close") public jakarta.ws.rs.core.Response close(@Context jakarta.ws.rs.core.UriInfo ui, DataTransfer dataTransfer) Close.- Parameters:
ui- the uidataTransfer- the data transfer- Returns:
- the response
-
purge
@DELETE @Consumes("application/json") @Produces("application/json") @Path("mover/purge") public jakarta.ws.rs.core.Response purge(@Context jakarta.ws.rs.core.UriInfo ui, List<ExistingStorageDirectory> directories) Purge.- Parameters:
ui- the uidirectories- the directories- Returns:
- the response
-
put
@PUT @Consumes("application/json") @Produces("application/json") @Path("mover/put") public jakarta.ws.rs.core.Response put(@Context jakarta.ws.rs.core.UriInfo ui, RESTClient.PutRequest request) Puts the.- Parameters:
ui- the uirequest- the request- Returns:
- the response
-
getHostReport
@PUT @Consumes("application/json") @Produces("application/json") @Path("mover/getHostReport") public jakarta.ws.rs.core.Response getHostReport(@Context jakarta.ws.rs.core.UriInfo ui, Host host) Gets the host report.- Parameters:
ui- the uihost- the host- Returns:
- the host report
-
getMoverReport
@GET @Produces("application/json") @Path("mover/getMoverReport") public jakarta.ws.rs.core.Response getMoverReport(@Context jakarta.ws.rs.core.UriInfo ui) Gets the mover report.- Parameters:
ui- the ui- Returns:
- the mover report
-
getECauthToken
@GET @Produces("application/json") @Path("master/getECauthToken") public jakarta.ws.rs.core.Response getECauthToken(@Context jakarta.ws.rs.core.UriInfo ui, @QueryParam("user") String user) Gets the ecauth token.- Parameters:
ui- the uiuser- the user- Returns:
- the ecauth token
-
isValidDataFile
@GET @Produces("application/json") @Path("master/isValidDataFile") public jakarta.ws.rs.core.Response isValidDataFile(@Context jakarta.ws.rs.core.UriInfo ui, @QueryParam("dataFileId") Long dataFileId) Checks if is valid data file.- Parameters:
ui- the uidataFileId- the data file id- Returns:
- the response
-
proxyHostIsAlive
@PUT @Consumes("application/json") @Produces("application/json") @Path("master/proxyHostIsAlive") public jakarta.ws.rs.core.Response proxyHostIsAlive(@Context jakarta.ws.rs.core.UriInfo ui, String name) Proxy host is alive.- Parameters:
ui- the uiname- the name- Returns:
- the response
-
updateDataRequest
@PUT @Consumes("application/json") @Produces("application/json") @Path("master/updateDataRequest") public jakarta.ws.rs.core.Response updateDataRequest(@Context jakarta.ws.rs.core.UriInfo ui, RESTClient.UpdateDataRequest request) Update data.- Parameters:
ui- the uirequest- the request- Returns:
- the response
-
updateData
@PUT @Consumes("application/json") @Produces("application/json") @Path("master/updateData") public jakarta.ws.rs.core.Response updateData(@Context jakarta.ws.rs.core.UriInfo ui, Host host) Update data.- Parameters:
ui- the uihost- the host- Returns:
- the response
-
updateLocation
@PUT @Consumes("application/json") @Produces("application/json") @Path("master/updateLocation") public jakarta.ws.rs.core.Response updateLocation(@Context jakarta.ws.rs.core.UriInfo ui, Host host) Update location.- Parameters:
ui- the uihost- the host- Returns:
- the response
-
updateDataTransfers
@PUT @Consumes("application/json") @Produces("application/json") @Path("master/updateDataTransfers") public jakarta.ws.rs.core.Response updateDataTransfers(@Context jakarta.ws.rs.core.UriInfo ui, List<DataTransfer> transfers) Update data transfers.- Parameters:
ui- the uitransfers- the transfers- Returns:
- the response
-
sendMessage
@PUT @Consumes("application/json") @Produces("application/json") @Path("master/sendMessage") public jakarta.ws.rs.core.Response sendMessage(@Context jakarta.ws.rs.core.UriInfo ui, RESTClient.MonitorRequest request) Sends the message.- Parameters:
ui- the uirequest- the request- Returns:
- the response
-
homeHead
@HEAD @Path("home/{user}") public jakarta.ws.rs.core.Response homeHead(@Context jakarta.ws.rs.core.UriInfo ui, @PathParam("user") String user, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response) File get (if directory then list otherwise download).- Parameters:
ui- the uiuser- the userrange- the rangerequest- the requestresponse- the response- Returns:
- the input stream
-
homeHead
@HEAD @Path("home/{user}/{filename: .*}") public jakarta.ws.rs.core.Response homeHead(@Context jakarta.ws.rs.core.UriInfo ui, @PathParam("user") String user, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @PathParam("filename") String filename) File get (if directory then list otherwise download).- Parameters:
ui- the uiuser- the userrange- the rangerequest- the requestresponse- the responsefilename- the filename- Returns:
- the input stream
-
homeOptions
@OPTIONS @Path("home/{user}") public jakarta.ws.rs.core.Response homeOptions(@PathParam("user") String user, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response) CORS preflight for home directory listing.- Parameters:
user- the userrequest- the requestresponse- the response- Returns:
- the response
-
homeOptions
@OPTIONS @Path("home/{user}/{filename: .*}") public jakarta.ws.rs.core.Response homeOptions(@PathParam("user") String user, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @PathParam("filename") String filename) CORS preflight for home file download.- Parameters:
user- the userrequest- the requestresponse- the responsefilename- the filename- Returns:
- the response
-
fileHead
@HEAD @Path("file") public jakarta.ws.rs.core.Response fileHead(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response) File get (if directory then list otherwise download).- Parameters:
ui- the uiauthString- the auth stringrange- the rangerequest- the requestresponse- the response- Returns:
- the input stream
-
fileHead
@HEAD @Path("file/{filename: .*}") public jakarta.ws.rs.core.Response fileHead(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @PathParam("filename") String filename) File get (if directory then list otherwise download).- Parameters:
ui- the uiauthString- the auth stringrange- the rangerequest- the requestresponse- the responsefilename- the filename- Returns:
- the input stream
-
homeGet
@GET @Produces({"application/octet-stream","text/html","text/plain","application/json","text/csv"}) @Path("home/{user}") public jakarta.ws.rs.core.Response homeGet(@Context jakarta.ws.rs.core.UriInfo ui, @PathParam("user") String user, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @Context jakarta.ws.rs.core.HttpHeaders headers) File get (if directory then list otherwise download).- Parameters:
ui- the uiuser- the userrange- the rangerequest- the requestresponse- the response- Returns:
- the input stream
-
homeGet
@GET @Produces({"application/octet-stream","text/html","text/plain","application/json","text/csv"}) @Path("home/{user}/{filename: .*}") public jakarta.ws.rs.core.Response homeGet(@Context jakarta.ws.rs.core.UriInfo ui, @PathParam("user") String user, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @Context jakarta.ws.rs.core.HttpHeaders headers, @PathParam("filename") String filename) File get (if directory then list otherwise download).- Parameters:
ui- the uiuser- the userrange- the rangerequest- the requestresponse- the responsefilename- the filename- Returns:
- the input stream
-
fileGet
@GET @Produces({"application/octet-stream","text/html","text/plain"}) @Path("file") public jakarta.ws.rs.core.Response fileGet(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @Context jakarta.ws.rs.core.HttpHeaders headers) File get (if directory then list otherwise download).- Parameters:
ui- the uiauthString- the auth stringrange- the rangerequest- the requestresponse- the response- Returns:
- the input stream
-
fileGet
@GET @Produces({"application/octet-stream","text/html","text/plain"}) @Path("file/{filename: .*}") public jakarta.ws.rs.core.Response fileGet(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @Context jakarta.ws.rs.core.HttpHeaders headers, @PathParam("filename") String filename) File get (if directory then list otherwise download).- Parameters:
ui- the uiauthString- the auth stringrange- the rangerequest- the requestresponse- the responsefilename- the filename- Returns:
- the input stream
-
dataFileOptions
@OPTIONS @Path("data/file/{filename: .*}") public jakarta.ws.rs.core.Response dataFileOptions(@HeaderParam("authorization") String authString, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @PathParam("filename") String filename) Data file options (CORS preflight).- Parameters:
authString- the auth stringrequest- the requestresponse- the responsefilename- the filename- Returns:
- the response
-
dataFileHead
@HEAD @Path("data/file/{filename: .*}") public jakarta.ws.rs.core.Response dataFileHead(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @PathParam("filename") String filename) Data file head.- Parameters:
ui- the uiauthString- the auth stringrange- the rangerequest- the requestresponse- the responsefilename- the filename- Returns:
- the input stream
-
dataFileDelete
@DELETE @Path("data/file/{filename: .*}") public jakarta.ws.rs.core.Response dataFileDelete(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @PathParam("filename") String filename) Data file delete.- Parameters:
ui- the uiauthString- the auth stringrequest- the requestresponse- the responsefilename- the filename- Returns:
- the response
-
dataFileGet
@GET @Produces("application/octet-stream") @Path("data/file/{filename: .*}") public jakarta.ws.rs.core.Response dataFileGet(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @HeaderParam("range") String range, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @PathParam("filename") String filename) Data file get.- Parameters:
ui- the uiauthString- the auth stringrange- the rangerequest- the requestresponse- the responsefilename- the filename- Returns:
- the input stream
-
dataFilePost
@POST @Produces("text/plain") @Consumes("application/octet-stream") @Path("data/file/{filename: .*}") public jakarta.ws.rs.core.Response dataFilePost(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @PathParam("filename") String filename, InputStream in) Data file post.- Parameters:
ui- the uiauthString- the auth stringrequest- the requestresponse- the responsefilename- the filenamein- the input stream- Returns:
- the status message
-
dataListGet
@GET @Produces({"text/html","application/json","text/plain","text/csv"}) @Path("data/list/{filename: .*}") public jakarta.ws.rs.core.Response dataListGet(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @Context jakarta.ws.rs.core.HttpHeaders headers, @PathParam("filename") String filename) Data list get.- Parameters:
ui- the uiauthString- the auth stringrequest- the requestresponse- the responsefilename- the filename- Returns:
- the listing
-
dataListHead
@HEAD @Path("data/list/{filename: .*}") public void dataListHead(@Context jakarta.ws.rs.core.UriInfo ui, @HeaderParam("authorization") String authString, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, @PathParam("filename") String filename) Data list head.- Parameters:
ui- the uiauthString- the auth stringrequest- the requestresponse- the responsefilename- the filename
-
registerGet
@GET @Produces("text/html") @Path("register") public jakarta.ws.rs.core.Response registerGet(@Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response) Registration page — serves the self-service account request form (no authentication required).- Parameters:
request- the HTTP requestresponse- the HTTP response- Returns:
- the registration HTML page
-
registerPost
@POST @Consumes("application/json") @Produces("application/json") @Path("register") public jakarta.ws.rs.core.Response registerPost(@Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response, String body) Registration submit — creates a pending account and sends a verification email. Accepts JSON:{"id":"...","name":"...","email":"...","iso":"..."}. Returns 200 with{"status":"pending"}on success, or 400/500 with{"message":"..."}on failure. No authentication required.- Parameters:
request- the HTTP requestresponse- the HTTP responsebody- the JSON request body- Returns:
- JSON response
-
verifyGet
@GET @Path("verify") public jakarta.ws.rs.core.Response verifyGet(@QueryParam("token") String token, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response) Email verification endpoint — called from the link in the verification email. If valid: auto-approves or marks email as verified, then redirects to the register page with a?state=query parameter indicating the outcome.- Parameters:
token- the verification token from the email linkrequest- the HTTP requestresponse- the HTTP response- Returns:
- redirect to the register page
-
loginPage
@GET @Path("login") @Produces("text/html") public jakarta.ws.rs.core.Response loginPage(@Context jakarta.servlet.http.HttpServletRequest request, @QueryParam("user") String prefillUser) -
login
@POST @Path("login") @Consumes("application/x-www-form-urlencoded") public jakarta.ws.rs.core.Response login(@FormParam("username") String username, @FormParam("password") String password, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response) -
logout
@GET @Path("logout") public jakarta.ws.rs.core.Response logout(@Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response)
-