Este contenido no está disponible en el idioma seleccionado.

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.
Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2025 Red Hat