Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final String URL_PROTOCOL = "http";
    public static final String PORT = "5157";
    /**
     * For a convenience of editing URLs in the KML, always use the localhost IP to decorate URLs.
     * App will extract the localhost IP (if found) and replace it with real IP address.
     */
    public static final String IP_ADDRESS_LOCALHOST = "localhost";
    public static String IP_ADDRESS = "192.168.1.101";

    public static String localhost2RealMachine(String url) {
        return url.replaceFirst(getAssetsUrlPrefix(IP_ADDRESS_LOCALHOST), getAssetsUrlPrefix(IP_ADDRESS));
    }

    public static String getAssetsUrlPrefix(String ipAddress) {
        return URL_PROTOCOL + "://" + ipAddress + ":" + PORT + "/assets/";
    }
}