public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException { if (data.isNull()) { return null; } return data.urlDecode().toCharArray(); }
public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException { if (data.isNull()) { return null; } String uriString = data.urlDecode(); try { return new URI(uriString); } catch (URISyntaxException ex) { log.warn("Failed to create URL from string '" + uriString + "'. Returning null"); return null; } }
public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException { if (data.isNull()) { return null; } String urlString = data.urlDecode(); try { return new URL(urlString); } catch (MalformedURLException ex) { log.warn("Failed to create URL from string '" + urlString + "'. Returning null"); return null; } }
/** * Parses a locale string that matches language_country_variant. */ public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException { return data.isNull() ? null : LocalUtil.parseLocaleString(data.urlDecode()); }
String value = data.urlDecode();
public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException { if (data.isNull()) { return null; } String value = data.urlDecode(); try { Method getter = paramType.getMethod("valueOf", String.class); Object reply = getter.invoke(paramType, value); if (reply == null) { throw new ConversionException(paramType); } return reply; } catch (NoSuchMethodException ex) { // We would like to have done: if (!paramType.isEnum()) // But this catch block has the same effect throw new ConversionException(paramType); } catch (Exception ex) { throw new ConversionException(paramType, ex); } }
String value = data.urlDecode();
public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException { if (data.isNull()) { return null; } if (data.getFormField().isFile()) { // Data from file uploads is not URL encoded return data.getValue(); } else { return data.urlDecode(); } }
String value = data.urlDecode();
String value = data.urlDecode();
String value = data.urlDecode();