protected String encode(String string) { return JiraUrlCodec.encode(string, true); }
@Nonnull private String urlEncode(@Nonnull final String string) { return JiraUrlCodec.encode(string); } }
/** * URL encode the passed value using the configured JIRA character encoding, or if the encoding doesn't exist, * the system encoding. Spaces are encoded as the '+' character. * * @param value the value to encode. * @return the encoded value. */ @HtmlSafe public static String encode(String value) { return encode(value, false); }
private String encode(final String searchString) { // we call this so that the static ComponentAccessor is not used and we are not detestible return JiraUrlCodec.encode(searchString, applicationProperties.getEncoding(), true); }
private void setContentDispositionOnResponse(HttpServletResponse httpServletResponse, String filename, String contentDisposition) { String filenameEncoding = applicationProperties.getEncoding(); // note the special *= syntax is used for embedding the encoding that the filename is in as per RFC 2231 // http://www.faqs.org/rfcs/rfc2231.html httpServletResponse.setHeader("Content-Disposition", String.format("%s; filename*=%s''%s;", contentDisposition, filenameEncoding, JiraUrlCodec.encode(filename, true))); }
/** * URL encode the passed value using the passed character encoding, or if the encoding doesn't exist, the system * encoding. Spaces are encoded as the '+' character. * * @param value the value to encode. * @param encoding the character encoding to use * @return the encoded value. */ @HtmlSafe public static String encode(String value, String encoding) { return encode(value, encoding, false); }
public static URI makeSelfUri(String groupName, JiraBaseUrls urls) { return URI.create(urls.restApi2BaseUrl() + "group?groupname=" + JiraUrlCodec.encode(groupName)); }
/** * Creates new instance of GroupJsonBean for docummentation usage. * @param name group name * @return GroupJsonBean with name and self uri. */ public static GroupJsonBean BuildDocExampleUsers(String name) { return new GroupJsonBean(name, URI.create("http://www.example.com/jira/rest/api/2/group?groupname=" + JiraUrlCodec.encode(name, "utf8"))); } }
/** * @since 7.0.0 */ public static String propertySelf(JiraBaseUrls urls, Long entityId, String propertyKey, BiFunction<Long, String, String> selfFunction) { return urls.restApi2BaseUrl() + selfFunction.apply(entityId, JiraUrlCodec.encode(propertyKey)); }
private String redirectToView() { StringBuilder redirectUrl = new StringBuilder("BulkEditUserGroups!default.jspa?"); Iterator<Group> groups = getSelectedGroupsUserHasPermToSee().iterator(); while (groups.hasNext()) { Group group = groups.next(); redirectUrl.append("selectedGroupsStr=").append(JiraUrlCodec.encode(group.getName())); if (groups.hasNext()) redirectUrl.append("&"); } return getRedirect(redirectUrl.toString()); }
public String getFisheyeAsynchronousSearchUrl() { // Only do asynchronous search if we're searching all projects and we're not a collaborator if (TextUtils.stringSet(projectKey) || studioUserManager.isCurrentUserCollaborator()) { return null; } return "/plugins/servlet/studio/studiosearch?application=" + Application.FISHEYE.name() + "&query=" + JiraUrlCodec.encode(query); }
/** * URL encode the passed value using the configured JIRA character encoding, or if the encoding doesn't exist, * the system encoding. * * @param spacesEncodedasHexValue if true spaces are encoded with the the hex value '%20', otherwise if false then the character '+'. * @param value the value to encode. * @return the encoded value. */ @HtmlSafe public static String encode(String value, boolean spacesEncodedasHexValue) { return encode(value, ComponentAccessor.getApplicationProperties().getEncoding(), spacesEncodedasHexValue); }
@RequiresXsrfCheck protected String doExecute() throws Exception { workflowService.createDraftWorkflow(getJiraServiceContext(), StringUtils.trim(getDraftWorkflowName())); if (hasAnyErrors()) { return ERROR; } return getRedirect("ViewWorkflowSteps.jspa?workflowMode=draft&workflowName=" + JiraUrlCodec.encode(StringUtils.trim(getDraftWorkflowName()))); }
public static ProjectCategoryJsonBean bean(final ProjectCategory projectCategoryObject, final JiraBaseUrls urls) { if (projectCategoryObject == null) { return null; } final ProjectCategoryJsonBean bean = new ProjectCategoryJsonBean(); bean.id = projectCategoryObject.getId().toString(); bean.name = projectCategoryObject.getName(); bean.description = projectCategoryObject.getDescription(); bean.self = urls.restApi2BaseUrl() + "projectCategory/" + JiraUrlCodec.encode(bean.getId()); return bean; }
public static StatusCategoryJsonBean bean(final StatusCategory statusCategory, final JiraBaseUrls baseUrls) { if (null == statusCategory) { return null; } return bean( baseUrls.restApi2BaseUrl() + "statuscategory/" + JiraUrlCodec.encode(String.valueOf(statusCategory.getId())), statusCategory.getId(), statusCategory.getKey(), statusCategory.getColorName(), statusCategory.getTranslatedName() ); }
private static void addNonRenderableStuff(CommentJsonBean bean, @Nonnull final Comment comment, final JiraBaseUrls urls, final ProjectRoleManager projectRoleManager, final ApplicationUser loggedInUser, final EmailFormatter emailFormatter) { UserBeanFactory userBeanFactory = ComponentAccessor.getComponent(UserBeanFactory.class); bean.self = urls.restApi2BaseUrl() + "issue/" + comment.getIssue().getId() + "/comment/" + JiraUrlCodec.encode(comment.getId().toString()); bean.id = comment.getId().toString(); bean.author = userBeanFactory.createBean(comment.getAuthorApplicationUser(), loggedInUser, urls, emailFormatter, ComponentAccessor.getComponent(TimeZoneManager.class)); bean.updateAuthor = userBeanFactory.createBean(comment.getUpdateAuthorApplicationUser(), loggedInUser, urls, emailFormatter, ComponentAccessor.getComponent(TimeZoneManager.class)); bean.visibility = getVisibilityBean(comment, projectRoleManager); }
@Override public void writeHeaders(final SearchRequest searchRequest, final RequestHeaders requestHeaders, final SearchRequestParams searchRequestParams) { WordViewUtils.writeGenericNoCacheHeaders(requestHeaders); WordViewUtils.writeEncodedAttachmentFilenameHeader( requestHeaders, JiraUrlCodec.encode(SearchRequestViewUtils.getTitle(searchRequest, applicationProperties.getDefaultBackedString(APKeys.JIRA_TITLE)), true) + ".xls", searchRequestParams.getUserAgent(), applicationProperties.getEncoding()); }
public void writeHeaders(SearchRequest searchRequest, RequestHeaders requestHeaders, SearchRequestParams searchRequestParams) { WordViewUtils.writeGenericNoCacheHeaders(requestHeaders); WordViewUtils.writeEncodedAttachmentFilenameHeader( requestHeaders, JiraUrlCodec.encode(SearchRequestViewUtils.getTitle(searchRequest, applicationProperties.getDefaultBackedString(APKeys.JIRA_TITLE))) + ".doc", searchRequestParams.getUserAgent(), applicationProperties.getEncoding()); } }
public static SecuritySchemeJsonBean shortBean(final IssueSecurityLevelScheme securityLevelScheme, final JiraBaseUrls urls) { SecuritySchemeJsonBean bean = new SecuritySchemeJsonBean( getSelf(urls.restApi2BaseUrl(), JiraUrlCodec.encode(securityLevelScheme.getId().toString())), securityLevelScheme.getId(), securityLevelScheme.getName(), securityLevelScheme.getDescription()); bean.setDefaultSecurityLevelId(securityLevelScheme.getDefaultSecurityLevelId()); return bean; }
@RequiresXsrfCheck protected String doExecute() throws Exception { new UserPasswordActionHelper(this,userUtil).setPassword(getUser(), password); if (invalidInput()) { return ERROR; } return returnComplete("/secure/admin/user/ViewUser.jspa?name=" + JiraUrlCodec.encode(getName()) + "&showPasswordUpdateMsg=true"); }