Skip to content

Instantly share code, notes, and snippets.

@jurigis
jurigis / RestProxyTemplate.java
Last active November 7, 2024 18:45 — forked from davidtimmerman/RestProxyTemplate.java
Spring RestTemplate with proxy settings and proxy authentication
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.ProxyAuthenticationStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@jurigis
jurigis / oc-bootstrap-ajax-validation-errors.js
Last active December 31, 2015 14:06
OctoberCms. Shows ajax validation errors in Backend.
(function(){
function showFieldsValidationMessages(jqXHR, $target) {
if (!$target) {
$target = $('form').first();
}
if (jqXHR.hasOwnProperty('responseJSON')) {
if (jqXHR.responseJSON['X_OCTOBER_ERROR_FIELDS']) {
$("span.error").text("");