Class RestIndex


  • @Path("/")
    public class RestIndex
    extends Object
    Root 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)
    • Constructor Detail

      • RestIndex

        public RestIndex()
    • 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 UnsupportedEncodingException
        Method to check current status of the service and logged in user. okay: true | false authenticated: true | false epersonEMAIL: [email protected] 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.