Java Code Examples for org.springframework.web.servlet.support.ServletUriComponentsBuilder#fromCurrentServletMapping()

The following examples show how to use org.springframework.web.servlet.support.ServletUriComponentsBuilder#fromCurrentServletMapping() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MvcUriComponentsBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static UriComponentsBuilder getBaseUrlToUse(UriComponentsBuilder baseUrl) {
	if (baseUrl != null) {
		return baseUrl.cloneBuilder();
	}
	else {
		return ServletUriComponentsBuilder.fromCurrentServletMapping();
	}
}
 
Example 2
Source File: MvcUriComponentsBuilder.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private static UriComponentsBuilder getBaseUrlToUse(UriComponentsBuilder baseUrl) {
	if (baseUrl != null) {
		return (UriComponentsBuilder) baseUrl.clone();
	}
	else {
		return ServletUriComponentsBuilder.fromCurrentServletMapping();
	}
}
 
Example 3
Source File: SpringletsMvcUriComponentsBuilder.java    From springlets with Apache License 2.0 5 votes vote down vote up
private static UriComponentsBuilder getBaseUrlToUse(UriComponentsBuilder baseUrl) {
	if (baseUrl != null) {
		return baseUrl.cloneBuilder();
	}
	else {
		return ServletUriComponentsBuilder.fromCurrentServletMapping();
	}
}
 
Example 4
Source File: AbstractMetadataController.java    From initializr with Apache License 2.0 5 votes vote down vote up
/**
 * Generate a full URL of the service, mostly for use in templates.
 * @return the app URL
 * @see io.spring.initializr.metadata.InitializrConfiguration.Env#isForceSsl()
 */
protected String generateAppUrl() {
	ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentServletMapping();
	if (isForceSsl()) {
		builder.scheme("https");
	}
	return builder.build().toString();
}
 
Example 5
Source File: PasswordResetterImpl.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
private URI createPasswordResetUri(String username, String token) {
  ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentServletMapping();
  builder.encode();
  builder.path("/account/password/change");
  builder.queryParam("username", username);
  builder.queryParam("token", token);
  return builder.build().toUri();
}
 
Example 6
Source File: MvcUriComponentsBuilder.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private static UriComponentsBuilder getBaseUrlToUse(@Nullable UriComponentsBuilder baseUrl) {
	return baseUrl == null ?
			ServletUriComponentsBuilder.fromCurrentServletMapping() :
			baseUrl.cloneBuilder();
}
 
Example 7
Source File: MvcUriComponentsBuilder.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private static String getPath() {
	UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentServletMapping();
	String path = builder.build().getPath();
	return path != null ? path : "";
}
 
Example 8
Source File: MvcUriComponentsBuilder.java    From java-technology-stack with MIT License 4 votes vote down vote up
private static UriComponentsBuilder getBaseUrlToUse(@Nullable UriComponentsBuilder baseUrl) {
	return baseUrl == null ?
			ServletUriComponentsBuilder.fromCurrentServletMapping() :
			baseUrl.cloneBuilder();
}
 
Example 9
Source File: MvcUriComponentsBuilder.java    From java-technology-stack with MIT License 4 votes vote down vote up
private static String getPath() {
	UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentServletMapping();
	String path = builder.build().getPath();
	return path != null ? path : "";
}
 
Example 10
Source File: MvcUriComponentsBuilder.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private static UriComponentsBuilder initBaseUrl() {
	UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentServletMapping();
	return UriComponentsBuilder.fromPath(builder.build().getPath());
}
 
Example 11
Source File: MvcUriComponentsBuilder.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private static UriComponentsBuilder initBaseUrl() {
	UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentServletMapping();
	return UriComponentsBuilder.fromPath(builder.build().getPath());
}
 
Example 12
Source File: UriUtils.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
private static ServletUriComponentsBuilder createBuilder() {
  ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentServletMapping();
  builder.encode();
  return builder;
}