public static String abbreviate(String str, int maxWidth, String abrevMarker) { return abbreviate(str, 0, maxWidth, abrevMarker); }
return abbreviate(str, 0, maxWidth, "...");
return abrevMarker + abbreviate(str.substring(offset), maxWidth - 3);
public Object eval(String s, Map<String, Object> vars) throws ScriptException { return new JsModule(this, "<script: " + Strings.abbreviate(s, 20) + ">", s).eval(vars); }
@Override public THttpResponse send() { String url = buildRequestUrl(); try { initRequest(url); log.debug("Sending '{}' request to '{}'...", method, url); OkTHttpResponse response = new OkTHttpResponse(this, httpClient.newCall(request.build()).execute()); if(log.isDebugEnabled()) { log.debug("Response result : [status={}, content-type='{}', content-length={}]", response.getStatus(), response.getContentType(), response.getContentLength()); MimeType contentType = response.getContentType(); if(null != contentType && ContentTypes.isText(contentType.getMediaType())) { log.debug("Content -> \n{}", Strings.abbreviate(response.getContent(), 200)); } } return response; } catch (Exception e) { throw new HttpException("Error send http request : " + e.getMessage(),e); } }
@Override public THttpResponse send(){ String url = buildRequestUrl(); try { newRequest(url); log.debug("Sending '{}' request to '{}'...", method, url); ApacheTHttpResponse response = new ApacheTHttpResponse(this, request, httpClient.execute(request) ); if(log.isDebugEnabled()) { log.debug("Response result : [status={}, content-type='{}', content-length={}]", response.getStatus(), response.getContentType(), response.getContentLength()); MimeType contentType = response.getContentType(); if(null != contentType && ContentTypes.isText(contentType.toString())) { log.debug("Content -> \n{}", Strings.abbreviate(response.getContent(), 200)); } } return response; } catch (Exception e) { throw new HttpException("Error send http request : " + e.getMessage(),e); }finally{ if(null != request) { request.releaseConnection(); } } }
try { if(log.isDebugEnabled()) { log.debug("Authenticates the auth token : {}", Strings.abbreviate(token, 10) + "******");