. "cbf018ca6ece542ddf32142759614116" . . . "2017-06-29T07:29:24Z" . "ODSControllerJSPAPILoginSource" . . . "ODSControllerJSPAPILoginSource" . . "2017-06-29T07:29:24.168277"^^ . . "2017-06-13T06:07:22Z" . . "ODSControllerJSPAPILoginSource" . . . "2017-06-13T06:07:22.828966"^^ . "---++ODS Controller for JSP API Login Source Code\n\nThe following source code represents the ODS Controller for JSP API Login users.jsp file:\n\n\n\n\n\n<%@ page import=\"java.sql.*\" %>\n<%@ page import=\"java.io.*\" %>\n<%@ page import=\"java.util.*\" %>\n<%@ page import=\"java.net.HttpURLConnection\" %>\n<%@ page import=\"java.net.MalformedURLException\" %>\n<%@ page import=\"java.net.ProtocolException\" %>\n<%@ page import=\"java.net.URL\" %>\n<%@ page import=\"java.net.URLEncoder\" %>\n\n<%@ page import=\"java.security.MessageDigest\" %>\n<%@ page import=\"java.security.NoSuchAlgorithmException\" %>\n<%@ page import=\"sun.misc.BASE64Encoder\" %>\n\n<%@ page import=\"javax.xml.parsers.*\" %>\n<%@ page import=\"javax.xml.xpath.*\" %>\n\n<%@ page import=\"org.xml.sax.InputSource\" %>\n\n<%@ page import=\"org.w3c.dom.*\" %>\n\n \n Virtuoso Web Applications\n \n \n \n \n \n \n \n \n \n \n \n <%!\n XPathFactory factory = XPathFactory.newInstance();\n XPath xpath = factory.newXPath();\n\n Document createDocument (String S)\n {\n try\n {\n DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n if (factory == null)\n\t throw new RuntimeException(\"Unable to create XML document factory\");\n DocumentBuilder builder = factory.newDocumentBuilder();\n if (builder == null)\n\t throw new RuntimeException(\"Unable to create XML document factory\");\n StringReader stringReader = new StringReader(S);\n InputSource is = new InputSource(stringReader);\n\t return builder.parse(is);\n }\n catch (Exception e)\n {\n throw new RuntimeException(\"Error creating XML document factory : \" + e.getMessage());\n }\n }\n\n String encrypt (String S)\n {\n String hash = new String(\"\");\n try {\n MessageDigest md = MessageDigest.getInstance(\"SHA-1\");\n byte[] textBytes = S.getBytes(\"UTF-8\");\n md.update(textBytes);\n for (byte b : md.digest()) {\n hash += Integer.toHexString(b & 0xff);\n }\n }\n catch (NoSuchAlgorithmException e) {\n e.printStackTrace();\n }\n catch (UnsupportedEncodingException ex) {\n ex.printStackTrace();\n }\n return hash;\n }\n\n String httpParam (String prefix, String key, String value)\n throws Exception\n {\n String S = \"\";\n if (value != null)\n S = prefix + key + \"=\" + URLEncoder.encode(value);\n return S;\n }\n\n String httpRequest (String httpMethod, String method, String params)\n throws Exception\n {\n HttpURLConnection connection = null;\n DataOutputStream wr = null;\n BufferedReader rd = null;\n StringBuilder sb = null;\n String line = null;\n URL serverAddress = null;\n Boolean isFirst = true;\n\n try {\n serverAddress = new URL(\"http://localhost:8005/ods/api/\"+method);\n\n //Set up the initial connection\n connection = (HttpURLConnection)serverAddress.openConnection();\n connection.setRequestMethod(httpMethod);\n connection.setDoOutput(true);\n connection.setDoInput(true);\n connection.setReadTimeout(10000);\n connection.connect();\n\n //get the output stream writer and write the output to the server\n wr = new DataOutputStream(connection.getOutputStream());\n if (params != null) {\n wr.writeBytes(params);\n }\n wr.flush ();\n wr.close ();\n\n //read the result from the server\n rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n sb = new StringBuilder();\n\n while ((line = rd.readLine()) != null) {\n if (!isFirst)\n sb.append('\\n');\n sb.append(line);\n isFirst = false;\n }\n rd.close ();\n return sb.toString();\n }\n catch (MalformedURLException e) {\n e.printStackTrace();\n }\n catch (ProtocolException e) {\n e.printStackTrace();\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n finally {\n //close the connection, set all objects to null\n connection.disconnect();\n rd = null;\n sb = null;\n wr = null;\n connection = null;\n }\n throw new Exception (\"Bad request!\");\n }\n\n String xpathEvaluate (Document doc, String xpathString)\n throws XPathExpressionException\n {\n return xpath.evaluate(xpathString, doc);\n }\n\n void outFormTitle (javax.servlet.jsp.JspWriter out, String formName)\n throws IOException\n {\n if (formName.equals(\"login\"))\n out.print(\"Login\");\n if (formName.equals(\"register\"))\n out.print(\"Register\");\n if (formName.equals(\"user\"))\n out.print(\"View Profile\");\n if (formName.equals(\"profile\"))\n out.print(\"Edit Profile\");\n }\n\n void outSelectOptions (javax.servlet.jsp.JspWriter out, String fieldValue, String listValue)\n throws IOException, SQLException\n {\n outSelectOptions (out, fieldValue, listValue, null);\n }\n\n void outSelectOptions (javax.servlet.jsp.JspWriter out, String fieldValue, String listValue, String paramValue)\n {\n try\n {\n String params;\n params = httpParam (\"\", \"key\", listValue);\n if (paramValue != null)\n params += httpParam (\"&\", \"param\", paramValue);\n String retValue = httpRequest (\"GET\", \"lookup.list\", params);\n Document doc = createDocument(retValue);\n\n XPathFactory factory = XPathFactory.newInstance();\n XPath xpath = factory.newXPath();\n XPathExpression expr = xpath.compile(\"/items/item/text()\");\n\n Object result = expr.evaluate(doc, XPathConstants.NODESET);\n NodeList nodes = (NodeList) result;\n for (int i = 0; i < nodes.getLength(); i++) {\n String F = nodes.item(i).getNodeValue();\n out.print (\"\" + F + \"\");\n }\n } catch (Exception e) {\n }\n }\n %>\n <%\n String $_form = request.getParameter(\"form\");\n if ($_form == null)\n $_form = \"login\";\n String $_sid = request.getParameter(\"sid\");\n String $_realm = \"wa\";\n String $_error = \"\";\n String $_retValue;\n Document $_document = null;\n String params = null;\n\n try\n {\n if ($_form.equals(\"login\"))\n {\n if (request.getParameter(\"lf_login\") != null)\n {\n try\n {\n params = httpParam ( \"\", \"user_name\", request.getParameter(\"lf_uid\")) +\n httpParam (\"&\", \"password_hash\", encrypt (request.getParameter(\"lf_uid\")+request.getParameter(\"lf_password\")));\n $_retValue = httpRequest (\"GET\", \"user.authenticate\", params);\n if ($_retValue.indexOf(\"\") == 0)\n {\n \t\t $_document = createDocument($_retValue);\n throw new Exception(xpathEvaluate($_document, \"/failed/message\"));\n }\n $_sid = $_retValue;\n $_form = \"user\";\n }\n catch (Exception e)\n {\n $_error = e.getMessage();\n }\n }\n }\n\n if ($_form.equals(\"user\"))\n {\n if (request.getParameter(\"uf_profile\") != null)\n $_form = \"profile\";\n }\n\n if ($_form.equals(\"profile\"))\n {\n if (request.getParameter(\"pf_update\") != null)\n {\n try {\n params = httpParam ( \"\", \"sid\" , $_sid) +\n httpParam (\"&\", \"realm\" , $_realm) +\n httpParam (\"&\", \"mail\" , request.getParameter(\"pf_mail\")) +\n httpParam (\"&\", \"title\" , request.getParameter(\"pf_title\")) +\n httpParam (\"&\", \"firstName\" , request.getParameter(\"pf_firstName\")) +\n httpParam (\"&\", \"lastName\" , request.getParameter(\"pf_lastName\")) +\n httpParam (\"&\", \"fullName\" , request.getParameter(\"pf_fullName\")) +\n httpParam (\"&\", \"gender\" , request.getParameter(\"pf_gender\")) +\n httpParam (\"&\", \"birthday\" , request.getParameter(\"pf_birthday\")) +\n httpParam (\"&\", \"icq\" , request.getParameter(\"pf_icq\")) +\n httpParam (\"&\", \"skype\" , request.getParameter(\"pf_skype\")) +\n httpParam (\"&\", \"yahoo\" , request.getParameter(\"pf_yahoo\")) +\n httpParam (\"&\", \"aim\" , request.getParameter(\"pf_aim\")) +\n httpParam (\"&\", \"msn\" , request.getParameter(\"pf_msn\")) +\n httpParam (\"&\", \"homeDefaultMapLocation\", request.getParameter(\"pf_homeDefaultMapLocation\")) +\n httpParam (\"&\", \"homeCountry\" , request.getParameter(\"pf_homecountry\")) +\n httpParam (\"&\", \"homeState\" , request.getParameter(\"pf_homestate\")) +\n httpParam (\"&\", \"homeCity\" , request.getParameter(\"pf_homecity\")) +\n httpParam (\"&\", \"homeCode\" , request.getParameter(\"pf_homecode\")) +\n httpParam (\"&\", \"homeAddress1\" , request.getParameter(\"pf_homeaddress1\")) +\n httpParam (\"&\", \"homeAddress2\" , request.getParameter(\"pf_homeaddress2\")) +\n httpParam (\"&\", \"homeTimezone\" , request.getParameter(\"pf_homeTimezone\")) +\n httpParam (\"&\", \"homeLatitude\" , request.getParameter(\"pf_homelat\")) +\n httpParam (\"&\", \"homeLongitude\" , request.getParameter(\"pf_homelng\")) +\n httpParam (\"&\", \"homePhone\" , request.getParameter(\"pf_homePhone\")) +\n httpParam (\"&\", \"homeMobile\" , request.getParameter(\"pf_homeMobile\")) +\n httpParam (\"&\", \"businessIndustry\" , request.getParameter(\"pf_businessIndustry\")) +\n httpParam (\"&\", \"businessOrganization\" , request.getParameter(\"pf_businessOrganization\")) +\n httpParam (\"&\", \"businessHomePage\" , request.getParameter(\"pf_businessHomePage\")) +\n httpParam (\"&\", \"businessJob\" , request.getParameter(\"pf_businessJob\")) +\n httpParam (\"&\", \"businessCountry\" , request.getParameter(\"pf_businesscountry\")) +\n httpParam (\"&\", \"businessState\" , request.getParameter(\"pf_businessstate\")) +\n httpParam (\"&\", \"businessCity\" , request.getParameter(\"pf_businesscity\")) +\n httpParam (\"&\", \"businessCode\" , request.getParameter(\"pf_businesscode\")) +\n httpParam (\"&\", \"businessAddress1\" , request.getParameter(\"pf_businessaddress1\")) +\n httpParam (\"&\", \"businessAddress2\" , request.getParameter(\"pf_businessaddress2\")) +\n httpParam (\"&\", \"businessTimezone\" , request.getParameter(\"pf_businessTimezone\")) +\n httpParam (\"&\", \"businessLatitude\" , request.getParameter(\"pf_businesslat\")) +\n httpParam (\"&\", \"businessLongitude\" , request.getParameter(\"pf_businesslng\")) +\n httpParam (\"&\", \"businessPhone\" , request.getParameter(\"pf_businessPhone\")) +\n httpParam (\"&\", \"businessMobile\" , request.getParameter(\"pf_businessMobile\")) +\n httpParam (\"&\", \"businessRegNo\" , request.getParameter(\"pf_businessRegNo\")) +\n httpParam (\"&\", \"businessCareer\" , request.getParameter(\"pf_businessCareer\")) +\n httpParam (\"&\", \"businessEmployees\" , request.getParameter(\"pf_businessEmployees\")) +\n httpParam (\"&\", \"businessVendor\" , request.getParameter(\"pf_businessVendor\")) +\n httpParam (\"&\", \"businessService\" , request.getParameter(\"pf_businessService\")) +\n httpParam (\"&\", \"businessOther\" , request.getParameter(\"pf_businessOther\")) +\n httpParam (\"&\", \"businessNetwork\" , request.getParameter(\"pf_businessNetwork\")) +\n httpParam (\"&\", \"businessResume\" , request.getParameter(\"pf_businessResume\")) +\n httpParam (\"&\", \"securitySecretQuestion\", request.getParameter(\"pf_securitySecretQuestion\")) +\n httpParam (\"&\", \"securitySecretAnswer\" , request.getParameter(\"pf_securitySecretAnswer\")) +\n httpParam (\"&\", \"securitySiocLimit\" , request.getParameter(\"pf_securitySiocLimit\"));\n\n $_retValue = httpRequest (\"POST\", \"user.update.fields\", params);\n if ($_retValue.indexOf(\"\") == 0)\n {\n \t\t $_document = createDocument($_retValue);\n throw new Exception(xpathEvaluate($_document, \"/failed/message\"));\n }\n $_form = \"user\";\n }\n catch (Exception e)\n {\n $_error = e.getMessage();\n $_form = \"login\";\n }\n }\n else if (request.getParameter(\"pf_cancel\") != null)\n {\n $_form = \"user\";\n }\n }\n\n if ($_form.equals(\"user\") || $_form.equals(\"profile\"))\n {\n try\n {\n params = httpParam ( \"\", \"sid\" , $_sid) +\n httpParam (\"&\", \"realm\" , $_realm);\n if ($_form.equals(\"profile\"))\n params += httpParam (\"&\", \"short\", \"0\");\n $_retValue = httpRequest (\"GET\", \"user.info\", params);\n\t\t $_document = createDocument($_retValue);\n if (\"\".compareTo(xpathEvaluate($_document, \"/failed/message\")) != 0)\n throw new Exception (xpathEvaluate($_document, \"/failed/message\"));\n }\n catch (Exception e)\n {\n $_error = e.getMessage();\n $_form = \"login\";\n }\n }\n\n if ($_form.equals(\"login\"))\n {\n $_sid = \"\";\n }\n }\n catch (Exception e)\n {\n $_error = \"Failure to connect to JDBC. \" + e.getMessage();\n }\n %>\n \n
\n
\n
\n \" />\n \" />\n \" />\n
\n
&realm=<% out.print($_realm); %>\">ODS Home > <% outFormTitle (out, $_form); %>
\n <%\n if ($_form != \"login\")\n {\n %>\n \n <%\n }\n %>\n
\n
\n \n \n \n \n \n
\n
\n
\n \n \"FOAF\"\n \n
\n
\n <%\n if ($_form.equals(\"login\"))\n {\n %>\n
\n <%\n if ($_error != \"\")\n {\n out.print(\"
\" + $_error + \"
\");\n }\n %>\n
\n Enter your Member ID and Password\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n
\n \n \n \n
\n or\n \n
\n \n \n \n
\n
\n \n
\n
\n <%\n }\n if ($_form.equals(\"user\"))\n {\n %>\n
\n
\n User profile\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n Login Name\n \n <% out.print(xpathEvaluate($_document, \"/user/name\")); %>\n
\n E-mail\n \n <% out.print(xpathEvaluate($_document, \"/user/mail\")); %>\n
\n Title\n \n <% out.print(xpathEvaluate($_document, \"/user/title\")); %>\n
\n First Name\n \n <% out.print(xpathEvaluate($_document, \"/user/firstName\")); %>\n
\n Last Name\n \n <% out.print(xpathEvaluate($_document, \"/user/lastName\")); %>\n
\n Full Name\n \n <% out.print(xpathEvaluate($_document, \"/user/fullName\")); %>\n
\n
\n \n
\n
\n <%\n }\n if ($_form.equals(\"profile\"))\n {\n %>\n
\n <%\n if ($_error != \"\")\n {\n out.print(\"
\" + $_error + \"
\");\n }\n %>\n
\n Update user profile\n
\n
    \n
  • Personal
  • \n
  • Contact
  • \n
  • Home
  • \n
  • Business
  • \n
  • Security
  • \n
\n
\n
\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n
\n \n \n \" id=\"pf_firstName\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_lastName\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_fullName\" size=\"60\" />\n
\n \n \n \" id=\"pf_mail\" style=\"width: 220px;\" />\n
\n \n \n \n
\n \n \n \" onclick=\"cPopup.select ($('pf_birthday'), 'pf_birthday_select', 'yyyy-MM-dd');\"/>\n \n
\n
\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \" id=\"pf_icq\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_skype\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_yahoo\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_aim\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_msn\" style=\"width: 220px;\" />\n
\n
\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n
\n \n \n \n \n \n
\n \n \n \" id=\"pf_homecity\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_homecode\" style=\"width: 220px;\"/>\n
\n \n \n \" id=\"pf_homeaddress1\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_homeaddress2\" style=\"width: 220px;\" />\n
\n \n \n \n
\n \n \n \" id=\"pf_homelat\" />\n \n \n
\n \n \n \" id=\"pf_homelng\" />\n
\n \n \n \" id=\"pf_homePhone\" />\n
\n \n \n \" id=\"pf_homeMobile\" />\n
\n
\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n
\n \n \n \" id=\"pf_businessOrganization\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_businessNetwork\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_businessJob\" style=\"width: 220px;\" />\n
\n \n \n \n
\n \n \n \n \n \n
\n \n \n \" id=\"pf_businesscity\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_businesscode\" style=\"width: 220px;\"/>\n
\n \n \n \" id=\"pf_businessaddress1\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_businessaddress2\" style=\"width: 220px;\" />\n
\n \n \n \n
\n \n \n \" id=\"pf_businesslat\" />\n \n \n
\n \n \n \" id=\"pf_businesslng\" />\n
\n \n \n \" id=\"pf_businessPhone\" />\n
\n \n \n \" id=\"pf_businessMobile\" />\n
\n \n \n \" id=\"pf_businessRegNo\" style=\"width: 220px;\" />\n
\n \n \n \n
\n \n \n \n
\n \n \n \n
\n \n \n \n
\n \n \n \" id=\"pf_businessOther\" style=\"width: 220px;\" />\n
\n \n \n \" id=\"pf_businessNetwork\" style=\"width: 220px;\" />\n
\n \n \n \n
\n
\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n Password Settings\n
\n \n \n \n
\n \n \n \n
\n \n \n \n \n
\n Password Recovery\n
\n \n \n \" id=\"pf_securitySecretQuestion\" style=\"width: 220px;\" />\n \n
\n \n \n \" id=\"pf_securitySecretAnswer\" style=\"width: 220px;\" />\n
\n Applications restrictions\n
\n \n \n \" id=\"pf_securitySiocLimit\" />\n
\n
\n\n
\n
\n \n \n
\n
\n <%\n }\n %>\n
\n
\n
\n
\n
\n \"Powered\n
\n
\n FAQ | Privacy | Report Abuse\n
\n Copyright © 1999-2009 OpenLink Software\n
\n
\n
\n \n\n
" . . . .