Package org.ametys.web.url
Class UrlPreviewComponent
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.web.url.UrlPreviewComponent
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
Component to parse a HTML page to get its meta for preview
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contextualize
(Context context) Convert an file.ico into a file.pnggetFavicon
(String url) Fetch and parse the HTML page at given url to get the favicon urlgetUrlPreview
(String url, String lang) Fetch and parse the HTML page at given url to get theUrlPreview
Fetch and parse the HTML page at given url for previewMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The avalon role
-
-
Constructor Details
-
UrlPreviewComponent
public UrlPreviewComponent()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
getUrlPreview
Fetch and parse the HTML page at given url to get theUrlPreview
- Parameters:
url
- the url to parselang
- the language- Returns:
- the
UrlPreview
- Throws:
HttpStatusException
- if the HTTP request resulted in a not OK HTTP response.IOException
- if an error occured while parsing HTML page
-
getFavicon
Fetch and parse the HTML page at given url to get the favicon url- Parameters:
url
- the url to parse- Returns:
- the favicon url or null if not found
- Throws:
HttpStatusException
- if the HTTP request resulted in a not OK HTTP response.IOException
- if an error occured while parsing HTML page
-
convertIcoToPng
Convert an file.ico into a file.png- Parameters:
is
- the input stream of the file.ico- Returns:
- the input stream of the file.png
- Throws:
IOException
- if failed to convert .ico
-
parseUrl
Fetch and parse the HTML page at given url for preview- Parameters:
url
- the url to parselang
- the language- Returns:
- the page information for preview
-