public class UserAgentUtil extends Object
User-Agent
header from the JVM, following IVOA usage conventions.
These conventions are codified in the
SoftID IVOA Note.
Typical usage for a validator client would be:
String uaComment = UserAgentUtil.COMMENT_TEST; // "(IVOA-test)" UserAgentUtil.pushUserAgentToken( uaComment ); ... do validation ... UserAgentUtil.popUserAgentToken( uaComment );
Modifier and Type | Field and Description |
---|---|
static String |
AGENT_PROPNAME
System property that can be used to manipulate the UserAgent header.
|
static String |
COMMENT_COPY
Comment token indicating client performs VO copy/mirror/harvest.
|
static String |
COMMENT_TEST
Comment token indicating client performs VO test/monitor/validate.
|
static String |
IVOA_PREFIX
String prefixed to purpose verb to introduce IVOA operation comment.
|
static String |
PURPOSE_COPY
Purpose verb indicating copying/mirroring/harvesting: "copy".
|
static String |
PURPOSE_TEST
Purpose verb indicating testing/monitoring/validation: "test".
|
Modifier and Type | Method and Description |
---|---|
static String |
createOpPurposeComment(String purpose,
String extra)
Assembles a string of the form
(IVOA-<purpose> <extra>) . |
static String[] |
parseProducts(String productsTxt)
Parses a products string as found in the HTTP User-Agent or Server
header.
|
static void |
popUserAgentToken(String token)
Removes a token/comment from the currently-used User-Agent string.
|
static void |
pushUserAgentToken(String token)
Appends a token/comment to the currently used User-Agent string.
|
public static final String PURPOSE_TEST
public static final String PURPOSE_COPY
public static final String IVOA_PREFIX
public static final String COMMENT_TEST
public static final String COMMENT_COPY
public static final String AGENT_PROPNAME
public static void pushUserAgentToken(String token)
token
- string to addpublic static void popUserAgentToken(String token)
token
- previously added string to removepublic static String createOpPurposeComment(String purpose, String extra)
(IVOA-<purpose> <extra>)
.purpose
- operational purpose string; recommended values are
PURPOSE_*
static members of this classextra
- free form additional text excluding "(" or ")";
may be nullIllegalArgumentException
- if rudimentary syntax checking
detects errorspublic static String[] parseProducts(String productsTxt)
productsTxt
- string giving product and comment tokens
as found in User-Agent or Server headerIllegalArgumentException
- if the syntax is not as requiredCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.