fix inconsistent druid http paths + fix master console bugs

This commit is contained in:
Fangjin Yang 2013-03-27 10:40:44 -07:00
parent e785b87be0
commit 5bdcc3613c
4 changed files with 30 additions and 17 deletions

View File

@ -207,12 +207,11 @@ public class BrokerNode extends QueryableNode<BrokerNode>
theModules.addAll(extraModules); theModules.addAll(extraModules);
final Injector injector = Guice.createInjector(theModules); final Injector injector = Guice.createInjector(theModules);
final Context root = new Context(getServer(), "/druid/v2", Context.SESSIONS); final Context root = new Context(getServer(), "/", Context.SESSIONS);
root.addServlet(new ServletHolder(new StatusServlet()), "/status"); root.addServlet(new ServletHolder(new StatusServlet()), "/status");
root.addServlet( root.addServlet(
new ServletHolder(new QueryServlet(getJsonMapper(), getSmileMapper(), texasRanger, getEmitter(), getRequestLogger())), new ServletHolder(new QueryServlet(getJsonMapper(), getSmileMapper(), texasRanger, getEmitter(), getRequestLogger())),
"/*" "/druid/v2/*"
); );
root.addEventListener(new GuiceServletConfig(injector)); root.addEventListener(new GuiceServletConfig(injector));

View File

@ -190,13 +190,13 @@ public class RealtimeNode extends BaseServerNode<RealtimeNode>
startMonitoring(monitors); startMonitoring(monitors);
final Context v2Druid = new Context(getServer(), "/druid/v2", Context.SESSIONS); final Context root = new Context(getServer(), "/", Context.SESSIONS);
v2Druid.addServlet(new ServletHolder(new StatusServlet()), "/status"); root.addServlet(new ServletHolder(new StatusServlet()), "/status");
v2Druid.addServlet( root.addServlet(
new ServletHolder( new ServletHolder(
new QueryServlet(getJsonMapper(), getSmileMapper(), realtimeManager, emitter, getRequestLogger()) new QueryServlet(getJsonMapper(), getSmileMapper(), realtimeManager, emitter, getRequestLogger())
), ),
"/*" "/druid/v2/*"
); );
initialized = true; initialized = true;

View File

@ -54,6 +54,7 @@ import org.jets3t.service.S3ServiceException;
import org.jets3t.service.impl.rest.httpclient.RestS3Service; import org.jets3t.service.impl.rest.httpclient.RestS3Service;
import org.jets3t.service.security.AWSCredentials; import org.jets3t.service.security.AWSCredentials;
import org.mortbay.jetty.servlet.Context; import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.DefaultServlet;
import org.mortbay.jetty.servlet.ServletHolder; import org.mortbay.jetty.servlet.ServletHolder;
import org.skife.config.ConfigurationObjectFactory; import org.skife.config.ConfigurationObjectFactory;
@ -149,13 +150,12 @@ public class ComputeNode extends BaseServerNode<ComputeNode>
startMonitoring(monitors); startMonitoring(monitors);
final Context root = new Context(getServer(), "/", Context.SESSIONS); final Context root = new Context(getServer(), "/", Context.SESSIONS);
root.addServlet(new ServletHolder(new StatusServlet()), "/status"); root.addServlet(new ServletHolder(new StatusServlet()), "/status");
root.addServlet( root.addServlet(
new ServletHolder( new ServletHolder(
new QueryServlet(getJsonMapper(), getSmileMapper(), serverManager, emitter, getRequestLogger()) new QueryServlet(getJsonMapper(), getSmileMapper(), serverManager, emitter, getRequestLogger())
), ),
"/*" "/druid/v2/*"
); );
} }
@ -221,9 +221,12 @@ public class ComputeNode extends BaseServerNode<ComputeNode>
jsonMapper = new DefaultObjectMapper(); jsonMapper = new DefaultObjectMapper();
smileMapper = new DefaultObjectMapper(new SmileFactory()); smileMapper = new DefaultObjectMapper(new SmileFactory());
smileMapper.getJsonFactory().setCodec(smileMapper); smileMapper.getJsonFactory().setCodec(smileMapper);
} } else if (jsonMapper == null || smileMapper == null) {
else if (jsonMapper == null || smileMapper == null) { throw new ISE(
throw new ISE("Only jsonMapper[%s] or smileMapper[%s] was set, must set neither or both.", jsonMapper, smileMapper); "Only jsonMapper[%s] or smileMapper[%s] was set, must set neither or both.",
jsonMapper,
smileMapper
);
} }
if (lifecycle == null) { if (lifecycle == null) {

View File

@ -6,10 +6,10 @@ $(document).ready(function() {
var type = $('#select_type').attr('value') + ''; var type = $('#select_type').attr('value') + '';
var view = $('#select_view').attr('value') + ''; var view = $('#select_view').attr('value') + '';
function handleTable() function handleTable(dontDisplay)
{ {
$.get(basePath + type + '?full', function(data) { $.get(basePath + type + '?full', function(data) {
buildTable(data, $('#result_table')); buildTable(data, $('#result_table'), dontDisplay);
$('.loading').hide(); $('.loading').hide();
$('#table_wrapper').show(); $('#table_wrapper').show();
@ -75,14 +75,25 @@ $(document).ready(function() {
} }
$('#view_button').click(function() { $('#view_button').click(function() {
type = $('#select_type').attr('value') + ""; type = $('#select_type').attr('value') + '';
view = $('#select_view').attr('value') + ""; view = $('#select_view').attr('value') + '';
resetViews(); resetViews();
switch (view) { switch (view) {
case "table": case "table":
handleTable(); var dontDisplay;
switch (type) {
case "servers":
case "datasources":
dontDisplay = ["segments"];
break;
case "segments":
dontDisplay = ["shardSpec"];
break;
}
handleTable(dontDisplay);
break; break;
case "list": case "list":
handleList(type.indexOf("segments") == -1); handleList(type.indexOf("segments") == -1);