Package org.dspace.rest
Class RestIndex
- java.lang.Object
-
- org.dspace.rest.RestIndex
-
@Path("/") public class RestIndex extends ObjectRoot of RESTful api. It provides login and logout. Also have method for printing every method which is provides by RESTful api.- Author:
- Rostislav Novak (Computing and Information Centre, CTU in Prague)
-
-
Field Summary
Fields Modifier and Type Field Description protected org.dspace.eperson.service.EPersonServiceepersonService
-
Constructor Summary
Constructors Constructor Description RestIndex()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Responselogin()Method to login a user into REST API.javax.ws.rs.core.Responselogout(javax.ws.rs.core.HttpHeaders headers)Method to logout a user from DSpace REST API.StringsayHtmlHello(javax.servlet.ServletContext servletContext)Return html page with information about REST api.javax.ws.rs.core.ResponseshibbolethLogin()javax.ws.rs.core.ResponseshibbolethLoginEndPoint()Statusstatus(javax.ws.rs.core.HttpHeaders headers)Method to check current status of the service and logged in user.Stringtest()Method only for testing whether the REST API is running.
-
-
-
Method Detail
-
sayHtmlHello
@GET @Produces("text/html") public String sayHtmlHello(@Context javax.servlet.ServletContext servletContext)Return html page with information about REST api. It contains methods all methods provide by REST api.- Parameters:
servletContext- Context of the servlet container.- Returns:
- HTML page which has information about all methods of REST API.
-
test
@GET @Path("/test") public String test()Method only for testing whether the REST API is running.- Returns:
- String "REST api is running."
-
login
@POST @Path("/login") @Consumes({"application/json","application/xml"}) public javax.ws.rs.core.Response login()Method to login a user into REST API.- Returns:
- Returns response code OK and a token. Otherwise returns response code FORBIDDEN(403).
-
shibbolethLogin
@GET @Path("/shibboleth-login") @Consumes({"application/json","application/xml"}) public javax.ws.rs.core.Response shibbolethLogin()
-
shibbolethLoginEndPoint
@GET @Path("/login-shibboleth") @Consumes({"application/json","application/xml"}) public javax.ws.rs.core.Response shibbolethLoginEndPoint()
-
logout
@POST @Path("/logout") @Consumes({"application/json","application/xml"}) public javax.ws.rs.core.Response logout(@Context javax.ws.rs.core.HttpHeaders headers)Method to logout a user from DSpace REST API. Removes the token and user from TokenHolder.- Parameters:
headers- Request header which contains the header named "rest-dspace-token" containing the token as value.- Returns:
- Return response OK, otherwise BAD_REQUEST, if there was a problem with logout or the token is incorrect.
-
status
@GET @Path("/status") @Consumes({"application/json","application/xml"}) public Status status(@Context javax.ws.rs.core.HttpHeaders headers) throws UnsupportedEncodingExceptionMethod to check current status of the service and logged in user. okay: true | false authenticated: true | false epersonEMAIL: user@example.com epersonNAME: John Doe- Parameters:
headers- Request header which contains the header named "rest-dspace-token" containing the token as value.- Returns:
- status the Status object with information about REST API
- Throws:
UnsupportedEncodingException- The Character Encoding is not supported.
-
-