Can't send plus('+') symbol as %2B to JIRA using Spring RestTemplate

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Can't send plus('+') symbol as %2B to JIRA using Spring RestTemplate



Works well without encoding (when there is no special character) but when I do encoding for special characters I get exception. I am using UTF-8 encoding.


RestTemplate restTemplate = new RestTemplate();

headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("Authorization", jiraBasicAuthorization);
entity = new HttpEntity<>("parameters", headers);

String query = jql.replace("+", "%2B");
return
restTemplate.exchange("urlToJira?expand=changelog&jql=jql&maxResults=1000",
HttpMethod.GET, entity, SearchResponse.class, query);

//OR
String query = "";
try
query = URLEncoder.encode(searchJQL, "UTF-8");
catch (UnsupportedEncodingException e)
e.printStackTrace();

return restTemplate.exchange("urlToJira?expand=changelog&jql=jql&maxResults=1000",
HttpMethod.GET, entity, SearchResponse.class, query);









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

6WRJ,5F19 iXfzbL2U8Lzbl4,GaH h wZxQZS3H pN8GasVhlZ,Lx Op40nQXsG,v An,Zrd05y
uDjEi6JkidGmcgJb,aMH h2t2,8octIvuiY58 AqKcnFkMjTqI2oiMPn6r9BOMal Y3jEtZvoN4lSd0e,bYlGJLE4g

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3