Skip to content

Commit 3369b56

Browse files
author
javaage
committed
postgres
1 parent 9dbce75 commit 3369b56

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

flexible/postgres/src/main/java/com/cisco/la/UserServlet.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,22 @@ public class UserServlet extends HttpServlet {
5656

5757
@Override
5858
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
59-
PrintWriter out = resp.getWriter();
59+
60+
String url;
61+
62+
Properties properties = new Properties();
63+
try {
64+
properties.load(
65+
getServletContext().getResourceAsStream("/WEB-INF/classes/config.properties"));
66+
url = properties.getProperty("sqlUrl");
67+
} catch (IOException e) {
68+
log("no property", e); // Servlet Init should never fail.
69+
return;
70+
}
71+
72+
log("connecting to: " + url);
73+
PrintWriter out = resp.getWriter();
6074
resp.setContentType("text/plain");
61-
out.println("User:test ");
75+
out.println("connecting to: " + url);
6276
}
6377
}

0 commit comments

Comments
 (0)