Package com.atlassian.greenhopper.web
Class AbstractResource
java.lang.Object
com.atlassian.greenhopper.web.AbstractResource
- Direct Known Subclasses:
AbstractGadgetResource,AssigneeUserPickerResource,AttachmentsResource,BoardSidebarResource,CacheControlResource,CardColorResource,CardLayoutResource,CompleteSprintResource,DetailViewFieldResource,EpicPropertiesResource,EpicResource,FeaturesResource,FlagResource,IncompleteIssuesDestinationSuggestionsResource,IssueResource,JiraTaskResource,KanbanPlanModeResource,LexoRankResource,ManagedCustomFieldsResource,ManagedIssueLinkTypesResource,ManagedIssueTypesResource,PlanningModeResource,ProjectResource,QuickFilterResource,RankResource,RankResource,RapidBoardResource,RapidChartResource,RapidViewEditResource,RapidViewListResource,RapidViewResource,ReleaseResource,RemoteEpicLinkResource,RemoteIssueLinkResource,RemoteLinkConversationResource,RemoteSprintLinkResource,ReopenSprintResource,SavedFilterResource,SearchConfluencePagesResource,SplitIssueResource,SprintGoalOnboardingResource,SprintHealthResource,SprintPagesResource,SprintQueryResource,SprintRankResource,SprintRemainingDaysResource,SprintResource,StartSprintResource,SubqueryResource,SwimlaneResource,TeamCalendarsResource,UserDataResource,VersionResource,WelcomeResource,WizardConfigResource,WorkflowResource,WorkingDaysResource,WorkResource
To be extended by all GreenHopper rest resources. Provides no-cache logic.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.atlassian.jira.security.JiraAuthenticationContextprotected final LoggerWrapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Tcheck(ServiceOutcome<T> outcome) Check this outcome for errors.voidcheckResult(ServiceResult result) Check this result for errors.javax.ws.rs.core.Responsejavax.ws.rs.core.ResponsecreateOkResponse(RestTemplate entity) Returns an ok response with NO_CACHE headers applied to it.javax.ws.rs.core.ResponsecreateOkResponse(RestTemplate template, javax.ws.rs.core.EntityTag eTag) Creates an ok response including an etag.protected com.atlassian.jira.user.ApplicationUsergetUser()protected booleanIs this request for rendering a gadget?protected <T> Set<T>Used for converting sets created by Jersey.protected javax.ws.rs.core.ResponseA standard way to invoke a REST resource and handle errors that might be throw.protected javax.ws.rs.core.ResponseresponseWithoutAccessCheck(Callable<javax.ws.rs.core.Response> responseCallable) A standard way to invoke a REST resource and handle errors that might be thrown.
-
Field Details
-
log
-
authenticationContext
@Inject protected com.atlassian.jira.security.JiraAuthenticationContext authenticationContext
-
-
Constructor Details
-
AbstractResource
public AbstractResource()
-
-
Method Details
-
response
A standard way to invoke a REST resource and handle errors that might be throw. Jira as of 5.0 lose stuff when bad errors happen and this way any badness is captured into atlassian-greenhopper.logWill perform the access check before invoking the passed in callable.
- Parameters:
responseCallable- a callable block of code- Returns:
- the REST response from that callable block of code 403 if the current user is not a software user
-
responseWithoutAccessCheck
protected javax.ws.rs.core.Response responseWithoutAccessCheck(Callable<javax.ws.rs.core.Response> responseCallable) A standard way to invoke a REST resource and handle errors that might be thrown. Jira as of 5.0 lose stuff when bad errors happen and this way any badness is captured into atlassian-greenhopper.logDoes not perform the access check before invoking the passed in callable.
- Parameters:
responseCallable- a callable block of code- Returns:
- the REST response from that callable block of code
-
createOkResponse
Returns an ok response with NO_CACHE headers applied to it.- Parameters:
entity- the returned rest template- Returns:
- a REST response
-
createOkResponse
public javax.ws.rs.core.Response createOkResponse(RestTemplate template, javax.ws.rs.core.EntityTag eTag) Creates an ok response including an etag.- Parameters:
template- the template to usedeTag- an entity tag- Returns:
- a REST response
-
createNoContentResponse
public javax.ws.rs.core.Response createNoContentResponse() -
check
Check this outcome for errors. If found, will implementErrorCollections.checkErrors(ErrorCollection, I18n2), which will throw some REST exceptions.- Parameters:
outcome- the outcome to check
-
checkResult
Check this result for errors. If found, will implementErrorCollections.checkErrors(ErrorCollection, I18n2), which will throw some REST exceptions.- Parameters:
result- the result to check
-
nullSafe
Used for converting sets created by Jersey. They're null if the respective parameter wasn't specified. Null collections are bad. Stupid Jersey.- Parameters:
set- that cant be null- Returns:
- a non null set
-
getUser
protected com.atlassian.jira.user.ApplicationUser getUser() -
isGadgetRequest
protected boolean isGadgetRequest()Is this request for rendering a gadget? GH.Ajax.get() puts in a special header if sending ajax requests for gadgets.- Returns:
- true or false
-