private Client getClient ( ) { if ( ! hostMap . containsKey ( basePath ) ) { ClientConfig config = new ClientConfig ( ) ; config . property ( ClientProperties . SUPPRESS_HTTP_COMPLIANCE_VALIDATION , true ) ; Client client = ClientBuilder . newClient ( config ) ; client . register ( new CsrfProtectionFilter ( "CSRF" ) ) ; hostMap . put ( basePath , client ) ; } return hostMap . get ( basePath ) ; }
Get an existing client or create a new client to handle HTTP request .