当前位置: 首页>>代码示例>>Java>>正文


Java Jerry.jerry方法代码示例

本文整理汇总了Java中jodd.jerry.Jerry.jerry方法的典型用法代码示例。如果您正苦于以下问题:Java Jerry.jerry方法的具体用法?Java Jerry.jerry怎么用?Java Jerry.jerry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jodd.jerry.Jerry的用法示例。


在下文中一共展示了Jerry.jerry方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPartnerNameFromTransparencyRegister

import jodd.jerry.Jerry; //导入方法依赖的package包/类
private String getPartnerNameFromTransparencyRegister(String string) {

		try {
			File file = new File(SystemUtil.tempDir(), "partner.html");
			NetUtil.downloadFile(
					"http://ec.europa.eu/transparencyregister/public/consultation/displaylobbyist.do?id=" + string,
					file);
			name = "";
			// create Jerry, i.e. document context
			Jerry doc = Jerry.jerry(FileUtil.readString(file));
			// parse
			doc.$("div.panel-body h4").each(new JerryFunction() {

				public boolean onNode(Jerry $this, int index) {

					name = $this.$("b").text();
					return true;
				}
			});

		} catch (IOException e) {
			e.printStackTrace();
		}
		log.info(name);
		return name;
	}
 
开发者ID:TransparencyInternationalEU,项目名称:lobbycal,代码行数:27,代码来源:MeetingService.java

示例2: parse

import jodd.jerry.Jerry; //导入方法依赖的package包/类
public static List<Book> parse(String page, final String username){
    books.clear();
    Jerry doc = Jerry.jerry(page);

  //  final List<Book> books = new ArrayList<Book>();
    doc.$(CLASSNAME).each(new JerryFunction() {
        Book book = new Book(username);

        @Override
        public boolean onNode(Jerry $this, int index) {
            if (index % 8 == 0) {
                book = new Book(username);
                books.add(book);
            }
            BookInjection.init(book, index, $this.text());
            return true;
        }
    });


    return books;
}
 
开发者ID:1994,项目名称:cdulibrary,代码行数:23,代码来源:Analysis.java

示例3: getTitle

import jodd.jerry.Jerry; //导入方法依赖的package包/类
/**
 * getTitle receives a url parameter and return a Response object that hoold the page title
 * @param url The HTML page url
 * @return Response
 */
static Response getTitle(String url) {
    HttpBrowser browser = new HttpBrowser();
    HttpRequest request = HttpRequest.get(url);
    browser.sendRequest(request);

    String page = browser.getPage();
    Jerry doc = Jerry.jerry(page);

    return new Response(doc.$("title").text());
}
 
开发者ID:dimiro1,项目名称:gettitle,代码行数:16,代码来源:GetTitleService.java

示例4: verifyLogin

import jodd.jerry.Jerry; //导入方法依赖的package包/类
/**
 * Verifies login for the user after calling connect
 * @return Returns true if the login was correct
 * @throws LoginFailedException Is thrown if the login was incorrect
 */
public boolean verifyLogin() throws LoginFailedException, IOException {
    // Check index page
    String response = _browser.get(Constants.INDEX_URL);
    // Check to see if we find a course list
    if (response != null) {
        Jerry i = Jerry.jerry(response);
        Node node = i.$(Constants.COURSE_LIST).get(0);
        if (node != null) {
            return true;
        }
    }
    throw new LoginFailedException();
}
 
开发者ID:pielambr,项目名称:Minerva4J,代码行数:19,代码来源:MinervaClient.java

示例5: getDocuments

import jodd.jerry.Jerry; //导入方法依赖的package包/类
/**
 * Returns a list of documents for the given course
 * @param client An instance of the MinervaClient client
 * @param course The course of which the documents need to be retrieved
 * @return A list of documents
 */
public static List<Document> getDocuments(MinervaClient client, Course course) throws IOException {
   String response = client.getClient().get(Constants.COURSE_URL + course.getCode() + Constants.DOCUMENT);
    Jerry page;
    try {
        page = Jerry.jerry(new String(response.getBytes(), "UTF8"));
    } catch (UnsupportedEncodingException ex){
        page = Jerry.jerry(response);
    }
    client.checkLogin(client);
    return parseDocuments(page);
}
 
开发者ID:pielambr,项目名称:Minerva4J,代码行数:18,代码来源:DocumentParser.java

示例6: getAnnouncements

import jodd.jerry.Jerry; //导入方法依赖的package包/类
/**
 * Parses the course page for the given course and returns the announcements
 * @param course The course for which the announcements need to be retrieved
 * @param client The MinervaClient instance
 * @return Returns a list of announcements for this course
 */
public static List<Announcement> getAnnouncements(MinervaClient client, Course course) throws IOException {
    String response = client.getClient().get(Constants.COURSE_URL + course.getCode() + Constants.ANNOUNCEMENT);
    Jerry coursePage;
    try {
        coursePage = Jerry.jerry(new String(response.getBytes(), "UTF-8"));
    } catch (UnsupportedEncodingException e) {
        coursePage = Jerry.jerry(response);
    }
    client.checkLogin(client);
    return parseAnnouncements(coursePage);
}
 
开发者ID:pielambr,项目名称:Minerva4J,代码行数:18,代码来源:AnnouncementParser.java

示例7: configProxoolAlias

import jodd.jerry.Jerry; //导入方法依赖的package包/类
public static void configProxoolAlias(String jdbcUsername, String jdbcPassword, String jdbcUrl,
		String jdbcDriverClassname, int fixedConnectioinSize) {
	try {
		StringBuffer htmlText = new StringBuffer();

		if (ProxoolConfigTemplate != null && !ProxoolConfigTemplate.isEmpty()) {
			htmlText.append(ProxoolConfigTemplate);
		} else {
			try (InputStream resource = ClassLoader.getSystemResourceAsStream(ProxoolFilename)) {
				byte[] resourceConfigDatas = StreamUtil.readBytes(resource);
				htmlText.append(new String(resourceConfigDatas, java.nio.charset.StandardCharsets.UTF_8));
			}
		}

		Jerry doc = Jerry.jerry(htmlText.toString());

		for (Jerry node : doc.$("proxool")) {
			if (node.$("alias").text().equals(ProxoolAliasname)) {

				node.$("driver-url").text(jdbcUrl);
				node.$("driver-class").text(jdbcDriverClassname);

				Jerry driverProperties = node.$("driver-properties property");
				for (Jerry prop : driverProperties) {
					if (prop.attr("name").equals("user"))
						prop.attr("value", jdbcUsername);
					else if (prop.attr("name").equals("password"))
						prop.attr("value", jdbcPassword);
				}

				if (fixedConnectioinSize != 0) {
					node.$("maximum-connection-count").text(String.valueOf(fixedConnectioinSize));
					node.$("minimum-connection-count").text(String.valueOf(fixedConnectioinSize));
				}
				break;
			}
		}
		
		String configXml = doc.html();
		configXml = Toolset.deleteCRLFOnce(configXml);
		
		Toolset.prettyOutput(log,
				"ProxoolHelper Config {nl}{}",
				configXml);
		try (StringReader stringReader = new StringReader(configXml)) {
			JAXPConfigurator.configure(stringReader, false);
		}

	} catch (Throwable e) {
		log.info("[ProxoolHelper] initialize proxoool exceptioin !!!.", e);
	}
}
 
开发者ID:316181444,项目名称:GameServerFramework,代码行数:53,代码来源:ProxoolHelper.java

示例8: parts

import jodd.jerry.Jerry; //导入方法依赖的package包/类
public static Jerry parts(final String url, final String expression) {
  String _html = TungParser.html(url);
  Jerry _jerry = Jerry.jerry(_html);
  return _jerry.$(expression);
}
 
开发者ID:East196,项目名称:maker,代码行数:6,代码来源:TungParser.java

示例9: part

import jodd.jerry.Jerry; //导入方法依赖的package包/类
public static String part(final String html, final String expression) {
  Jerry _jerry = Jerry.jerry(html);
  Jerry _$ = _jerry.$(expression);
  return _$.html();
}
 
开发者ID:East196,项目名称:maker,代码行数:6,代码来源:TungParser.java

示例10: part2

import jodd.jerry.Jerry; //导入方法依赖的package包/类
public static String part2(final String html, final String expression) {
  Jerry _jerry = Jerry.jerry(html);
  Jerry _$ = _jerry.$(expression);
  return _$.text();
}
 
开发者ID:East196,项目名称:maker,代码行数:6,代码来源:TungParser.java


注:本文中的jodd.jerry.Jerry.jerry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。