*m = Command::webCommands();
if( m && m->count(cmd) ) {
Command *c = m->find(cmd)->second;
Client& client = cc();
BSONObjBuilder result;
BSONObjBuilder b;
b.append(c->name, 1);
BSONObj cmdObj = b.obj();
execCommand(c, client, 0, "admin.", cmdObj, result, false);
responseCode = 200;
string j = result.done().jsonString(JS, h != 0 ? 1 : 0);
if( h == 0 ) {
headers.push_back( "Content-Type: application/json" );
}
else {
headers.push_back( "Content-Type: text/plain" );
}
responseMsg = j;
if( h )
responseMsg += '\n';
return;
}
}
handleRESTRequest( rq , url , responseMsg , responseCode , headers );
return;
}
responseCode = 200;
stringstream ss;
string dbname;
{
stringstream z;
z << "mongod " << hostname();
dbname = z.str();
}
ss << start(dbname) << h2(dbname);
ss << "List all commands | \n";
ss << "Replica set status\n";
ss << "";
//ss << "_status";
{
const map *m = Command::webCommands();
if( m ) {
ss << a("", "These read-only context-less commands can be executed from the web interface. Results are json format, unless ?text is appended in which case the result is output as text for easier human viewing", "Commands") << ": ";
for( map::const_iterator i = m->begin(); i != m->end(); i++ ) {
stringstream h;
i->second->help(h);
string help = h.str();
ss << "first << "?text\"";
if( help != "no help defined" )
ss << " title=\"" << help << '"';
ss << ">" << i->first << " ";
}
ss << '\n';
}
}
ss << '\n';
ss << "HTTP admin port:" << _port << "\n";
doUnlockedStuff(ss);
ss << "";
ss << "write locked: " << (dbMutex.info().isLocked() ? "true" : "false") << "\n";
{
Timer t;
readlocktry lk( "" , 2000 );
if ( lk.got() ){
ss << "time to get readlock: " << t.millis() << "ms\n";
doLockedStuff(ss);
}
else {
ss << "\ntimed out getting dblock\n";
}
}
ss << "
\n