⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jobconfigure.jsp

📁 Heritrix是一个开源,可扩展的web爬虫项目。Heritrix设计成严格按照robots.txt文件的排除指示和META robots标签。
💻 JSP
📖 第 1 页 / 共 2 页
字号:
                                MBeanInfo mapInfo = map.getMBeanInfo(settings);                                MBeanAttributeInfo mp[] = mapInfo.getAttributes();                                // Printout modules in map.                                boolean alt = true;                                for(int n2=0; n2<mp.length; n2++) {                                    ModuleAttributeInfo mapAtt = (ModuleAttributeInfo)mp[n2]; //The attributes of the current attribute.                                    Object currentMapAttribute = null;                                    Object localMapAttribute = null;                                                            try {                                        currentMapAttribute = map.getAttribute(settings,mapAtt.getName());                                        localMapAttribute = map.getLocalAttribute(settings,mapAtt.getName());                                    } catch (Exception e1) {                                        p.append(e1.toString() + " " + e1.getMessage());                                    }                                    p.append("<tr " + (alt?"bgcolor='#EEEEFF'":"") + "><td>" + mapAtt.getName() + "</td><td>&nbsp;-&gt;&nbsp</td><td>" + currentMapAttribute + "</td><td>&nbsp;<a href=\"javascript:doDeleteMap('"+attAbsoluteName+"','"+mapAtt.getName()+"')\">Remove</a></td></tr>\n");                                    alt = !alt;                                }                                p.append("<tr><td><input name='"+attAbsoluteName+".key' name='"+attAbsoluteName+".key'></td><td>&nbsp;->&nbsp;</td><td><input name='"+attAbsoluteName+".value' name='"+attAbsoluteName+".value'></td><td>&nbsp;<input type='button' value='Add' onClick=\"doAddMap('"+attAbsoluteName+"')\"></td></tr>");                                p.append("</table>\n");                            } else if(legalValues != null && legalValues.length > 0) {                                //Have legal values. Build combobox.                                p.append("<select name='" + attAbsoluteName + "' style='width: 440px' onChange=\"setEdited('" + attAbsoluteName + "')\">\n");                                for(int i=0 ; i < legalValues.length ; i++){                                    p.append("<option value='"+legalValues[i]+"'");                                    if(currentAttribute.equals(legalValues[i])){                                        p.append(" selected");                                    }                                    p.append(">"+legalValues[i]+"</option>\n");                                }                                p.append("</select>\n");                            } else if (currentAttribute instanceof Boolean){                                // Boolean value                                p.append("<select name='" + attAbsoluteName + "' style='width: 440px' onChange=\"setEdited('" + attAbsoluteName + "')\">\n");                                p.append("<option value='False'"+ (currentAttribute.equals(new Boolean(false))?" selected":"") +">False</option>\n");                                p.append("<option value='True'"+ (currentAttribute.equals(new Boolean(true))?" selected":"") +">True</option>\n");                                p.append("</select>\n");                            } else if (currentAttribute instanceof TextField){                                // Text area                                p.append("<textarea name='" + attAbsoluteName + "' style='width: 440px' rows='4' onChange=\"setEdited('" + attAbsoluteName + "')\">");                                p.append(currentAttribute + "\n");                                p.append("</textarea>\n");                            } else {                                //Input box                                String patchedAttribute = currentAttribute.toString().replaceAll("&","&amp;");                                p.append("<input name='" + attAbsoluteName + "' value='" + patchedAttribute + "' style='width: 440px' onChange=\"setEdited('" + attAbsoluteName + "')\">\n");                            }                        } else {                            // Display non editable                            if(currentAttribute instanceof ListType){                                // Print list                                ListType list = (ListType)currentAttribute;                                p.append("</td><td colspan='" + (settings==null?"1":"2") + "'>");                                for(int i=0 ; i<list.size() ; i++){                                    p.append(list.get(i)+"<br>\n");                                }                            } else if(simpleMap) {                                // Simple map                                MapType map = (MapType)currentAttribute;                                p.append("</td><td '" + (settings==null?"1":"2") + "'><table border='0' cellspacing='0' cellpadding='0'>\n");                                                                MBeanInfo mapInfo = map.getMBeanInfo(settings);                                MBeanAttributeInfo mp[] = mapInfo.getAttributes();                                // Printout modules in map.                                for(int n2=0; n2<mp.length; n2++) {                                    ModuleAttributeInfo mapAtt = (ModuleAttributeInfo)mp[n2]; //The attributes of the current attribute.                                    Object currentMapAttribute = null;                                    Object localMapAttribute = null;                                                            try {                                        currentMapAttribute = map.getAttribute(settings,mapAtt.getName());                                        localMapAttribute = map.getLocalAttribute(settings,mapAtt.getName());                                    } catch (Exception e1) {                                        p.append(e1.toString() + " " + e1.getMessage());                                    }                                    p.append("<tr><td>" + mapAtt.getName() + "</td><td>&nbsp;-&gt;&nbsp</td><td>" + currentMapAttribute + "</td></tr>\n");                                }                                p.append("</table>\n");                            } else {                                p.append("</td><td colspan='" + (settings==null?"1":"2") + "'>"+currentAttribute);                                                    }                        }                        p.append("</td></tr>\n");                    }                }            }        }        return p.toString();    }        /**     * Checks if there is an error for a specific attribute for a given     * CrawlerSettings     *     * @param key The absolutename of the attribute to check for.     * @param errorHandler The errorHandler containing the errors     * @param settings the CrawlerSettings that is the 'current' context     *     */    public String checkError(String key, CrawlJobErrorHandler errorHandler,            CrawlerSettings settings){        Constraint.FailedCheck failedCheck = null;        if (errorHandler != null) {            failedCheck = (Constraint.FailedCheck)errorHandler.getError(key);        }        if (failedCheck != null) {            boolean sameSetting = false;            if(settings != null && failedCheck.getSettings() == settings) {                sameSetting = true;            } else if(settings == null) {                // If failedCheck.getSettings is the global setting then true.                if(failedCheck.getSettings().getScope() == null ||                        failedCheck.getSettings().getScope().length() == 0) {                    sameSetting = true;                }            }                        if(sameSetting){                return "<a class='help' style='color: red' href=\"javascript:doPop('" +                     TextUtils.escapeForHTMLJavascript(failedCheck.getMessage()) + "')\">*</a>";            }        }        return "";    }%><script type="text/javascript">    function doAddList(listName){        newItem = document.getElementById(listName+".add");        theList = document.getElementById(listName);                if(newItem.value.length > 0){            insertLocation = theList.length;            theList.options[insertLocation] = new Option(newItem.value, newItem.value, false, false);            newItem.value = "";        }        setEdited(listName);    }        function doDeleteList(listName){        theList = document.getElementById(listName);        theList.options[theList.selectedIndex] = null;        setEdited(listName);    }    function doAddMap(mapName){        document.frmConfig.action.value = "addMap";        document.frmConfig.update.value = mapName;        doSubmit();    }        function doDeleteMap(mapName, key){        document.frmConfig.action.value = "deleteMap";        document.frmConfig.update.value = mapName;        document.frmConfig.item.value = key;        doSubmit();    }            </script><%    // This code is shared by each of the configure.jsp pages.     // Sets up the CrawlJob, CrawlOrder, settingsHandler,     // the CrawlJobErrorHandler and sets the expert boolean.    CrawlJob theJob = handler.getJob(request.getParameter("job"));    if (theJob == null) {        // Didn't find any job with the given UID or no UID given.        response.sendRedirect(request.getContextPath() + "/jobs.jsp?message=" +            "No job selected " + request.getParameter("job"));        return;    } else if(theJob.isReadOnly()) {        // Can't edit this job.        response.sendRedirect(request.getContextPath() + "/jobs.jsp?message=" +            "Can't configure a read only job");        return;    }    CrawlJobErrorHandler errorHandler = theJob.getErrorHandler();    boolean expert = false;    if(CookieUtils.getCookieValue(request.getCookies(), "expert",             "false").equals("true")) {        expert = true;    }    // Get the settings objects.    XMLSettingsHandler settingsHandler = theJob.getSettingsHandler();    CrawlOrder crawlOrder = settingsHandler.getOrder();%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -