Class QuestionResource

  • All Implemented Interfaces:
    org.silverpeas.core.web.rs.ProtectedWebResource, org.silverpeas.core.web.rs.WebAuthenticationValidation, org.silverpeas.core.web.rs.WebAuthorizationValidation, org.silverpeas.core.web.SilverpeasWebResource

    @WebService
    @Path("questionreply/{componentId}/questions")
    @Authorized
    public class QuestionResource
    extends QuestionReplyBaseWebService
    A REST Web resource representing a given question. It is a web service that provides an access to a question referenced by its URL.
    • Field Detail

      • componentId

        @PathParam("componentId")
        protected String componentId
    • Constructor Detail

      • QuestionResource

        public QuestionResource()
    • Method Detail

      • getComponentId

        public String getComponentId()
      • getQuestion

        @GET
        @Path("{questionId}")
        @Produces("application/json")
        public QuestionEntity getQuestion​(@PathParam("questionId")
                                          String onQuestionId)
        Gets the JSON representation of the specified existing question. If the question doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If the user isn't authorized to access the question, a 403 is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
        Parameters:
        onQuestionId - the unique identifier of the question.
        Returns:
        the response to the HTTP GET request with the JSON representation of the asked question.
      • getQuestions

        @GET
        @Produces("application/json")
        public QuestionEntity[] getQuestions​(@QueryParam("ids")
                                             Set<String> ids)
      • getAllQuestions

        @GET
        @Path("all")
        @Produces("application/json")
        public QuestionEntity[] getAllQuestions()
      • getAllQuestionsByCategory

        @GET
        @Path("category/{categoryId}")
        @Produces("application/json")
        public QuestionEntity[] getAllQuestionsByCategory​(@PathParam("categoryId")
                                                          String categoryId)
      • identifiedBy

        protected URI identifiedBy​(URI uri)
      • asWebEntities

        protected QuestionEntity[] asWebEntities​(List<Question> questions)
        Converts the specified list of questions into their corresponding web entities.
        Parameters:
        questions - the questions to convert.
        Returns:
        an array with the corresponding question entities.
      • asWebEntity

        protected QuestionEntity asWebEntity​(Question question,
                                             URI questionURI)
        Converts the question into its corresponding web entity.
        Parameters:
        question - the question to convert.
        questionURI - the URI of the question.
        Returns:
        the corresponding question entity.