Created
September 15, 2011 14:53
-
-
Save krams915/1219460 to your computer and use it in GitHub Desktop.
ErrorController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.krams.tutorial.controller; | |
| import java.util.List; | |
| import org.krams.tutorial.domain.ErrorLog; | |
| import org.krams.tutorial.dto.ResponseDto; | |
| import org.krams.tutorial.repository.mongo.IErrorLogRepository; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.stereotype.Controller; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.bind.annotation.RequestMethod; | |
| import org.springframework.web.bind.annotation.ResponseBody; | |
| @Controller | |
| @RequestMapping("/error") | |
| public class ErrorController { | |
| @Autowired | |
| private IErrorLogRepository errorLogRepository; | |
| @RequestMapping | |
| public String getErrorPage() { | |
| return "error-page"; | |
| } | |
| @RequestMapping(value = "/getall", method = RequestMethod.POST) | |
| public @ResponseBody ResponseDto<ErrorLog> getall() { | |
| List<ErrorLog> errors = errorLogRepository.findAll(); | |
| if (errors != null) { | |
| return new ResponseDto<ErrorLog>(true, errors); | |
| } | |
| return new ResponseDto<ErrorLog>(false); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment