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:cherry.example.web.applied.ex40.AppliedEx42ControllerImpl.java

private UriComponents redirectOnInit(String redir, long id, int rownum) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {/*from  w w w . ja va 2  s.  c o  m*/
        return fromMethodCall(
                on(AppliedEx42Controller.class).start(id, rownum, null, null, null, null, null, null))
                        .replaceQueryParam(REQ_ID, id).replaceQueryParam(REQ_ROWNUM, rownum).build();
    }
}

From source file:org.wallride.web.controller.admin.page.PageSearchController.java

@RequestMapping(params = "query")
public String search(@PathVariable String language, String query, Model model, SessionStatus sessionStatus,
        RedirectAttributes redirectAttributes) {
    sessionStatus.setComplete();/*from   w w  w  .j  a v a 2s  .c  o  m*/

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

From source file:org.wallride.web.controller.admin.article.ArticleSearchController.java

@RequestMapping(params = "query")
public String search(@PathVariable String language, String query, Model model, SessionStatus sessionStatus,
        RedirectAttributes redirectAttributes) {
    sessionStatus.setComplete();//  w  ww . j av  a  2  s  . co  m

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

From source file:cherry.example.web.basic.ex20.BasicEx20ControllerImpl.java

private UriComponents redirectOnInit(String redir) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {// w ww. j  av  a 2s . c  o  m
        return fromMethodCall(on(BasicEx20Controller.class).start(null, null, null, null, null, null)).build();
    }
}

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

private String buildAdminPath(String currentLanguage) {
    //      String contextPath = request.getContextPath();
    UriComponentsBuilder builder = UriComponentsBuilder
            .fromPath(WallRideServletConfiguration.ADMIN_SERVLET_PATH);
    builder.path("/{language}");
    return builder.buildAndExpand(currentLanguage).toUriString();
}

From source file:cherry.example.web.basic.ex30.BasicEx30ControllerImpl.java

private UriComponents redirectOnInit(String redir) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {/*from  ww  w.  j  a va 2 s. c o m*/
        return fromMethodCall(on(BasicEx30Controller.class).start(null, null, null, null, null, null)).build();
    }
}

From source file:cherry.example.web.basic.ex40.BasicEx40ControllerImpl.java

private UriComponents redirectOnInit(String redir) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {//from   w ww  .j ava 2 s .c  o  m
        return fromMethodCall(on(BasicEx40Controller.class).start(null, null, null, null, null, null)).build();
    }
}

From source file:cherry.example.web.applied.ex30.AppliedEx30ControllerImpl.java

private UriComponents redirectOnInit(String redir) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {/*  w  w w.  j a va 2  s.  c  o m*/
        return fromMethodCall(on(AppliedEx30Controller.class).start(null, null, null, null, null, null))
                .build();
    }
}

From source file:cherry.example.web.applied.ex40.AppliedEx40ControllerImpl.java

private UriComponents redirectOnInit(String redir) {
    if (StringUtils.isNotEmpty(redir)) {
        return UriComponentsBuilder.fromPath(redir).build();
    } else {/*  www . ja v a2 s . co m*/
        return fromMethodCall(on(AppliedEx40Controller.class).start(null, null, null, null, null, null))
                .build();
    }
}

From source file:cherry.sqlman.tool.load.SqlLoadControllerImpl.java

private UriComponents redirectOnInit(String redirTo, Integer ref) {
    if (StringUtils.isNotEmpty(redirTo)) {
        return UriComponentsBuilder.fromPath(redirTo).build();
    } else {//from   ww w .  ja  v  a 2s .  c  o  m
        UriComponentsBuilder ucb = fromMethodCall(
                on(SqlLoadController.class).start(null, null, null, null, null, null, null));
        if (ref == null) {
            return ucb.replaceQuery(StringUtils.EMPTY).build();
        } else {
            return ucb.replaceQueryParam(REQ_REF, ref).build();
        }
    }
}