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 

import java.net.URLEncoder;

public class Main {
    public static String spec(String host, String botid, String custid, String input) {
        //System.out.println("--> custid = "+custid);
        String spec = "";
        try {
            if (custid.equals("0")) // get custid on first transaction with Pandorabots
                spec = String.format("%s?botid=%s&input=%s", "http://" + host + "/pandora/talk-xml", botid,
                        URLEncoder.encode(input, "UTF-8"));
            else
                spec = // re-use custid on each subsequent interaction
                        String.format("%s?botid=%s&custid=%s&input=%s", "http://" + host + "/pandora/talk-xml",
                                botid, custid, URLEncoder.encode(input, "UTF-8"));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        //System.out.println(spec);
        return spec;
    }
}