Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.importer.fetcher

public Class GenericUrlBasedFetcher

extends Object
implements UrlBasedFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.UrlBasedFetcher, org.jabref.logic.importer.WebFetcher
Annotations
@NullMarked
Imports
java.io.IOException, java.time.LocalDate, java.util.List, .Optional, org.jabref.logic.importer.FetcherException, .UrlBasedFetcher, org.jabref.logic.net.URLDownload, org.jabref.logic.util.URLUtil, org.jabref.model.entry.BibEntry, .Date, org.jabref.model.entry.field.StandardField, org.jabref.model.entry.types.StandardEntryType, org.jsoup.Jsoup, org.jspecify.annotations.NullMarked, org.slf4j.Logger, .LoggerFactory

Wraps an arbitrary URL into a minimal @Misc entry.

This is the fallback for any URL that no more specific UrlBasedFetcher recognizes — it does not try to interpret the URL's shape (e.g. a DOI or Semantic Scholar link), it only records the link itself, when it was added, and (best-effort) the target page's title.

Field Summary

Modifier and TypeField and Description
private static final int
private static final Logger
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private Optional<String>
fetchTitle(String url)

Best-effort fetch of the target page's <title>.

public String
getName()

Implements org.jabref.logic.importer.WebFetcher.getName.

Returns the localized name of this fetcher.

public List<BibEntry>
performSearch(String url)

Implements org.jabref.logic.importer.UrlBasedFetcher.performSearch.

Looks for bibliographic information for the resource located at the given URL.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONNECT_TIMEOUT_MILLISback to summary
private static final int CONNECT_TIMEOUT_MILLIS
LOGGERback to summary
private static final Logger LOGGER
NAMEback to summary
public static final String NAME

Constructor Detail

GenericUrlBasedFetcherback to summary
public GenericUrlBasedFetcher()

Method Detail

fetchTitleback to summary
private Optional<String> fetchTitle(String url)

Best-effort fetch of the target page's <title>. A failure here (unreachable host, timeout, no title tag, a scheme unsupported by jsoup such as ftp://, ...) should never prevent the entry from being created, so this swallows the error and lets the caller fall back to using the URL itself as the title.

getNameback to summary
public String getName()

Implements org.jabref.logic.importer.WebFetcher.getName.

Doc from org.jabref.logic.importer.WebFetcher.getName.

Returns the localized name of this fetcher. The title can be used to display the fetcher in the menu and in the side pane.

Todo

This name is also used for identifying the fetcher in preferences for API keys. Thus, any switch of the language will "remove" API keys.

Annotations
@Override
performSearchback to summary
public List<BibEntry> performSearch(String url) throws FetcherException

Implements org.jabref.logic.importer.UrlBasedFetcher.performSearch.

Doc from org.jabref.logic.importer.UrlBasedFetcher.performSearch.

Looks for bibliographic information for the resource located at the given URL.

Implementations must validate the given string themselves (it is typically raw user input, e.g. pasted from the clipboard) and throw a FetcherException if it is not a URL they can handle. Failures while gathering optional data (such as an unreachable host) should not lead to an exception, implementations should instead return the best entry they can construct from the URL alone.

Annotations
@Override