Spring Framework UriComponents - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework UriComponents class.

This code example shows how to use the following methods:encode, expand, toUri
	 * you can create via {@link #methodOn(Class, Object...)} or {@link DummyInvocationUtils#methodOn(Class, Object...)}. 
	 *  
	 * <pre> 
	 * @RequestMapping("/customers") 
	 * class CustomerController { 
	 *  
	 *   @RequestMapping("/{id}/addresses") 
	 *   HttpEntity&lt;Addresses&gt; showAddresses(@PathVariable Long id) { … }  
	 * } 
	 *  
	 * Link link = linkTo(methodOn(CustomerController.class).showAddresses(2L)).withRel("addresses"); 
	 * </pre> 
	 *  
	 * The resulting {@link Link} instance will point to {@code /customers/2/addresses} and have a rel of 
	 * {@code addresses}. For more details on the method invocation constraints, see 
	 * {@link DummyInvocationUtils#methodOn(Class, Object...)}. 
	 *  
	 * @param invocationValue 
	 * @return 
	 */ 
4
CodeRank
This code example shows how to use the following methods:encode
		return "<img src=\"" + url + "\"/>"; //$NON-NLS-1$ //$NON-NLS-2$
	} 
 
	private String toUrl(UriComponents components) {
		try { 
			return components.encode(Charsets.UTF_8.name()).toUriString();
		} catch (UnsupportedEncodingException e) {
			throw new RuntimeException(e);
		} 
	} 
 
	@Override 
	public String cleanupHtml(String html) {
		return null; 
	} 
} 
4
CodeRank
See Code Examples for Spring Framework UriComponents Methods: