|
|
@ -6,10 +6,12 @@ import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import org.springframework.web.bind.annotation.ResponseStatus; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import com.fjordtek.bookstore.model.Book; |
|
|
@ -26,6 +28,9 @@ public class BookRestController { |
|
|
|
private CategoryRepository categoryRepository; |
|
|
|
*/ |
|
|
|
|
|
|
|
// TODO Use single variable reference for all controllers |
|
|
|
private static final String bookListPageView = "booklist"; |
|
|
|
|
|
|
|
private HttpServerLogger httpServerLogger = new HttpServerLogger(); |
|
|
|
|
|
|
|
@RequestMapping( |
|
|
@ -57,4 +62,20 @@ public class BookRestController { |
|
|
|
return bookRepository.findById(bookId); |
|
|
|
} |
|
|
|
|
|
|
|
////////////////////////////// |
|
|
|
// REDIRECTS |
|
|
|
|
|
|
|
@RequestMapping( |
|
|
|
value = { "*" } |
|
|
|
) |
|
|
|
@ResponseStatus(HttpStatus.FOUND) |
|
|
|
public void redirectToDefaultWebForm( |
|
|
|
HttpServletRequest requestData, |
|
|
|
HttpServletResponse responseData |
|
|
|
) { |
|
|
|
httpServerLogger.log(requestData, responseData); |
|
|
|
responseData.setHeader("Location", "/" + bookListPageView); |
|
|
|
responseData.setStatus(302); |
|
|
|
} |
|
|
|
|
|
|
|
} |