private String getURICreateParamsIfNeeded(HttpRequest request) { String uri = request.getUri(); final MultiMap<String, String> params = request.params(); if (params != null && params.size() > 0) { CharBuf charBuf = CharBuf.create(request.getUri().length() + params.size() * 10); charBuf.add(request.getUri()).add("?"); for (Map.Entry<String, Collection<String>> entry : params) { try { String key = URLEncoder.encode(entry.getKey(), "UTF-8"); final Collection<String> values = entry.getValue(); for (String val : values) { val = URLEncoder.encode(val, "UTF-8"); charBuf.addString(key).add('=').addString(val).add('&'); } } catch (UnsupportedEncodingException e) { errorHandler.accept(e); throw new IllegalStateException(e); } } charBuf.removeLastChar(); uri = charBuf.toString(); } return uri; }
public String asJson(final Throwable ex) { final CharBuf buffer = CharBuf.create(255);
public JsonSimpleSerializerImpl(boolean encodeStrings) { this.view = null; this.encodeStrings = encodeStrings; serializeAsSupport = true; builder = CharBuf.create( 4000 ); }
public JsonSimpleSerializerImpl() { this.view = null; this.encodeStrings = true; serializeAsSupport = true; builder = CharBuf.create( 4000 ); }
public JsonSimpleSerializerImpl() { this.view = null; this.encodeStrings = true; serializeAsSupport = true; builder = CharBuf.create( 4000 ); }
public JsonSimpleSerializerImpl(boolean encodeStrings) { this.view = null; this.encodeStrings = encodeStrings; serializeAsSupport = true; builder = CharBuf.create( 4000 ); }
public JsonSimpleSerializerImpl(String view, boolean encodeStrings, boolean serializeAsSupport, boolean asciiOnly) { this.encodeStrings = encodeStrings; this.serializeAsSupport = serializeAsSupport; this.view = view; builder = CharBuf.create( 4000 ); this.asciiOnly = asciiOnly; }
public CharBuf printStackTraceIntoCharBuf( ) { CharBuf out = CharBuf.create(100); printStackTrace(out); return out; }
public static String decodeForSure( char[] chars, int start, int to ) { CharBuf builder = CharBuf.create( to - start ); builder.decodeJsonString(chars, start, to); return builder.toString(); }
/** * @param date the timestamp * @return json style format. */ public static String jsonDate(Date date) { CharBuf buf = CharBuf.create(JSON_TIME_LENGTH); jsonDateChars(date, buf); return buf.toString(); }
public static String join( String... args ) { CharBuf builder = CharBuf.create( 10 * args.length ); for ( String arg : args ) { builder.add( arg ); } return builder.toString(); }
public static String join( String... args ) { CharBuf builder = CharBuf.create( 10 * args.length ); for ( String arg : args ) { builder.add( arg ); } return builder.toString(); }
/** * Like puts but writes to a String. * * @param messages the stuff you want to print out. * @return string */ public static String sputs(Object... messages) { CharBuf buf = CharBuf.create(80); return sputs(buf, messages).toString(); }
private static String decodeForSure( char[] chars, int start, int to ) { CharBuf builder = CharBuf.create( to - start ); builder.decodeJsonString(chars, start, to); return builder.toString(); }
/** * like putl but writes to a string. * * @param messages the stuff you want to print out. * @return string */ public static String sputl(Object... messages) { CharBuf buf = CharBuf.create(100); return sputl(buf, messages).toString(); }
/** * Like puts but writes to a String. * * @param messages the stuff you want to print out. * @return string */ public static String sputs(Object... messages) { CharBuf buf = CharBuf.create(80); return sputs(buf, messages).toString(); }
public static String joinObjects( char delim, Object... args ) { CharBuf builder = CharBuf.create( 10 * args.length ); int index = 0; for ( Object arg : args ) { builder.add( arg == null ? "null" : arg.toString() ); if ( !( index == args.length - 1 ) ) { builder.add( delim ); } index++; } return builder.toString(); }
public static String joinObjects( char delim, Object... args ) { CharBuf builder = CharBuf.create( 10 * args.length ); int index = 0; for ( Object arg : args ) { builder.add( arg == null ? "null" : arg.toString() ); if ( !( index == args.length - 1 ) ) { builder.add( delim ); } index++; } return builder.toString(); }
public static String join( char delim, String... args ) { CharBuf builder = CharBuf.create( 10 * args.length ); int index = 0; for ( String arg : args ) { builder.add( arg ); if ( !( index == args.length - 1 ) ) { builder.add( delim ); } index++; } return builder.toString(); }
@Override public final void serializeDate( JsonSerializerInternal jsonSerializer, Date date, CharBuf builder ) { String string = dateCache.get ( date ); if ( string == null) { CharBuf buf = CharBuf.create ( Dates.JSON_TIME_LENGTH ); Dates.jsonDateChars ( calendar, date, buf ); string = buf.toString(); dateCache.put ( date, string ); } builder.addChars ( FastStringUtils.toCharArray( string ) ); } }