All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jelastic.api.utils.UserAgent Maven / Gradle / Ivy

There is a newer version: 8.12-1
Show newest version
package com.jelastic.api.utils;

import java.net.UnknownHostException;

/**
 * @author Ruslan Sinitskiy
 */
public class UserAgent {

    public static String hostname = null;
    public static String hostadress = null;

    static {
        try {
            hostname = java.net.InetAddress.getLocalHost().getHostName();
            hostadress = java.net.InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException ex) {
            ex.printStackTrace();
        }
    }

    public static String getUserAgent(String clientVersion) {
        return new StringBuilder().append("Java Client/").append(clientVersion).append(" Hostname:[").append(hostname).append("@").append(hostadress).append("] OS:[").append(System.getProperty("os.name")).append("/").append(System.getProperty("os.version")).append("/").append(System.getProperty("os.arch")).append("] JVM:[").append(System.getProperty("java.version")).append("/").append(System.getProperty("java.vm.version")).append("/").append(System.getProperty("java.vm.name")).append("/").append(System.getProperty("java.runtime.version")).append("]" + " User:[").append(System.getProperty("user.language")).append("/").append(System.getProperty("user.country")).append("] Arch:[").append(System.getProperty("sun.arch.data.converter")).append("/").append(System.getProperty("sun.cpu.isalist")).append("]").toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy