/**
* 判断本地cookie是否有效
* @param (String)logFlag
* @param (String)uid 存放在cookie中的uid
* @param (String)sid 存放在cookie中的sid
* @param (String)sip 存放在cookie中的sip
* @return boolean
* @author w47626
* @add date 2005-11-11
*/
private boolean isCookieAvail(
String logFlag,
String uid,
String sid,
String sip) {
boolean cookieavail = false;
java.io.InputStream l_urlStream = null;
java.io.BufferedReader l_reader = null;
try {
String sCurrentLine;
String sTotalString;
sCurrentLine = "";
sTotalString = "";
java.net.URL l_url =
new java.net.URL(
"http://"
+ sip
+ LoginConstants.AuthServlet_PATH
+ "?sid="
+ sid
+ "&uid="
+ URLEncoder.encode(uid));
java.net.HttpURLConnection l_connection =
(java.net.HttpURLConnection) l_url.openConnection();
logger.info("url " + l_url);
l_connection.connect();
l_urlStream = l_connection.getInputStream();
l_reader =
new java.io.BufferedReader(
new java.io.InputStreamReader(l_urlStream));
while ((sCurrentLine = l_reader.readLine()) != null) {
sTotalString += sCurrentLine;
}
if (sTotalString != null && sTotalString.length() != 0) {
logger.info("sTotalString " + sTotalString);
if (sTotalString.indexOf("uid=") != -1) {
String session_uid =
sTotalString.substring(
sTotalString.indexOf("uid=") + 4,
sTotalString.length());
logger.info("sTotalString uid " + session_uid);
if ((session_uid != null)
&& (uid.equalsIgnoreCase(session_uid))) {
cookieavail = true;
} else {
logger.info(
"[INTRANET_Common-AuthFilter] login auth error >>>sid=="
+ sid
+ ";uid=="
+ uid
+ "<<<");
}
}
}
} catch (MalformedURLException malEx) {
logger.info(
"[INTRANET_Common-AuthFilter] login auth Exception !");
malEx.printStackTrace();
} catch (Exception ex) {
logger.info("[INTRANET_Common-AuthFilter] Exception !" + ex);
ex.printStackTrace();
} finally {
if (l_reader != null) {
try {
l_reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (l_urlStream != null) {
try {
l_urlStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
logger.info("cookieavail" + cookieavail);
return cookieavail;
}
* 判断本地cookie是否有效
* @param (String)logFlag
* @param (String)uid 存放在cookie中的uid
* @param (String)sid 存放在cookie中的sid
* @param (String)sip 存放在cookie中的sip
* @return boolean
* @author w47626
* @add date 2005-11-11
*/
private boolean isCookieAvail(
String logFlag,
String uid,
String sid,
String sip) {
boolean cookieavail = false;
java.io.InputStream l_urlStream = null;
java.io.BufferedReader l_reader = null;
try {
String sCurrentLine;
String sTotalString;
sCurrentLine = "";
sTotalString = "";
java.net.URL l_url =
new java.net.URL(
"http://"
+ sip
+ LoginConstants.AuthServlet_PATH
+ "?sid="
+ sid
+ "&uid="
+ URLEncoder.encode(uid));
java.net.HttpURLConnection l_connection =
(java.net.HttpURLConnection) l_url.openConnection();
logger.info("url " + l_url);
l_connection.connect();
l_urlStream = l_connection.getInputStream();
l_reader =
new java.io.BufferedReader(
new java.io.InputStreamReader(l_urlStream));
while ((sCurrentLine = l_reader.readLine()) != null) {
sTotalString += sCurrentLine;
}
if (sTotalString != null && sTotalString.length() != 0) {
logger.info("sTotalString " + sTotalString);
if (sTotalString.indexOf("uid=") != -1) {
String session_uid =
sTotalString.substring(
sTotalString.indexOf("uid=") + 4,
sTotalString.length());
logger.info("sTotalString uid " + session_uid);
if ((session_uid != null)
&& (uid.equalsIgnoreCase(session_uid))) {
cookieavail = true;
} else {
logger.info(
"[INTRANET_Common-AuthFilter] login auth error >>>sid=="
+ sid
+ ";uid=="
+ uid
+ "<<<");
}
}
}
} catch (MalformedURLException malEx) {
logger.info(
"[INTRANET_Common-AuthFilter] login auth Exception !");
malEx.printStackTrace();
} catch (Exception ex) {
logger.info("[INTRANET_Common-AuthFilter] Exception !" + ex);
ex.printStackTrace();
} finally {
if (l_reader != null) {
try {
l_reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (l_urlStream != null) {
try {
l_urlStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
logger.info("cookieavail" + cookieavail);
return cookieavail;
}