Subversion Repositories SmartDukaan

Rev

Rev 15027 | Rev 15031 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15027 Rev 15030
Line 35... Line 35...
35
    
35
    
36
 
36
 
37
    public String getJavaScriptToEmbedd() throws IOException, JSONException, URISyntaxException{
37
    public String getJavaScriptToEmbedd() throws IOException, JSONException, URISyntaxException{
38
        try{
38
        try{
39
            parseUrl();
39
            parseUrl();
40
            System.out.println(checkCache());
-
 
41
            if (!checkCache()){
40
            if (!checkCache()){
42
                System.out.println(productUrl);
41
                System.out.println(productUrl);
43
                Document doc = Jsoup.connect(productUrl).get();
42
                Document doc = Jsoup.connect(productUrl).get();
44
                doc.outputSettings().charset("UTF-8");
43
                doc.outputSettings().charset("UTF-8");
45
                JSONArray jsonArray = new JSONArray(doc.getElementById("productAttributesJson").attr("value"));
44
                JSONArray jsonArray = new JSONArray(doc.getElementById("productAttributesJson").attr("value"));
Line 81... Line 80...
81
    private void populateCache(String supc, String color){
80
    private void populateCache(String supc, String color){
82
        System.out.println("populating cache");
81
        System.out.println("populating cache");
83
        Object cacheValue = memcachedClient.get(KEY);
82
        Object cacheValue = memcachedClient.get(KEY);
84
        HashMap<String, String> supcMap = new HashMap<String, String>();
83
        HashMap<String, String> supcMap = new HashMap<String, String>();
85
        if (cacheValue != null) {
84
        if (cacheValue != null) {
86
            supcMap = new HashMap<String, String>();
-
 
87
            supcMap=(HashMap<String, String>)cacheValue;
85
            supcMap=(HashMap<String, String>)cacheValue;
88
            supcMap.put(supc, color);
86
            supcMap.put(supc, color);
89
        }
87
        }
90
        else{
88
        else{
91
            supcMap = new HashMap<String, String>();
-
 
92
            supcMap.put(supc, color);
89
            supcMap.put(supc, color);
93
        }
90
        }
94
        memcachedClient.set(KEY, supcMap);
91
        memcachedClient.set(KEY, supcMap);
95
    }
92
    }
96
 
93