public class LinkShare
extends org.cyberneko.html.filters.DefaultFilter
In order to provide this preview, always looks for the title of the page, a summary of the main content, and an image. Looks for preview information by the following priority:
1.
<meta name="title" content="page_title" /> <meta name="description" content="page_description" /> <link rel="image_src" href="image_source" />
2. If title not found -> find in
tag. If no description -> return "" If img_src not found -> find all images in page with max, min specified width + height
3. To specify medium, use tag:
<meta name="medium" content="medium_type" />In which: medium_type can be "audio", "image", "video", "news", "blog" and "mult".
Created by The eXo Platform SEA TODO: hoatle improvement: + scans description with MIN_CHARACTER + handles exception + parser more faster with and without scanning image tag, stop right when things got.
| Modifier and Type | Method and Description |
|---|---|
void |
characters(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
filter method is called back when scanning meets the end of text in a tag
|
void |
emptyElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs)
this filter method is called back when scanning meets empty element tag
|
void |
endElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs)
filter method is called back when scanning meets end element tag
|
String |
getDescription()
gets description
|
List<String> |
getImages()
gets images list
|
static LinkShare |
getInstance(String link)
Gets LinkShare instance with specified link.
|
static LinkShare |
getInstance(String link,
String lang)
Gets LinkShare instance with link and lang specified.
|
String |
getLink()
gets provided link
|
String |
getMediaAlbum()
gets mediaAlbum if provided in:
|
String |
getMediaArtist()
gets mediaArtist if provided in:
|
String |
getMediaHeight()
gets mediaHeight if provided in:
|
org.exoplatform.commons.embedder.ExoMedia |
getMediaObject()
get mediaObject
|
String |
getMediaSrc()
gets mediaSrc
|
String |
getMediaTitle()
gets mediaTitle if provided in:
|
String |
getMediaType()
gets mediaType if provided in:
|
String |
getMediaWidth()
gets mediaWidth if provided in:
|
String |
getMediumType()
gets mediumType
|
String |
getTitle()
gets title
|
void |
setDescription(String description)
Set new value for description.
|
void |
setTitle(String title)
Set new value for title.
|
void |
startElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attrs,
org.apache.xerces.xni.Augmentations augs)
filter method is called back when scanning meets start element tag
|
comment, doctypeDecl, endCDATA, endDocument, endGeneralEntity, endPrefixMapping, getDocumentHandler, getDocumentSource, getFeatureDefault, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, ignorableWhitespace, merge, processingInstruction, reset, setDocumentHandler, setDocumentSource, setFeature, setProperty, startCDATA, startDocument, startDocument, startGeneralEntity, startPrefixMapping, textDecl, xmlDeclpublic String getLink()
public String getTitle()
public void setTitle(String title)
title - public String getDescription()
public void setDescription(String description)
description - public String getMediumType()
public String getMediaSrc()
public String getMediaType()
<meta name="audio_type" content="Content-Type header field" />or:
<meta name="video_type" content="Content-Type header field" />
public String getMediaTitle()
<meta name="audio_title" content="audio_title_name" />
public String getMediaArtist()
<meta name="audio_artist" content="audio_artist_name" />
public String getMediaAlbum()
<meta name="audio_album" content="audio_album_name" />
public String getMediaHeight()
<meta name="video_height" content="video_height_value" />
public String getMediaWidth()
<meta name="video_width" content="video_width_value" />
public org.exoplatform.commons.embedder.ExoMedia getMediaObject()
public static LinkShare getInstance(String link) throws Exception
link - Exceptionpublic static LinkShare getInstance(String link, String lang) throws Exception
link - lang - Exceptionpublic void startElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attrs,
org.apache.xerces.xni.Augmentations augs)
startElement in interface org.apache.xerces.xni.XMLDocumentHandlerstartElement in class org.cyberneko.html.filters.DefaultFilterpublic void endElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs)
endElement in interface org.apache.xerces.xni.XMLDocumentHandlerendElement in class org.cyberneko.html.filters.DefaultFilterpublic void emptyElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs)
emptyElement in interface org.apache.xerces.xni.XMLDocumentHandleremptyElement in class org.cyberneko.html.filters.DefaultFilterpublic void characters(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
characters in interface org.apache.xerces.xni.XMLDocumentHandlercharacters in class org.cyberneko.html.filters.DefaultFilterCopyright © 2003–2014 eXo Platform SAS. All rights reserved.