com.silverpeas.questionReply.web
Class QuestionResource
java.lang.Object
com.silverpeas.web.RESTWebService
com.silverpeas.questionReply.web.QuestionRelyBaseWebService
com.silverpeas.questionReply.web.QuestionResource
@Service
@RequestScoped
@Authorized
public class QuestionResource
- extends QuestionRelyBaseWebService
A REST Web resource representing a given question.
It is a web service that provides an access to a question referenced by its URL.
Nested classes/interfaces inherited from class com.silverpeas.web.RESTWebService |
com.silverpeas.web.RESTWebService.WebProcess<RETURN_VALUE>, com.silverpeas.web.RESTWebService.WebTreatment<RETURN_VALUE> |
Fields inherited from class com.silverpeas.web.RESTWebService |
RESPONSE_HEADER_ARRAYSIZE, REST_WEB_SERVICES_URI_BASE |
Methods inherited from class com.silverpeas.web.RESTWebService |
getBundle, getBundleLocation, getGreaterUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getUriInfo, getUserDetail, getUserPreferences, getUserRoles, process, validateUserAuthentication, validateUserAuthorization |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
componentId
protected String componentId
QuestionResource
public QuestionResource()
getComponentId
public String getComponentId()
- Specified by:
getComponentId
in class com.silverpeas.web.RESTWebService
getQuestion
public QuestionEntity getQuestion(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.
getAllQuestions
public QuestionEntity[] getAllQuestions(String onQuestionId)
getAllQuestionsByCategory
public QuestionEntity[] getAllQuestionsByCategory(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.
Copyright © 2016 Silverpeas. All Rights Reserved.