Skip to content

Commit

Permalink
Update 'User-Agent' value to 'Mozilla/MetadigEngine (feature-hashstor…
Browse files Browse the repository at this point in the history
…e-support)'
  • Loading branch information
doulikecookiedough committed Nov 4, 2024
1 parent cf377e8 commit f7f92cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/edu/ucsb/nceas/mdqengine/MDQEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,16 @@ public ArrayList<String> findDataPids(NodeReference nodeId, String identifier) t
// The quotations wrapping the identifier are necessary for solr to parse the request
String encodedId = URLEncoder.encode(identifier, "UTF-8");
String encodedQuotes = URLEncoder.encode("\"", "UTF-8");
// String queryUrl = nodeEndpoint + "/query/solr/?q=isDocumentedBy:" + "\"" + encodedId + "\"" + "&fl=id";
String queryUrl = nodeEndpoint + "/query/solr/?q=isDocumentedBy:" + encodedQuotes + encodedId + encodedQuotes + "&fl=id";
log.debug("queryURL: " + queryUrl);

URL url = new URL(queryUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", "application/xml");
// A user-agent is necessary otherwise we will get a http 403 forbidden error
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36");
// A user-agent is necessary from either Chrome or Mozilla otherwise we will get a http
// 403 forbidden error
connection.setRequestProperty("User-Agent", "Mozilla/MetadigEngine (feature-hashstore-support)");
if (dataOneAuthToken != null) {
connection.setRequestProperty("Authorization", "Bearer " + dataOneAuthToken);
}
Expand Down

0 comments on commit f7f92cd

Please sign in to comment.