Issues while connecting to RTC from lotus notes!!
Hello Guys,
Here is my problem!! I am trying to connect to RTC from lotus notes java agent. I have an string called "ABC Apps" and i use the below code to create an java.net.URI object, it works fine!!
String projectAreaName="ABC Apps";
java.net.URI uri= java.net.URI.create(projectAreaName.replaceAll(" ", "%20"));
IProjectArea projectArea= (IProjectArea) processClient.findProcessArea(uri, null, null);
System.out.println("project area"+projectArea);
if (projectArea == null) {
status_msg= status_msg + "Project area not found." +eol;
System.out.println("Project area not found.");
}
But its not able to parse the below string with special characters
String projectAreaName="ABC & Systems Management, Level 2 & Support (eXYZ)";
java.net.URI uri= java.net.URI.create(projectAreaName.replaceAll(" ","%20"));
Getting an error saying "Project area not found"
Can someone please help me to get rid off this problem ?
Thank you!!!
One answer
I believe your problem might stem from the ampersand & and brackets (), as they are special characters in an URI and need to be escaped. You already do this with the spaces in the project area name by replacing them with "%20".
Thankfully, Java has an easy solution for you, so you do not have to do all the encoding yourself. You could try the following:
String projectAreaName = "ABC & Systems Management, Level 2 & Support (eXYZ)"; java.net.URI uri= java.net.URI.create(URLEncoder.encode(projectAreaName , "utf-8" ));
Hope that helps!