I am trying to fetch a page using HTTPGET apache method but it throws me this exception :
Illegal character in path at index 65: http://doctorat.tuiasi.ro/Htm/Proiecte_POSDRU_17.02.2013/Proiecte europene.html
I know the space out there may be the cause of the problem but I am trying to filter the url like that
String url=everyUrl.getUrl().replaceAll(" ", "%20");
if (url.contains("http://")) {
Pattern allowedUrlCharacters = Pattern
.compile("([A-Za-z0-9_.~:/?\\#\\[\\]@!$&'()*+,;" + "=-]|%[0-9a-fA-F]{2})+");
Matcher matcher = allowedUrlCharacters.matcher(url);
if (matcher.find()) {
pushInFrontQueues(url);
}
// System.out.println(this.frontQueues.get(0).size());
}
}
What I am doing wrong ? Can anyone help me please?