Este conteúdo não está disponível no idioma selecionado.

4.2. @PathParam and PathSegment


The specification has a very simple abstraction for examining a fragment of the URI path being invoked on javax.ws.rs.core.PathSegment:
public interface PathSegment {

    /**
     * Get the path segment.
     * <p>
     * @return the path segment
     */
    String getPath();
    /**
     * Get a map of the matrix parameters associated with the path segment
     * @return the map of matrix parameters
     */
    MultivaluedMap<String, String> getMatrixParameters();
    
}

Copy to Clipboard Toggle word wrap
RESTEasy can inject a PathSegment instead of a value with your @PathParam.
   @GET
   @Path("/book/{id}")
   public String getBook(@PathParam("id") PathSegment id) {...}

Copy to Clipboard Toggle word wrap
This is particularly useful when you have multiple @PathParams that use matrix parameters. Matrix parameters are an arbitrary set of name-value pairs embedded in a URI path segment. The PathSegment object fives you access to these parameters. See Chapter 7, @MatrixParam for further information.
An example of a matrix parameter:
  GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
Copy to Clipboard Toggle word wrap
A matrix parameter represents a resource that can be addressed by its attributes as well as its raw ID.
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat