java - Jetty redirect and context path -


I have an application running on an embedded jettie server I have defined the reference path:

  circacton handheld reference = ... context.setContextPath ("/ dev");  

I can present my app correctly

When I use the transmission reduct function of the HTTestreseter:

  Resp.sendRedirect ("/ log in"); The formation URL   

is not using contextual reference http://application.com:8080/login for the return of http: //application.com:8080/dev/login

How do I get this path?

When you call sendRedirect () one place "/ ", It is always related to server root, not in the application context. To achieve whatever you want, you must add a reference path by yourself, ex:

  response.sendRedirect (request.getContextPath () + "/ login");  

To make it work in all contexts, it is better to do better:

  response.sendRedirect (response.encodeRedirectURL (request.getContextPath) + " /log in"));  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -