List of usage examples for org.springframework.web.util UriComponents expand
public final UriComponents expand(UriTemplateVariables uriVariables)
From source file:net.sf.sze.frontend.base.URL.java
/** * Replace all parameters in the URL with the given values. * * @param url the URL.// ww w . j ava2s. c o m * @param parameter the parameter * @return the URL with parameters filled in */ public static String filledURL(String url, Object parameter) { final UriComponents uricomponent = getUriComponent(url); return uricomponent.expand(parameter).encode().toUriString(); }
From source file:net.sf.sze.frontend.base.URL.java
/** * Replace all parameters in the URL with the given values. * * @param url the URL./*from w w w . j a v a 2 s .co m*/ * @param parameters the parameters * @return the URL with parameters filled in */ public static String filledURL(String url, Map<String, ?> parameters) { if ((parameters == null) || (parameters.size() == 0)) { return url; } final UriComponents uricomponent = getUriComponent(url); return uricomponent.expand(parameters).encode().toUriString(); }
From source file:net.sf.sze.frontend.base.URL.java
/** * Replace all parameters in the URL with the given values. * * @param url the URL.// w w w. j a va 2s .c om * @param parameters the parameters * @return the URL with parameters filled in * @deprecated please use {@link URL#filledURLWithNamedParams(String, Object...)} */ @Deprecated public static String filledURL(String url, Object... parameters) { if ((parameters == null) || (parameters.length == 0)) { return url; } final UriComponents uricomponent = getUriComponent(url); return uricomponent.expand(parameters).encode().toUriString(); }
From source file:net.sf.sze.frontend.base.URL.java
/** * Replace all parameters in the URL with the given values. * * @param url the URL./*ww w .j av a2 s . c o m*/ * @param keyValuePairs the parameters as pair of name and value. * @return the URL with parameters filled in */ public static String filledURLWithNamedParams(String url, Object... keyValuePairs) { if ((keyValuePairs == null) || (keyValuePairs.length == 0)) { return url; } if (keyValuePairs.length % 2 != 0) { throw new IllegalArgumentException( "The array has to be of an even size - size is " + keyValuePairs.length); } final Map<String, Object> values = new HashMap<String, Object>(); for (int x = 0; x < keyValuePairs.length; x += 2) { values.put((String) keyValuePairs[x], keyValuePairs[x + 1]); } final UriComponents uricomponent = getUriComponent(url); return uricomponent.expand(values).encode().toUriString(); }
From source file:com.nec.harvest.controller.PettyCashbookReportController.java
/** * Default mapping without path variables for REPORT * /*from www . j a v a 2 s. c om*/ * @param request * HttpServletRequest * @param response * HttpServletResponse * @param model * Spring model that can be used to render a view * @return A redirect URL */ @Override @RequestMapping(value = "", method = RequestMethod.GET) public String render(@SessionAttribute(Constants.SESS_ORGANIZATION_CODE) String userOrgCode, @SessionAttribute(Constants.SESS_BUSINESS_DAY) Date businessDay, @PathVariable String proGNo) { if (logger.isDebugEnabled()) { logger.debug("Redering petty cash book report..."); } // Build a link to redirect UriComponents uriComponent = UriComponentsBuilder.fromUriString(Constants.KOGUCHI_PATH).build(); URI uri = uriComponent.expand(proGNo).encode().toUri(); return "redirect:" + uri.toString(); }