Search in sources :

Example 76 with URIBuilder

use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.

the class CrossRef method getURLForEntry.

@Override
public URL getURLForEntry(BibEntry entry) throws URISyntaxException, MalformedURLException, FetcherException {
    URIBuilder uriBuilder = new URIBuilder(API_URL);
    entry.getLatexFreeField(FieldName.TITLE).ifPresent(title -> uriBuilder.addParameter("query.title", title));
    entry.getLatexFreeField(FieldName.AUTHOR).ifPresent(author -> uriBuilder.addParameter("query.author", author));
    entry.getLatexFreeField(FieldName.YEAR).ifPresent(year -> uriBuilder.addParameter("filter", "from-pub-date:" + year));
    // = API default
    uriBuilder.addParameter("rows", "20");
    // start at beginning
    uriBuilder.addParameter("offset", "0");
    return uriBuilder.build().toURL();
}
Also used : URIBuilder(org.apache.http.client.utils.URIBuilder)

Example 77 with URIBuilder

use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.

the class DiVA method getURLForID.

@Override
public URL getURLForID(String identifier) throws URISyntaxException, MalformedURLException, FetcherException {
    URIBuilder uriBuilder = new URIBuilder("http://www.diva-portal.org/smash/getreferences");
    uriBuilder.addParameter("referenceFormat", "BibTex");
    uriBuilder.addParameter("pids", identifier);
    return uriBuilder.build().toURL();
}
Also used : URIBuilder(org.apache.http.client.utils.URIBuilder)

Example 78 with URIBuilder

use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.

the class AstrophysicsDataSystem method getURLForQuery.

@Override
public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLException, FetcherException {
    URIBuilder uriBuilder = getBaseUrl(API_QUERY_URL);
    uriBuilder.addParameter("qsearch", query);
    return uriBuilder.build().toURL();
}
Also used : URIBuilder(org.apache.http.client.utils.URIBuilder)

Example 79 with URIBuilder

use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.

the class AstrophysicsDataSystem method getURLForID.

@Override
public URL getURLForID(String identifier) throws URISyntaxException, MalformedURLException, FetcherException {
    String key = identifier.replaceAll(patternRemoveDOI, "");
    URIBuilder uriBuilder = new URIBuilder(API_DOI_URL + key);
    uriBuilder.addParameter("data_type", "BIBTEXPLUS");
    return uriBuilder.build().toURL();
}
Also used : URIBuilder(org.apache.http.client.utils.URIBuilder)

Example 80 with URIBuilder

use of org.apache.http.client.utils.URIBuilder in project jabref by JabRef.

the class zbMATH method getURLForQuery.

/**
     * TODO: Implement EntryBasedParserFetcher
     * We use the zbMATH Citation matcher (https://www.zbmath.org/citationmatching/)
     * instead of the usual search since this tool is optimized for finding a publication based on partial information.
     */
/*
    @Override
    public URL getURLForEntry(BibEntry entry) throws URISyntaxException, MalformedURLException, FetcherException {
        // Example: https://zbmath.org/citationmatching/match?q=Ratiu
    }
    */
@Override
public URL getURLForQuery(String query) throws URISyntaxException, MalformedURLException, FetcherException {
    URIBuilder uriBuilder = new URIBuilder("https://zbmath.org/bibtexoutput/");
    // search all fields
    uriBuilder.addParameter("q", query);
    // start index
    uriBuilder.addParameter("start", "0");
    // should return up to 200 items (instead of default 100)
    uriBuilder.addParameter("count", "200");
    URLDownload.bypassSSLVerification();
    return uriBuilder.build().toURL();
}
Also used : URIBuilder(org.apache.http.client.utils.URIBuilder)

Aggregations

URIBuilder (org.apache.http.client.utils.URIBuilder)107 URISyntaxException (java.net.URISyntaxException)42 URI (java.net.URI)37 HttpGet (org.apache.http.client.methods.HttpGet)22 IOException (java.io.IOException)21 NameValuePair (org.apache.http.NameValuePair)13 HttpEntity (org.apache.http.HttpEntity)10 NotNull (org.jetbrains.annotations.NotNull)9 Map (java.util.Map)8 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)8 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 HttpResponse (org.apache.http.HttpResponse)7 List (java.util.List)6 HttpClient (org.apache.http.client.HttpClient)5 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)5 Gson (com.google.gson.Gson)4 URL (java.net.URL)4 RequestConfig (org.apache.http.client.config.RequestConfig)4 HttpPost (org.apache.http.client.methods.HttpPost)4