|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object webwork.action.ActionSupport com.atlassian.jira.action.JiraActionSupport com.atlassian.jira.web.action.JiraWebActionSupport
@NotThreadSafe public class JiraWebActionSupport
All web actions should extend this class - it provides basic common functionality for all web actions.
When adding to this class, be sure that what you are adding is used by a large number of actions - otherwise add it to a sub class of this.
Nested Class Summary | |
---|---|
static class |
JiraWebActionSupport.MessageType
Represents a type of message that the browser will display after the next page load. |
Nested classes/interfaces inherited from interface com.atlassian.jira.util.ErrorCollection |
---|
ErrorCollection.Reason |
Nested classes/interfaces inherited from interface com.atlassian.jira.util.I18nHelper |
---|
I18nHelper.BeanFactory |
Field Summary | |
---|---|
static String |
ISSUE_NOT_FOUND_RESULT
|
static String |
PERMISSION_VIOLATION_RESULT
|
protected javax.servlet.http.HttpServletRequest |
request
|
static String |
RETURN_URL_PARAMETER
|
protected Collection |
savedFilters
|
Fields inherited from class com.atlassian.jira.action.JiraActionSupport |
---|
log |
Fields inherited from class webwork.action.ActionSupport |
---|
command, errorMap, errorMessages |
Fields inherited from interface webwork.action.Action |
---|
ERROR, INPUT, LOGIN, NONE, SUCCESS |
Constructor Summary | |
---|---|
JiraWebActionSupport()
|
Method Summary | |
---|---|
void |
addError(String field,
String message,
ErrorCollection.Reason reason)
Add a field-specific error message. |
void |
addErrorCollection(ErrorCollection errors)
Populate this ErrorCollection with general and field-specific errors. |
void |
addErrorMessage(String message,
ErrorCollection.Reason reason)
Add error message relating to system state (not field-specific), and a reason. |
protected void |
addErrorMessageByKeyIfAbsent(String errorMsgKey)
|
protected void |
addErrorMessageIfAbsent(String errorMsg)
|
void |
addReason(ErrorCollection.Reason reason)
Add a reason why the function has not been performed. |
void |
addReasons(Set<ErrorCollection.Reason> reasons)
Add reasons why the function has not been performed. |
protected String |
forceRedirect(String redirect)
This method will force a server redirect, with no security checks. |
String |
getAdministratorContactLink()
Get the link, with Internationalised text for contacting the administrators of JIRA. |
ApplicationProperties |
getApplicationProperties()
|
protected AuthorizationSupport |
getAuthorizationSupport()
|
String |
getConglomerateCookieValue(String cookieName,
String key)
Retrieve the value from a conglomerate Cookie from the request. |
ConstantsManager |
getConstantsManager()
|
String |
getDateFormat()
|
String |
getDateTimeFormat()
|
DateTimeFormatter |
getDateTimeFormatter()
Returns a DateTimeFormatter that can be used to format times and dates in the user's time zone using DateTimeStyle.RELATIVE . |
String |
getDescTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
|
DateTimeFormatter |
getDmyDateFormatter()
Returns a DateTimeFormatter that can be used to format dates in the user's time zone using DateTimeStyle.DATE . |
Field |
getField(String id)
|
Collection<String> |
getFlushedErrorMessages()
Get error messages, then get rid of them. |
protected GlobalPermissionManager |
getGlobalPermissionManager()
|
Hint |
getHint(String context)
|
protected HintManager |
getHintManager()
|
JiraContactHelper |
getJiraContactHelper()
|
JiraServiceContext |
getJiraServiceContext()
Provides a service context with the current user which contains this action as its ErrorCollection . |
String |
getLanguage()
|
ApplicationUser |
getLoggedInApplicationUser()
|
com.atlassian.crowd.embedded.api.User |
getLoggedInUser()
|
String |
getNameTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
|
OutlookDate |
getOutlookDate()
Deprecated. Use getDateTimeFormatter() instead. Since v5.0. |
protected PermissionManager |
getPermissionManager()
|
ProjectManager |
getProjectManager()
|
Hint |
getRandomHint()
|
Set<ErrorCollection.Reason> |
getReasons()
A set of well known reasons why the function has not been performed. |
String |
getRedirect(String defaultUrl)
Redirects to the value of getReturnUrl() , falling back to defaultUrl if the returnUrl is
not set. |
String |
getRedirect(String defaultUrl,
boolean allowUnsafeRedirect)
Redirects to the value of getReturnUrl() , falling back to defaultUrl if the returnUrl is
not set. |
protected RedirectSanitiser |
getRedirectSanitiser()
Returns a RedirectSanitiser implementation. |
String |
getReturnUrl()
|
String |
getReturnUrlForCancelLink()
The cancel links should not included the selectedIssueId, otherwise when returning to the issue navigator an issue updated notification will be shown. |
List<String> |
getSearchSortDescriptions(SearchRequest searchRequest)
|
org.ofbiz.core.entity.GenericValue |
getSelectedProject()
Deprecated. Use getSelectedProjectObject() instead. Since v5.0. |
Project |
getSelectedProjectObject()
Gets the last viewed project that the user visited and still has permission to see. |
String |
getServerId()
|
String |
getTimeFormat()
|
UriValidator |
getUriValidator()
|
String |
getUserFullName(String username)
|
UserManager |
getUserManager()
|
protected UserProjectHistoryManager |
getUserProjectHistoryManager()
|
VersionManager |
getVersionManager()
|
String |
getWebworkStack()
For debugging JSPs; prints the webwork stack. |
String |
getWebworkStack(String selected)
For debugging JSPs; prints the webwork stack, highlighting the specified node. |
String |
getXsrfToken()
|
protected boolean |
hasErrorMessage(String errorMsg)
|
protected boolean |
hasErrorMessageByKey(String errorMsgKey)
|
String |
htmlEncode(String encodeMe)
Convenience instance method to call static utility from webwork EL. |
protected String |
insertContextPath(String url)
Prepends the context path to the URL if it begins with a forward slash (this is commonly used for redirects within a JIRA instance). |
boolean |
isHasIssuePermission(int permissionsId,
org.ofbiz.core.entity.GenericValue issue)
|
boolean |
isHasIssuePermission(String permName,
org.ofbiz.core.entity.GenericValue issue)
|
boolean |
isHasPermission(int permissionsId)
|
boolean |
isHasPermission(String permName)
|
boolean |
isHasPermission(String permName,
org.ofbiz.core.entity.GenericValue entity)
Deprecated. |
boolean |
isHasProjectPermission(int permissionsId,
org.ofbiz.core.entity.GenericValue project)
|
boolean |
isHasProjectPermission(String permName,
org.ofbiz.core.entity.GenericValue project)
|
boolean |
isInlineDialogMode()
This returns true if the action has been invoked as an inline dialog. |
boolean |
isSystemAdministrator()
|
boolean |
isUserExists(String username)
|
String |
returnComplete()
|
String |
returnComplete(String url)
|
protected String |
returnCompleteWithInlineRedirect(String url)
This will return success response with body containing url to redirect. |
protected String |
returnCompleteWithInlineRedirectAndMsg(String url,
String msg,
JiraWebActionSupport.MessageType type,
boolean closeable,
String target)
This will redirect like returnCompleteWithInlineRedirect(String) , and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. |
protected String |
returnCompleteWithInlineRedirectAndMsg(String url,
String msg,
String type,
boolean closeable,
String target)
Deprecated. since 5.1. Use returnCompleteWithInlineRedirectAndMsg(String, String, MessageType, boolean, String)
instead. |
protected String |
returnMsgToUser(String url,
String msg,
JiraWebActionSupport.MessageType type,
boolean closeable,
String target)
This will redirect like returnComplete() , and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. |
protected String |
returnMsgToUser(String url,
String msg,
String type,
boolean closeable,
String target)
Deprecated. since 5.1. Use returnMsgToUser(String, String, MessageType, boolean, String) instead. |
void |
setConglomerateCookieValue(String cookieName,
String key,
String value)
Set the value key/value pair in a conglomerate Cookie. |
void |
setInline(boolean inline)
This is the web parameter setter for invoking an action as an inline dialog |
void |
setReasons(Set<ErrorCollection.Reason> reasons)
Set reasons why the function has not been performed. |
void |
setReturnUrl(String returnUrl)
|
void |
setSelectedProjectId(Long id)
|
String |
urlEncode(String encode)
Encodes the given string into application/x-www-form-urlencoded format, using the JIRA encoding scheme to
obtain the bytes for unsafe characters. |
Methods inherited from class com.atlassian.jira.action.JiraActionSupport |
---|
addErrorMessages, addErrorMessages, addErrors, addIllegalArgumentException, execute, getActionName, getComponentInstanceOfType, getDefaultResourceBundle, getDelegator, getI18nHelper, getKeysForPrefix, getLocale, getOfBizDelegator, getRemoteUser, getResult, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getText, getUnescapedText, getUntransformedRawText, getUserPreferences, getWatcherManager, hasAnyErrors, isIndexing, isKeyDefined, removeKeyOrAddError |
Methods inherited from class webwork.action.ActionSupport |
---|
addError, addErrorMessage, doDefault, doExecute, doValidation, getCommandName, getErrorMessages, getErrors, getHasErrorMessages, getHasErrors, getPropertyEditorMessage, getTexts, getTexts, getTimezone, invalidInput, invokeCommand, isCommand, setCommand, setErrorMessages, setErrors, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.atlassian.jira.util.ErrorCollection |
---|
addError, addErrorMessage, addErrorMessages, addErrors, getErrorMessages, getErrors, hasAnyErrors, setErrorMessages |
Methods inherited from interface webwork.action.CommandDriven |
---|
getCommandName, setCommand |
Field Detail |
---|
public static final String RETURN_URL_PARAMETER
public static final String PERMISSION_VIOLATION_RESULT
public static final String ISSUE_NOT_FOUND_RESULT
protected javax.servlet.http.HttpServletRequest request
protected Collection savedFilters
Constructor Detail |
---|
public JiraWebActionSupport()
Method Detail |
---|
public com.atlassian.crowd.embedded.api.User getLoggedInUser()
getLoggedInUser
in class JiraActionSupport
public ApplicationUser getLoggedInApplicationUser()
public String getXsrfToken()
public ApplicationProperties getApplicationProperties()
getApplicationProperties
in class JiraActionSupport
public UriValidator getUriValidator()
protected GlobalPermissionManager getGlobalPermissionManager()
protected PermissionManager getPermissionManager()
protected UserProjectHistoryManager getUserProjectHistoryManager()
public ConstantsManager getConstantsManager()
public ProjectManager getProjectManager()
public VersionManager getVersionManager()
@Deprecated public OutlookDate getOutlookDate()
getDateTimeFormatter()
instead. Since v5.0.
public DateTimeFormatter getDateTimeFormatter()
DateTimeStyle.RELATIVE
.
public DateTimeFormatter getDmyDateFormatter()
DateTimeStyle.DATE
.
public JiraContactHelper getJiraContactHelper()
public UserManager getUserManager()
public String getAdministratorContactLink()
JiraContactHelper#getAdministratorContactLinkHtml(String, com.atlassian.jira.util.I18nHelper)}
protected final HintManager getHintManager()
protected AuthorizationSupport getAuthorizationSupport()
public String getRedirect(String defaultUrl)
getReturnUrl()
, falling back to defaultUrl
if the returnUrl
is
not set. This method clears the returnUrl
. If there are errors, this method returns "ERROR".
If the URL starts with '/' it is interpreted as context-relative.
RedirectSanitiser.makeSafeRedirectUrl(String)
. Use getRedirect(String, boolean)
to allow unsafe
redirects for URLs that do not contain possibly malicious user input.
defaultUrl
- default URL to redirect to
getRedirect(String, boolean)
public String getRedirect(String defaultUrl, boolean allowUnsafeRedirect)
getReturnUrl()
, falling back to defaultUrl
if the returnUrl
is
not set. This method clears the returnUrl
. If there are errors, this method returns "ERROR". If the URL
starts with '/' it is interpreted as context-relative.
If allowUnsafeRedirect
is true, this method will not perform validation on the value of returnUrl
or defaultUrl
. This can introduce serious security problems, so use with care. In particular, you
should only use use this method if defaultUrl
has already been sanitised (via whitelisting).
defaultUrl
- default URL to redirect toallowUnsafeRedirect
- whether to allow unsafe redirects (e.g. javascript:
or off-site URLs).
forceRedirect(String)
protected String forceRedirect(String redirect)
getRedirect(String)
, which checks that
the redirect URL is safe.
redirect
- redirect URL
Action.NONE
. It'll just redirect to where you've specifiedgetRedirect(String)
public boolean isHasPermission(String permName)
isHasPermission
in interface AuthorizationSupport
public boolean isHasPermission(int permissionsId)
isHasPermission
in interface AuthorizationSupport
public boolean isHasIssuePermission(String permName, org.ofbiz.core.entity.GenericValue issue)
isHasIssuePermission
in interface AuthorizationSupport
public boolean isHasIssuePermission(int permissionsId, org.ofbiz.core.entity.GenericValue issue)
isHasIssuePermission
in interface AuthorizationSupport
public boolean isHasProjectPermission(String permName, org.ofbiz.core.entity.GenericValue project)
isHasProjectPermission
in interface AuthorizationSupport
public boolean isHasProjectPermission(int permissionsId, org.ofbiz.core.entity.GenericValue project)
isHasProjectPermission
in interface AuthorizationSupport
@Deprecated public boolean isHasPermission(String permName, org.ofbiz.core.entity.GenericValue entity)
AuthorizationSupport
isHasPermission
in interface AuthorizationSupport
permName
- permission typeentity
- entity to check the permission for, e.g. project, issue
public boolean isSystemAdministrator()
public boolean isUserExists(String username)
public String getUserFullName(String username)
public void addErrorCollection(ErrorCollection errors)
ErrorCollection
addErrorCollection
in interface ErrorCollection
errors
- ErrorCollection whose errors/messages we obtain.public void addError(String field, String message, ErrorCollection.Reason reason)
ErrorCollection
addError
in interface ErrorCollection
field
- Field name, eg. "assignee"message
- Error message.reason
- Reason for the error.public void addErrorMessage(String message, ErrorCollection.Reason reason)
ErrorCollection
addErrorMessage
in interface ErrorCollection
message
- Error message.reason
- Reason for the error.public void addReason(ErrorCollection.Reason reason)
ErrorCollection
addReason
in interface ErrorCollection
reason
- a well known reasons why the function has not been performed.public void addReasons(Set<ErrorCollection.Reason> reasons)
ErrorCollection
addReasons
in interface ErrorCollection
reasons
- a set of well known reasons why the function has not been performed.public void setReasons(Set<ErrorCollection.Reason> reasons)
ErrorCollection
setReasons
in interface ErrorCollection
reasons
- a set of well known reasons why the function has not been performed.public Set<ErrorCollection.Reason> getReasons()
ErrorCollection
getReasons
in interface ErrorCollection
public Field getField(String id)
public List<String> getSearchSortDescriptions(SearchRequest searchRequest)
public String getNameTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
public String getDescTranslation(org.ofbiz.core.entity.GenericValue issueConstantGV)
public String getReturnUrl()
public String getReturnUrlForCancelLink()
public void setReturnUrl(String returnUrl)
public Collection<String> getFlushedErrorMessages()
ErrorCollection
getFlushedErrorMessages
in interface ErrorCollection
public String getLanguage() throws IOException
IOException
public Project getSelectedProjectObject()
UserProjectHistoryManager.getCurrentProject(int, User)
public org.ofbiz.core.entity.GenericValue getSelectedProject()
getSelectedProjectObject()
instead. Since v5.0.
Projects become active when your browse, search for a single project or create an issue.
public void setSelectedProjectId(Long id)
public String getDateFormat()
public String getDateTimeFormat()
public String getTimeFormat()
public String getWebworkStack(String selected)
selected
- selected value in the webwork stack
public String getWebworkStack()
public String getServerId()
public JiraServiceContext getJiraServiceContext()
ErrorCollection
.
public String htmlEncode(String encodeMe)
encodeMe
- a String to be HTML encoded.
public String urlEncode(String encode)
application/x-www-form-urlencoded
format, using the JIRA encoding scheme to
obtain the bytes for unsafe characters.
encode
- the String to encode
URLEncoder.encode(String, String)
public boolean isInlineDialogMode()
public void setInline(boolean inline)
inline
- true if the action should act as an inline dialogpublic String returnComplete()
public String returnComplete(String url)
protected final String returnCompleteWithInlineRedirect(String url)
url
- URL to redirect to
protected String returnCompleteWithInlineRedirectAndMsg(String url, String msg, JiraWebActionSupport.MessageType type, boolean closeable, @Nullable String target)
returnCompleteWithInlineRedirect(String)
, and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client
side control should perform the displaying of the message.
url
- URL to redirect tomsg
- message HTMLtype
- type of message.closeable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot
protected String returnCompleteWithInlineRedirectAndMsg(String url, String msg, String type, boolean closeable, @Nullable String target)
returnCompleteWithInlineRedirectAndMsg(String, String, MessageType, boolean, String)
instead.
returnCompleteWithInlineRedirect(String)
, and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client
side control should perform the displaying of the message.
url
- URL to redirect tomsg
- message HTMLtype
- type of message, see JIRA.Messages.Typescloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot
@Deprecated protected String returnMsgToUser(String url, String msg, String type, boolean closeable, @Nullable String target)
returnMsgToUser(String, String, MessageType, boolean, String)
instead.
returnComplete()
, and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client
side control should perform the displaying of the message.
url
- URL to redirect to. Not used in dialogsmsg
- message HTMLtype
- type of message, see JIRA.Messages.Typescloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot
protected String returnMsgToUser(String url, String msg, JiraWebActionSupport.MessageType type, boolean closeable, @Nullable String target)
returnComplete()
, and will also populate the response
with the details of a pop-up message to be displayed on the redirected page. An appropriately configured client
side control should perform the displaying of the message.
url
- URL to redirect to. Not used in dialogsmsg
- message HTMLtype
- type of messagecloseable
- if true, message pop-up has an 'X' button, otherwise pop-up fades away automaticallytarget
- the target to prepend the message pop-up to. If null, the message is shown in a global spot
protected String insertContextPath(String url)
url
- a String containing a URL
protected final boolean hasErrorMessage(String errorMsg)
protected final boolean hasErrorMessageByKey(String errorMsgKey)
protected final void addErrorMessageIfAbsent(String errorMsg)
protected final void addErrorMessageByKeyIfAbsent(String errorMsgKey)
public final Hint getHint(String context)
public final Hint getRandomHint()
public String getConglomerateCookieValue(String cookieName, String key)
cookieName
- The name of the conglomerate cookiekey
- The key of the value
public void setConglomerateCookieValue(String cookieName, String key, String value)
cookieName
- The name of the conglomerate cookiekey
- The key of the valuevalue
- The value@Nonnull protected final RedirectSanitiser getRedirectSanitiser()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |