Clean up style and comments in Credentials class
@@ -123,19 +123,22 @@ public class Credentials implements Serializable {
if (matcher.matches())
this.remoteAddress = matcher.group(1);
}
+
// Header not present, just use remote address
- else {
+ else
this.remoteAddress = request.getRemoteAddr();
- }
+ // Get the remote hostname
this.remoteHostname = request.getRemoteHost();
+ // If session exists get it, but don't create a new one.
this.session = request.getSession(false);
}
/**
* Returns the password associated with this set of credentials.
+ *
* @return The password associated with this username/password pair, or
* null if no password has been set.
*/
@@ -145,6 +148,7 @@ public class Credentials implements Serializable {
/**
* Sets the password associated with this set of credentials.
+ *
* @param password The password to associate with this username/password
* pair.
*/
@@ -154,6 +158,7 @@ public class Credentials implements Serializable {
/**
* Returns the username associated with this set of credentials.
+ *
* @return The username associated with this username/password pair, or
* null if no username has been set.
*/
@@ -163,6 +168,7 @@ public class Credentials implements Serializable {
/**
* Sets the username associated with this set of credentials.
+ *
* @param username The username to associate with this username/password
* pair.
*/
@@ -172,6 +178,7 @@ public class Credentials implements Serializable {
/**
* Returns the HttpServletRequest associated with this set of credentials.
+ *
* @return The HttpServletRequest associated with this set of credentials,
* or null if no such request exists.
*/
@@ -181,8 +188,6 @@ public class Credentials implements Serializable {
/**
* Sets the HttpServletRequest associated with this set of credentials.
- * Also sets the remoteAddress and remoteHostname objects, checking the
- * request for X-Forwarded-For or falling back to provided remote address.
*
* @param request The HttpServletRequest to associated with this set of
* credentials.
@@ -193,6 +198,7 @@ public class Credentials implements Serializable {
/**
* Returns the HttpSession associated with this set of credentials.
+ *
* @return The HttpSession associated with this set of credentials, or null
* if no such request exists.
*/
@@ -202,6 +208,7 @@ public class Credentials implements Serializable {
/**
* Sets the HttpSession associated with this set of credentials.
+ *
* @param session The HttpSession to associated with this set of
* credentials.
*/
