1
2
3
4
5
6
7 package org.utgenome.gwt.utgb.server.app;
8
9 import java.io.IOException;
10 import java.net.URL;
11 import java.util.List;
12
13 import javax.servlet.ServletException;
14 import javax.servlet.http.HttpServletRequest;
15 import javax.servlet.http.HttpServletResponse;
16
17 import org.utgenome.gwt.utgb.server.WebTrackBase;
18 import org.xerial.core.XerialException;
19 import org.xerial.lens.JSONLens;
20 import org.xerial.lens.XMLLens;
21 import org.xerial.util.log.Logger;
22
23
24
25
26
27 public class DASDsn extends WebTrackBase {
28 private static final long serialVersionUID = 1L;
29 private static Logger _logger = Logger.getLogger(DASDsn.class);
30
31 private String dasDSNURL = "http://www.ensembl.org/das/dsn";
32
33 public DASDsn() {
34 }
35
36 @Override
37 public void handle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
38
39 try {
40 DSNQuery result = XMLLens.loadXML(DSNQuery.class, new URL(dasDSNURL));
41 response.getWriter().print(JSONLens.toJSON(result.dsn));
42 }
43 catch (XerialException e) {
44 _logger.error(e);
45 }
46 }
47
48 public static class DSNQuery {
49 public List<DSN> dsn;
50 }
51
52 public static class DSN {
53 public String href;
54 public DSNSource source;
55 public String mapMaster;
56 public String description;
57 }
58
59 public static class DSNSource {
60 public String id;
61 public String value;
62 }
63
64 }