@@ -0,0 +1,2117 @@
+package org.openbmp.db_rest.resources;%0A%0Aimport org.codehaus.jackson.JsonFactory;%0Aimport org.codehaus.jackson.JsonGenerationException;%0Aimport org.codehaus.jackson.JsonGenerator;%0Aimport org.openbmp.db_rest.RestResponse;%0A%0Aimport javax.ws.rs.GET;%0Aimport javax.ws.rs.Path;%0Aimport javax.ws.rs.Produces;%0Aimport javax.ws.rs.QueryParam;%0Aimport javax.ws.rs.core.Response;%0Aimport java.io.IOException;%0Aimport java.io.StringWriter;%0Aimport java.net.InetAddress;%0Aimport java.net.UnknownHostException;%0A%0A@Path(%22/dns%22)%0Apublic class DNS %7B%0A%0A    @GET%0A    @Produces(%22application/json%22)%0A    public Response getDNS(@QueryParam(%22hostname%22) String hostname) %7B%0A        try %7B%0A            InetAddress%5B%5D inetAddress = InetAddress.getAllByName(hostname);%0A%0A            JsonFactory jfac = new JsonFactory();%0A            StringWriter stringWriter = new StringWriter();%0A            try %7B%0A                JsonGenerator jgen = jfac.createJsonGenerator(stringWriter);%0A                jgen.writeStartObject(); //root object%0A                jgen.writeArrayFieldStart(%22data%22);%0A                jgen.writeStartObject(); // hostname array object%0A                int i = 0;%0A                for (InetAddress host : inetAddress) %7B%0A                    jgen.writeFieldName(%22IPAddr%22 + i);%0A                    jgen.writeString(host.getHostAddress());%0A                    i++;%0A                %7D%0A                jgen.writeEndObject(); // end of array object%0A                jgen.writeEndArray();%0A                jgen.writeEndObject(); // enf of root%0A                jgen.close();%0A            %7D catch (JsonGenerationException e) %7B%0A                e.printStackTrace();%0A            %7D catch (IOException e) %7B%0A                e.printStackTrace();%0A            %7D%0A%0A            return RestResponse.okWithBody(stringWriter.toString());%0A        %7D catch (UnknownHostException e) %7B%0A            e.printStackTrace();%0A            return Response.status(400).entity(%22%22)%0A                    .header(%22Access-Control-Allow-Origin%22, %22*%22)%0A                    .header(%22Access-Control-Allow-Methods%22, %22GET%22)%0A                    .allow(%22OPTIONS%22)%0A                    .build();%0A        %7D%0A    %7D%0A%7D%0A

Add DNS lookup