1
|
package eu.dnetlib.data.statsmanager;
|
2
|
|
3
|
|
4
|
import org.springframework.stereotype.Controller;
|
5
|
import org.springframework.web.bind.annotation.RequestMapping;
|
6
|
import org.springframework.web.bind.annotation.RequestMethod;
|
7
|
|
8
|
import javax.servlet.http.HttpServletRequest;
|
9
|
import javax.servlet.http.HttpServletResponse;
|
10
|
import javax.xml.bind.JAXBContext;
|
11
|
import javax.xml.bind.JAXBException;
|
12
|
import java.io.IOException;
|
13
|
|
14
|
/**
|
15
|
* Created by antleb on 10/25/14.
|
16
|
*/
|
17
|
@Controller
|
18
|
public class StatsManagerController {
|
19
|
|
20
|
private StatsManager statsManager;
|
21
|
|
22
|
@RequestMapping(value = "/stats", method = RequestMethod.GET)
|
23
|
public void getReport(HttpServletRequest request, HttpServletResponse response) throws IOException, JAXBException {
|
24
|
ValidationReport report = statsManager.getValidationReport();
|
25
|
|
26
|
JAXBContext.newInstance().createMarshaller().marshal(report, response.getWriter());
|
27
|
}
|
28
|
|
29
|
public StatsManager getStatsManager() {
|
30
|
return statsManager;
|
31
|
}
|
32
|
|
33
|
public void setStatsManager(StatsManager statsManager) {
|
34
|
this.statsManager = statsManager;
|
35
|
}
|
36
|
}
|