Add some common headers for the links check in docs

Closes #36675

Signed-off-by: rmartinc <rmartinc@redhat.com>
This commit is contained in:
rmartinc 2025-01-22 10:06:38 +01:00 committed by Alexander Schwartz
parent 3b9b678e97
commit 17d2dd58ca
2 changed files with 5 additions and 1 deletions

View File

@ -118,7 +118,7 @@ The password cannot be the same as the email address of the user.
===== Regular expression
Password must match one or more defined Java regular expression patterns.
See https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html[Java's regular expression documentation] for the syntax of those expressions.
See https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html[Java's regular expression documentation] for the syntax of those expressions.
===== Expire password

View File

@ -10,6 +10,7 @@ import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.io.HttpClientResponseHandler;
@ -77,6 +78,9 @@ public class HttpUtils {
};
try {
// add common headers that are needed by some pages
method.addHeader(HttpHeaders.ACCEPT_LANGUAGE, "en-US,en;q=0.9");
method.addHeader(HttpHeaders.ACCEPT, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
client.execute(method, responseHandler);
} catch (Exception e) {
response.setError("exception " + e.getMessage());