spring-framework / org.springframework.web.servlet.support / ServletUriComponentsBuilder / fromServletMapping

fromServletMapping

open static fun fromServletMapping(request: HttpServletRequest): ServletUriComponentsBuilder

Prepare a builder from the host, port, scheme, context path, and servlet mapping of the given HttpServletRequest.

If the servlet is mapped by name, e.g. "/main/*", the path will end with "/main". If the servlet is mapped otherwise, e.g. "/" or "*.do", the result will be the same as if calling #fromContextPath(HttpServletRequest).

Note: This method extracts values from "Forwarded" and "X-Forwarded-*" headers if found. See class-level docs.