Example usage for org.springframework.web.util UriComponentsBuilder fromPath

List of usage examples for org.springframework.web.util UriComponentsBuilder fromPath

Introduction

In this page you can find the example usage for org.springframework.web.util UriComponentsBuilder fromPath.

Prototype

public static UriComponentsBuilder fromPath(String path) 

Source Link

Document

Create a builder that is initialized with the given path.

Usage

From source file:com.acc.facades.storefinder.populators.SearchPagePointOfServiceDistancePopulator.java

protected String getStoreUrlQueryParams(final TARGET target) {
    if (target.getLocationText() != null && !target.getLocationText().isEmpty()) {
        // Build URL to position query
        return UriComponentsBuilder.fromPath("").queryParam("lat", Double.valueOf(target.getSourceLatitude()))
                .queryParam("long", Double.valueOf(target.getSourceLongitude()))
                .queryParam("q", target.getLocationText()).build().toString();
    }/*from w  w  w . j a va2s.  com*/
    // Build URL to position query
    return UriComponentsBuilder.fromPath("").queryParam("lat", Double.valueOf(target.getSourceLatitude()))
            .queryParam("long", Double.valueOf(target.getSourceLongitude())).build().toString();
}

From source file:cherry.sqlman.admin.mailmgmt.MailmgmtControllerImpl.java

private UriComponents redirectOnInit(String redirTo) {
    if (StringUtils.isNotEmpty(redirTo)) {
        return UriComponentsBuilder.fromPath(redirTo).build();
    } else {/*from   w w w.  j av a  2s  . com*/
        return fromMethodCall(on(MailmgmtController.class).start(null, null, null, null)).build();
    }
}

From source file:cherry.example.web.basic.ex90.BasicEx90ControllerImpl.java

private UriComponents redirectOnInit(String redir) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {//w  w w .  ja  v  a 2s .com
        return fromMethodCall(on(BasicEx90Controller.class).start(null, null, null, null, null, null)).build();
    }
}

From source file:springfox.documentation.spring.web.AbstractPathProvider.java

private UriComponentsBuilder agnosticUriComponentBuilder(String url) {
    UriComponentsBuilder uriComponentsBuilder;
    if (url.startsWith("http")) {
        uriComponentsBuilder = UriComponentsBuilder.fromHttpUrl(url);
    } else {/*from w  w w .j  av a  2s . c  om*/
        uriComponentsBuilder = UriComponentsBuilder.fromPath(url);
    }
    return uriComponentsBuilder;
}

From source file:cherry.example.web.applied.ex50.AppliedEx52ControllerImpl.java

private UriComponents redirectOnInit(String redir) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {//from  w  w  w. j  av  a2  s.c  om
        return fromMethodCall(on(AppliedEx51Controller.class).update(null, null, null, null, null, null))
                .build();
    }
}

From source file:cherry.example.web.applied.ex60.AppliedEx62ControllerImpl.java

private UriComponents redirectOnInit(String redir) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {//from w w  w .  j av  a2 s.c  om
        return fromMethodCall(on(AppliedEx61Controller.class).update(null, null, null, null, null, null))
                .build();
    }
}

From source file:com.saasovation.identityaccess.resource.NotificationResource.java

private Link linkFor(String aRelationship, String anId) {

    Link link = null;//from   w  w  w .j  ava  2s . co m

    if (anId != null) {

        UriComponentsBuilder builder = UriComponentsBuilder.fromPath("/notifications/{notificationId}");

        String linkUrl = builder.buildAndExpand(anId).toUriString();

        link = new Link(linkUrl, aRelationship, null, OvationsMediaType.ID_OVATION_TYPE);
    }

    return link;
}

From source file:cherry.sqlman.tool.search.SqlSearchControllerImpl.java

private UriComponents redirectOnInit(String redirTo) {
    if (StringUtils.isNotEmpty(redirTo)) {
        return UriComponentsBuilder.fromPath(redirTo).build();
    } else {//from   w w w  .j av  a 2  s  .  co  m
        return fromMethodCall(on(SqlSearchController.class).start(null, null, null, null, null, null)).build();
    }
}

From source file:cherry.example.web.validation.ex40.ValidationEx40ControllerImpl.java

private UriComponents redirectOnInit(String redir) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {//from w w  w  . j  a v a2  s .  com
        return fromMethodCall(on(ValidationEx40Controller.class).start(null, null, null, null, null, null))
                .build();
    }
}

From source file:org.wallride.web.controller.admin.comment.CommentSearchController.java

@RequestMapping(params = "query")
public String query(@PathVariable String language, String query, Model model, SessionStatus sessionStatus,
        RedirectAttributes redirectAttributes) {
    sessionStatus.setComplete();/*from w w w  . ja v  a2 s.  co m*/

    for (Map.Entry<String, Object> mapEntry : model.asMap().entrySet()) {
        redirectAttributes.addFlashAttribute(mapEntry.getKey(), mapEntry.getValue());
    }
    String url = UriComponentsBuilder.fromPath("/_admin/{language}/comments/index").query(query)
            .buildAndExpand(language).encode().toUriString();
    return "redirect:" + url;
}