com.sun.jini.jeri.internal.http
Class ServerInfo

java.lang.Object
  extended by com.sun.jini.jeri.internal.http.ServerInfo
All Implemented Interfaces:
Cloneable

 class ServerInfo
extends Object
implements Cloneable

Remote HTTP server version/authentication information. REMIND: need manage/null out password more strictly?

Author:
Sun Microsystems, Inc.

Nested Class Summary
private static class ServerInfo.LineParser
          Class for parsing multi-part HTTP header lines that may appear as the values of the WWW-Authenticate, Proxy-Authenticate, Authorization-Info or Proxy-Authorization-Info header lines.
 
Field Summary
(package private)  String authAlgorithm
          authentication algorithm
(package private)  String authNonce
          authentication challenge
(package private)  String authOpaque
          authentication cookie
(package private)  String authPassword
          authentication password
(package private)  String authRealm
          authentication realm
(package private)  String authScheme
          authentication scheme, if any
(package private)  String authUser
          authentication username
private static char[] hexChars
          hexadecimal char conversion table
(package private)  String host
          server host name
(package private)  int major
          HTTP major version
(package private)  int minor
          HTTP minor version
(package private) static long NO_TIMESTAMP
          blank timestamp value
(package private)  int port
          server port
(package private)  long timestamp
          time of last update
 
Constructor Summary
ServerInfo(String host, int port)
          Creates new ServerInfo for server at given host/port.
 
Method Summary
 Object clone()
           
private  String computeDigest(String method, String uri)
          Computes digest authentication response for request using the given method and uri.
private  String encode(MessageDigest md, String str)
          Returns digest of the given string, represented as string of hexadecimal digits.
(package private)  String getAuthString(String protocol, String method, String uri)
          Returns (possibly null) authorization string based on current authentication information in conjunction with the given request arguments.
private  PasswordAuthentication getPassword(String protocol)
          Obtains PasswordAuthentication from the currently installed Authenticator.
(package private)  void setAuthInfo(String str)
          Sets authentication information based on contents of given challenge string (which should be the value of either the "WWW-Authenticate" or "Proxy-Authenticate" header fields).
(package private)  void updateAuthInfo(String str)
          Updates authentication information based on contents of given string (which should be the value of either the "Authorization-Info" or "Proxy-Authorization-Info" header fields).
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_TIMESTAMP

static final long NO_TIMESTAMP
blank timestamp value

See Also:
Constant Field Values

hexChars

private static final char[] hexChars
hexadecimal char conversion table


host

final String host
server host name


port

final int port
server port


major

int major
HTTP major version


minor

int minor
HTTP minor version


authScheme

String authScheme
authentication scheme, if any


authRealm

String authRealm
authentication realm


authAlgorithm

String authAlgorithm
authentication algorithm


authOpaque

String authOpaque
authentication cookie


authNonce

String authNonce
authentication challenge


authUser

String authUser
authentication username


authPassword

String authPassword
authentication password


timestamp

long timestamp
time of last update

Constructor Detail

ServerInfo

ServerInfo(String host,
           int port)
Creates new ServerInfo for server at given host/port.

Method Detail

setAuthInfo

void setAuthInfo(String str)
           throws HttpParseException
Sets authentication information based on contents of given challenge string (which should be the value of either the "WWW-Authenticate" or "Proxy-Authenticate" header fields). If given string is null or empty, clears any previous authentication information.

Throws:
HttpParseException

updateAuthInfo

void updateAuthInfo(String str)
              throws HttpParseException
Updates authentication information based on contents of given string (which should be the value of either the "Authorization-Info" or "Proxy-Authorization-Info" header fields). If given string is null or empty, current authentication settings are left unchanged.

Throws:
HttpParseException

getAuthString

String getAuthString(String protocol,
                     String method,
                     String uri)
Returns (possibly null) authorization string based on current authentication information in conjunction with the given request arguments.


computeDigest

private String computeDigest(String method,
                             String uri)
                      throws NoSuchAlgorithmException
Computes digest authentication response for request using the given method and uri. Throws NoSuchAlgorithmException if server-specified digest algorithm not supported.

Throws:
NoSuchAlgorithmException

encode

private String encode(MessageDigest md,
                      String str)
Returns digest of the given string, represented as string of hexadecimal digits.


clone

public Object clone()
Overrides:
clone in class Object

getPassword

private PasswordAuthentication getPassword(String protocol)
Obtains PasswordAuthentication from the currently installed Authenticator.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.