Move to API that is not deprecated.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 24 Feb 2003 23:50:23 +0000 (23:50 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 24 Feb 2003 23:50:23 +0000 (23:50 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@510 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/wayf/Origin.java
src/edu/internet2/middleware/shibboleth/wayf/WayfService.java
src/edu/internet2/middleware/shibboleth/wayf/WayfTester.java

index 53c1269..588d684 100755 (executable)
@@ -49,6 +49,7 @@
 
 package edu.internet2.middleware.shibboleth.wayf;
 
+import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Enumeration;
@@ -102,10 +103,9 @@ public class Origin {
        }
     }
 
-    public String getUrlEncodedName() {
-
-        return URLEncoder.encode(name);
+    public String getUrlEncodedName() throws UnsupportedEncodingException {
 
+                       return URLEncoder.encode(name, "UTF-8");
     }
 
     /**
index 67b246e..020336c 100755 (executable)
@@ -205,18 +205,19 @@ public class WayfService extends HttpServlet {
         */
        private void handleLookup(HttpServletRequest req, HttpServletResponse res) throws WayfException {
 
-               if ((getSHIRE(req) == null) || (getTarget(req) == null)) {
-                       throw new WayfException("Invalid or missing data from SHIRE");
-               }
-               req.setAttribute("shire", getSHIRE(req));
-               req.setAttribute("target", getTarget(req));
-               req.setAttribute("encodedShire", URLEncoder.encode(getSHIRE(req)));
-               req.setAttribute("encodedTarget", URLEncoder.encode(getTarget(req)));
-               req.setAttribute("requestURL", req.getRequestURI().toString());
-
-               log.debug("Displaying WAYF selection page.");
-               RequestDispatcher rd = req.getRequestDispatcher("/wayf.jsp");
                try {
+                       if ((getSHIRE(req) == null) || (getTarget(req) == null)) {
+                               throw new WayfException("Invalid or missing data from SHIRE");
+                       }
+                       req.setAttribute("shire", getSHIRE(req));
+                       req.setAttribute("target", getTarget(req));
+                       req.setAttribute("encodedShire", URLEncoder.encode(getSHIRE(req), "UTF-8"));
+                       req.setAttribute("encodedTarget", URLEncoder.encode(getTarget(req), "UTF-8"));
+                       req.setAttribute("requestURL", req.getRequestURI().toString());
+
+                       log.debug("Displaying WAYF selection page.");
+                       RequestDispatcher rd = req.getRequestDispatcher("/wayf.jsp");
+
                        rd.forward(req, res);
                } catch (IOException ioe) {
                        throw new WayfException("Problem displaying WAYF UI." + ioe.toString());
@@ -271,9 +272,9 @@ public class WayfService extends HttpServlet {
                        res.sendRedirect(
                                handleService
                                        + "?target="
-                                       + URLEncoder.encode(target)
+                                       + URLEncoder.encode(target, "UTF-8")
                                        + "&shire="
-                                       + URLEncoder.encode(shire));
+                                       + URLEncoder.encode(shire, "UTF-8"));
                } catch (IOException ioe) {
                        throw new WayfException("Error forwarding to HS: " + ioe.toString());
                }
index e5bb6c2..23555a4 100755 (executable)
@@ -52,8 +52,6 @@ package edu.internet2.middleware.shibboleth.wayf;
 import java.io.IOException;
 import java.net.URLEncoder;
 
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -73,7 +71,7 @@ public class WayfTester extends HttpServlet {
                
                try {
                        res.sendRedirect(
-                               "WAYF" + "?target=" + URLEncoder.encode(targetURL) + "&shire=" + URLEncoder.encode(acceptanceURL));
+                               "WAYF" + "?target=" + URLEncoder.encode(targetURL, "UTF-8") + "&shire=" + URLEncoder.encode(acceptanceURL, "UTF-8"));
                } catch (IOException ioe) {
                        System.out.println("WAYF Tester Error");
                }