Example usage for org.springframework.web.servlet.mvc.method.annotation MvcUriComponentsBuilder fromMappingName

List of usage examples for org.springframework.web.servlet.mvc.method.annotation MvcUriComponentsBuilder fromMappingName

Introduction

In this page you can find the example usage for org.springframework.web.servlet.mvc.method.annotation MvcUriComponentsBuilder fromMappingName.

Prototype

public static MethodArgumentBuilder fromMappingName(@Nullable UriComponentsBuilder builder, String name) 

Source Link

Document

An alternative to #fromMappingName(String) that accepts a UriComponentsBuilder representing the base URL.

Usage

From source file:de.siegmar.securetransfer.controller.SendController.java

/**
 * Displays the sent message to the sender after sending.
 *//* w  ww.  j  a  v  a 2 s. c  o m*/
@GetMapping("/{id:[a-f0-9]{64}}")
public String created(@PathVariable("id") final String id, @RequestParam("linkSecret") final String linkSecret,
        final Model model, final UriComponentsBuilder uriComponentsBuilder) {
    final SenderMessage senderMessage = messageService.getSenderMessage(id);

    final String receiveUrl = MvcUriComponentsBuilder.fromMappingName(uriComponentsBuilder, "RC#receive")
            .arg(0, senderMessage.getReceiverId()).arg(1, linkSecret).build();

    model.addAttribute("receiveUrl", receiveUrl).addAttribute("senderMessage", senderMessage)
            .addAttribute("linkSecret", linkSecret);
    return FORM_MSG_STATUS;
}