Example usage for org.springframework.web.servlet.support ServletUriComponentsBuilder fromCurrentContextPath

List of usage examples for org.springframework.web.servlet.support ServletUriComponentsBuilder fromCurrentContextPath

Introduction

In this page you can find the example usage for org.springframework.web.servlet.support ServletUriComponentsBuilder fromCurrentContextPath.

Prototype

public static ServletUriComponentsBuilder fromCurrentContextPath() 

Source Link

Document

Same as #fromContextPath(HttpServletRequest) except the request is obtained through RequestContextHolder .

Usage

From source file:org.lightadmin.core.web.support.DomainLinkBuilder.java

private static UriComponentsBuilder prepareBuilder(String baseUrl) {
    return ServletUriComponentsBuilder.fromCurrentContextPath().pathSegment(baseUrl);
}

From source file:com.nebhale.cyclinglibrary.web.json.Link.java

Link(String rel, Object... pathSegments) {
    this.rel = rel;

    String[] normalizedPathSegments = normalizePathSegments(pathSegments);
    this.href = ServletUriComponentsBuilder.fromCurrentContextPath().pathSegment(normalizedPathSegments).build()
            .toUriString();// w  w w  .j a v a2s .  c om
}

From source file:org.trustedanalytics.user.invite.AngularInvitationLinkGenerator.java

@Override
public String getLink(String code) {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(code));
    return ServletUriComponentsBuilder.fromCurrentContextPath().path("/new-account?code=" + code).build()
            .toUriString();//  w  ww  .ja  va  2s.  c om
}

From source file:org.wallride.support.PostUtils.java

public String link(Article article) {
    UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
    return path(builder, article, true);
}

From source file:org.wallride.web.support.Users.java

public String link(User user) {
    UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
    return path(builder, user, true);
}

From source file:org.wallride.support.PostUtils.java

public String link(Article article, boolean encode) {
    UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
    return path(builder, article, encode);
}

From source file:org.wallride.web.support.Users.java

public String link(User user, boolean encode) {
    UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
    return path(builder, user, encode);
}

From source file:org.wallride.support.PostUtils.java

public String link(Page page) {
    UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
    return path(builder, page, true);
}

From source file:org.wallride.support.PostUtils.java

public String link(Page page, boolean encode) {
    UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
    return path(builder, page, encode);
}

From source file:org.wallride.web.support.RssFeedView.java

@Override
protected void buildFeedMetadata(Map<String, Object> model, Channel feed, HttpServletRequest request) {
    Blog blog = blogService.getBlogById(Blog.DEFAULT_ID);
    String language = LocaleContextHolder.getLocale().getLanguage();

    feed.setTitle(blog.getTitle(language));
    feed.setDescription(blog.getTitle(language));

    UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
    feed.setLink(builder.buildAndExpand().toUriString());
}