Spring Framework UriTemplate - 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 UriTemplate class.

This code example shows how to use the following methods:expand
 
	/** 
	 * @see org.springframework.web.servlet.support.RequestContext#getContextUrl(String, Map) 
	 */ 
	public String getContextUrl(String relativeUrl, Map<String,String> params) { 
		UriTemplate template = new UriTemplate(relativeUrl); 
		return getContextPath() + template.expand(params).toASCIIString(); 
	} 
 
	/** 
	 * @see org.springframework.web.servlet.support.RequestContext#getBindStatus(String) 
	 */ 
	public BindStatus getBindStatus(String path) throws IllegalStateException { 
		return new BindStatus(new RequestContext(this.request), path, false); 
	} 
 
	/** 
	 * @see org.springframework.web.servlet.support.RequestContext#getBindStatus(String, boolean) 
	 */ 
	public BindStatus getBindStatus(String path, boolean htmlEscape) throws IllegalStateException { 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    private Account account;
     
    @Before 
    public void setup() { 
        interceptor = new AccountExposingHandlerInterceptor();
        account = new Account(1L, "Joe", "Schmoe", "joe@schmoe.com", "joe", "file://pic.jpg", new UriTemplate("http://localhost:8080/members/{profileKey}"));
        TestingAuthenticationToken authentication = new TestingAuthenticationToken(account, "password");
        SecurityContextHolder.getContext().setAuthentication(authentication);
    } 
     
    @Test
    public void preHandle() throws Exception {
    	MockHttpServletRequest request = new MockHttpServletRequest();
        interceptor.preHandle(request, null, null);            
        assertSame(account, request.getAttribute("account"));
    } 
     
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:expand
		mailMessage.setTo(request.getAccount().getEmail());
		StringTemplate textTemplate;
		mailMessage.setSubject("Reset your Greenhouse password");
		textTemplate = resetTemplateFactory.getStringTemplate();
		textTemplate.put("firstName", request.getAccount().getFirstName());		
		textTemplate.put("resetUrl", resetUriTemplate.expand(request.getToken()));
		mailMessage.setText(textTemplate.render());
		return mailMessage;
	} 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
		//Mockito.verify(twitterApi).timelineOperations().updateStatus("Join me at the Greenhouse! http://greenhouse.springsource.org/members/habuma"); 
	} 
 
	@Test 
	public void postConnect_noPostTweetAttribute() { 
		Account account = new Account(2L, "Craig", "Walls", "cwalls@vmware.com", "habuma", "http://picture.com/url", new UriTemplate("http://greenhouse.springsource.org/members/{profile}")); 
		AccountUtils.signin(account); 
		//TwitterApi twitterApi = Mockito.mock(TwitterApi.class); 
		//StubServiceProviderConnection<TwitterApi> connection = new StubServiceProviderConnection<TwitterApi>(twitterApi); 
		//interceptor.postConnect(connection, request); 
		//Mockito.verifyZeroInteractions(twitterApi); 
	} 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    	assertEquals("redirect:/settings", controller.disconnectApp("authme", testAccount()));
    	assertEquals(0, tokenStore.findTokensByUserName("kdonald").size());
    } 
	 
    private Account testAccount() {
    	return new Account(1L, "Joe", "Schmoe", "joe@schmoe.com", "joe", "file://pic.jpg", new UriTemplate("http://localhost:8080/members/{profileKey}"));
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:expand
        String[] paths = mapping.value();
        return (paths.length > 0) ? paths[0] : "";
    } 
 
    private String expandPathVariables(String url) {
        UriTemplate template = new UriTemplate(url);
        return template.expand(pathVariables).toString();
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:expand
		this.firstName = firstName;
		this.lastName = lastName;
		this.email = email;
		this.username = username;
		this.pictureUrl = pictureUrl;
		this.profileUrl = profileUrlTemplate.expand(getProfileId()).toString();
	} 
	 
	/** 
	 * The internal identifier of this account.  Unique across all accounts. 
	 * When possible, kept internal and not shared with members. 
	 */ 
	public Long getId() {
		return id;
	} 
 
	/** 
	 * The first name of the person associated with this account. 
	 */ 
	public String getFirstName() {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:expand
     * @param id      data file id 
     * @return URL string 
     */ 
    private String buildLocation(HttpServletRequest request, Object id) {
        StringBuffer url = request.getRequestURL();
        UriTemplate ut = new UriTemplate(url.append("/{id}").toString());
        return ut.expand(id).toASCIIString();
    } 
 
    /** 
     * Exception handler for RestServiceException.class. 
     * Writes exception message into HTTP response. 
     * 
     * @param ex       exception body 
     * @param response HTTP response 
     * @throws IOException error while writing into response 
     */ 
    @ExceptionHandler(RestServiceException.class) 
    public void handleException(RestServiceException ex, HttpServletResponse response) throws IOException {
        response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getMessage());
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        this.url = new UriTemplate(url).expand(urlVariables);
    } 
 
    private Target(final String url, final Object... urlVariables) {
        Args.checkNotNull(url, R.getObject("E-SPRINGMVC-REST-CLIENT#0001"));
        this.url = new UriTemplate(url).expand(urlVariables);
    } 
 
    /** 
     * URIを取得します。 
     * @return 置換済みのURI 
     */ 
    public URI getUrl() {
        return url;
    } 
 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
@RestController 
@RequestMapping("/notes") 
public class NotesController { 
 
	private static final UriTemplate TAG_URI_TEMPLATE = new UriTemplate("/tags/{id}");
 
	private final NoteRepository noteRepository;
 
	private final TagRepository tagRepository;
 
	private final NoteResourceAssembler noteResourceAssembler;
 
	private final TagResourceAssembler tagResourceAssembler;
 
	@Autowired 
	public NotesController(NoteRepository noteRepository, TagRepository tagRepository,
			NoteResourceAssembler noteResourceAssembler,
			TagResourceAssembler tagResourceAssembler) {
		this.noteRepository = noteRepository;
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Spring Framework UriTemplate Methods: