/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: PAOSHeader.java,v 1.4 2008/06/25 05:47:20 qcheng Exp $
*
*/
/**
* The <code>PAOSHeader</code> class is used by a web application
* on HTTP server side to parse a <code>PAOS</code> header in an HTTP request
* from the user agent side. This header is used by the User Agent
* as a <code>PAOS</code> server to publish which services are available, which
* <code>PAOS</code> versions are supported, etc..
*
* An example <code>PAOS</code> header looks like the following:
* <pre>
* PAOS: ver="ver1","ver2",ext="ext1","ext2";"service1","opt11",
* "opt12";"service2","opt21","opt22"
* </pre>
*
* This class has methods for obtaining all the parts inside such
* a header.
*
* @supported.all.api
*/
public class PAOSHeader {
// keys are strings and value are sets (set elements are
// Strings)
/**
* This constructor accepts an <code>HttpServletRequest</code>
* and tries to parse the <code>PAOS</code> header string if there is one
* inside.
*
* @param req the incoming HTTP request which is supposed
* to contain the <code>PAOS</code> header.
* @throws PAOSException if there are any parsing errors because
* the <code>PAOS</code> header is not there at all or
* because its content is not compliant to the
* <code>PAOS</code> specifications.
*/
}
if (paosHeaderStr != null) {
} else {
"PAOSHeader:PAOSHeader: No POAS header.");
throw new PAOSException(
"There is no PAOS header.");
}
parse();
}
/**
* This constructor accepts a <code>PAOS</code> header string and tries to
* parse it.
*
* @param paosHeaderString the <code>PAOS</code> header string which
* supposedly contains information on available services, etc..
* @throws PAOSException if there are any parsing error because the
* <code>PAOS</code> header is invalid.
*/
if (paosHeaderStr != null) {
} else {
"PAOSHeader:PAOSHeader: No POAS header.");
throw new PAOSException(
"There is no PAOS header.");
}
parse();
}
/**
* Parses the <code>PAOS</code> Header.
*/
"PAOSHeader:PAOSHeader: Null POAS header.");
throw new PAOSException(
"PAOS header value is empty");
}
StringTokenizer st1 = new
int n = st1.countTokens();
if (indexOfExt < 0) {
} else {
}
} else {
}
while (st3.hasMoreTokens()) {
}
if (indexOfExt >= 0) {
while (st4.hasMoreTokens()) {
}
}
while (st1.hasMoreTokens()) {
if (st5.hasMoreTokens()) {
}
if (st5.hasMoreTokens()) {
while (st5.hasMoreTokens()) {
}
}
}
}
}
return inStr;
}
/**
* Returns the list of versions as <code>String</code>s.
*
* @return the list of versions as <code>String</code>s.
*/
return versionList.iterator();
}
/**
* Returns the list of extensions as <code>String</code>s.
*
* @return the list of extensions as <code>String</code>s.
*/
return extensionList.iterator();
}
/**
* Returns a <code>HashMap</code> containing the services and
* corresponding options.
*
* @return a <code>HashMap</code> with each key being a service represented
* as a <code>String</code>, and with each value being a
* <code>Set</code> of the corresponding options represented
* as <code>String</code>s
*/
return servicesAndOptions;
}
}