Spring @RequestMapping
Sigo viendo este tipo de paramvalue = "/redirect/{id}"
en un@RequestMapping
Anotación de la primavera. Me sigo preguntando que es{id}
¿aquí? ¿Es esto algún tipo deExpression Language
?
Código de muestra de lo que he visto:
@RequestMapping( value = "/files/{id}", method = RequestMethod.GET )
public void getFile( @PathVariable( "id" )
String fileName, HttpServletResponse response )
{
try
{
// get your file as InputStream
InputStream is = new FileInputStream("/pathToFile/"+ fileName);
// copy it to response's OutputStream
IOUtils.copy( is, response.getOutputStream() );
response.flushBuffer();
}
catch( IOException ex )
{
throw new RuntimeException( "IOError writing file to output stream" );
}
}
Mi pregunta es ¿cuál es el{id}
en el mapeo y cuál es su relación con el@PathVariable
¿Anotación y cómo usarla? Reconozco algo de información de la web, pero lo apreciaré mucho más al escuchar una explicación mucho más clara de ustedes.