Skip to content

Commit

Permalink
- URL decoder utilizando apache commons.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleyson de Sousa Rios committed Oct 6, 2015
1 parent 586bd57 commit 6bdd875
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/br/gov/go/saude/pentaho/integrator/ws/IntegratorREST.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
/**
*
* @author Kleyson Rios<br>
* Secretaria de Saúde do Estado de Goiás<br>
* Secretaria de Saude do Estado de Goias<br>
* www.saude.go.gov.br
*
* @contribution Marcello Pontes<br>
* www.oncase.com.br
*
*/

import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -60,19 +57,7 @@ public Response redirectLink(@Context UriInfo info) throws URISyntaxException

String myUrl = new String( Base64.decodeBase64(myUrlEncoded.getBytes()) );

URI pentahoBaseUrl = null;

try
{
// Workaround for java.net.URISyntaxException: Illegal character
pentahoBaseUrl = info.getBaseUri().resolve("../../" + URLEncoder.encode(URLDecoder.decode(myUrl, "UTF-8"), "UTF-8").replaceAll("\\%2[fF]", "/").replaceAll("\\+", "%20") );
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
return Response.status(500).type("text/plain").entity("Integrator Error: ERROR.").build();

}
URI pentahoBaseUrl = info.getBaseUri().resolve("../../" + myUrl);

return Response.temporaryRedirect(pentahoBaseUrl).build();
}
Expand Down

0 comments on commit 6bdd875

Please sign in to comment.