Examples of MetaTag


Examples of org.htmlparser.tags.MetaTag

        + "</head>" + "<body>" + "<a href=\"http://www.yahoo.com/\">Yahoo!</a><br>"
        + "<a href=\"http://www.excite.com\">Excite</a>" + "</body>" + "</html>");
    parser.registerScanners();
    parseAndAssertNodeCount(11);
    assertType("meta tag", MetaTag.class, node[3]);
    MetaTag metaTag = (MetaTag) node[3];
    assertStringEquals("meta content", "a<b", metaTag.getMetaContent());
  }
View Full Code Here

Examples of org.htmlparser.tags.MetaTag

   * </pre>
   */
  public NodeIterator elements() throws ParserException {
    boolean remove_scanner;
    Node node;
    MetaTag meta;
    String httpEquiv;
    String charset;
    boolean restart;
    EndTag end;
    IteratorImpl ret;
View Full Code Here

Examples of org.htmlparser.tags.MetaTag

    return (ret);
  }

  public IteratorImpl createIteratorImpl(boolean remove_scanner, IteratorImpl ret) throws ParserException {
    Node node;
    MetaTag meta;
    String httpEquiv;
    String charset;
    EndTag end;
    if (null != url_conn)
      try {
        if (null == scanners.get("-m")) {
          addScanner(new MetaTagScanner("-m"));
          remove_scanner = true;
        }

        /* pre-read up to </HEAD> looking for charset directive */
        while (null != (node = ret.peek())) {
          if (node instanceof MetaTag) { // check for charset on
                          // Content-Type
            meta = (MetaTag) node;
            httpEquiv = meta.getAttribute("HTTP-EQUIV");
            if ("Content-Type".equalsIgnoreCase(httpEquiv)) {
              charset = getCharset(meta.getAttribute("CONTENT"));
              if (!charset.equalsIgnoreCase(character_set)) { // oops,
                                      // different
                                      // character
                                      // set,
                                      // restart
View Full Code Here

Examples of org.htmlparser.tags.MetaTag

        + "// if this fails, output a 'hello' " + "if (true) " + "{ " + "//something good... " + "} "
        + "</script>" + "<body>" + "</body>" + "</html>");
    parser.registerScanners();
    parseAndAssertNodeCount(10);
    assertType("fourth node", MetaTag.class, node[4]);
    MetaTag metaTag = (MetaTag) node[4];

    assertStringEquals("content", "text/html; charset=iso-8859-1", metaTag.getAttribute("CONTENT"));
  }
View Full Code Here

Examples of org.htmlparser.tags.MetaTag

    Hashtable table = tag.getAttributes();
    String metaTagName = (String) table.get("NAME");
    String metaTagContents = (String) table.get("CONTENT");
    String httpEquiv = (String) table.get("HTTP-EQUIV");

    return new MetaTag(tagData, httpEquiv, metaTagName, metaTagContents);
  }
View Full Code Here

Examples of org.richfaces.photoalbum.model.MetaTag

                    }
                }

                for (String s : toks) {
                    // Find metatag in early associated tags
                    MetaTag t = image.getTagByName(s);

                    // Find metatag in database
                    t = getTagByName(s);
                    if (t != null) {
                        // If found simple add reference to it
                        image.addMetaTag(t);
                    } else {
                        // Create new metatag
                        t = new MetaTag();
                        t.setTag(s);
                        image.addMetaTag(t);
                        // Persist to database to prevent concurrent creation of other metatags with given name
                        em.persist(t);
                    }
                }
View Full Code Here

Examples of org.richfaces.photoalbum.model.MetaTag

     *
     * @param tag - string representation of metatag
     * @return metatag object or null
     */
    public MetaTag getTagByName(String tag) {
        final MetaTag t;
        try {
            t = (MetaTag) em.createNamedQuery(Constants.TAG_BY_NAME_QUERY).setParameter(Constants.TAG_PARAMETER, tag)
                .getSingleResult();
        } catch (NoResultException nre) {
            // If not found
View Full Code Here

Examples of org.richfaces.photoalbum.model.MetaTag

    private void insertData() throws Exception {
        utx.begin();
        em.joinTransaction();
        System.out.println("Inserting records...");
        for (String tag : TAG_NAMES) {
            MetaTag m = new MetaTag();
            m.setTag(tag);
            em.persist(m);
        }
        utx.commit();
        // clear the persistence context (first-level cache)
        em.clear();
View Full Code Here

Examples of org.richfaces.photoalbum.model.MetaTag

    @Test
    public void isImageEditedWithMetaTags() throws Exception {
        Image image = helper.getAllImages(em).get(0);
        List<MetaTag> tags = image.getImageTags();
        MetaTag removedTag = tags.get(0);

        String metaTagsByImageId = "select m from MetaTag m join m.images i where i.id = :id";
        List<MetaTag> _tagsById = em.createQuery(metaTagsByImageId, MetaTag.class).setParameter("id", image.getId())
            .getResultList();

        Assert.assertTrue(_tagsById.contains(removedTag));
        Assert.assertTrue(removedTag.getImages().contains(image));

        tags.remove(0);
        Assert.assertFalse(tags.contains(removedTag));

        removedTag.removeImage(image);
        Assert.assertFalse(removedTag.getImages().contains(image));
        image.setImageTags(tags);

        ia.editImage(image, true);

        List<MetaTag> tagsById = em.createQuery(metaTagsByImageId, MetaTag.class).setParameter("id", image.getId())
            .getResultList();

        Image editedImage = helper.getAllImages(em).get(0);

        String tagById = "select m from MetaTag m where id = :id";
        MetaTag m = em.createQuery(tagById, MetaTag.class).setParameter("id", removedTag.getId()).getSingleResult();

        Assert.assertFalse(tagsById.contains(removedTag));
        Assert.assertFalse(m.getImages().contains(editedImage));
    }
View Full Code Here

Examples of org.richfaces.photoalbum.model.MetaTag

        Assert.assertEquals(2, ia.getCountIdenticalImages(image.getAlbum(), image.getPath()).intValue());
    }

    @Test
    public void isMetaTagFoundByName() throws Exception {
        MetaTag tag = helper.getAllMetaTags(em).get(0);

        Assert.assertEquals(tag, ia.getTagByName(tag.getTag()));

        Assert.assertNull(ia.getTagByName("*" + tag.getTag()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.