protected function setupRest() { if (!isset($this->app)) { $tr = new \toba_rest(); $app = $tr->instanciar_libreria_rest(); $tr->configurar_libreria_rest($app); $this->app = $app; } return $this->app; }
/** * Punto de entrada http-REST al nucleo */ function acceso_rest() { try { $this->acceso_rest = true; $this->iniciar_contexto_rest(); $toba_rest = new toba_rest(); if (!$toba_rest->es_pedido_documentacion()) { $toba_rest->conf__inicial(); $app = $toba_rest->get_instancia_rest(); if (method_exists(toba::contexto_ejecucion(), "conf__rest")) { toba::contexto_ejecucion()->conf__rest($app); } } $toba_rest->ejecutar(); $this->finalizar_contexto_rest(); } catch (Exception $e) { toba::logger()->crit($e, 'toba'); echo $e->getMessage() . "\n\n"; } toba::logger()->guardar(); }
protected function rederigir_a_swagger() { $swagger_ui = toba_recurso::url_toba() . '/swagger/index.html'; $proy = toba_rest::url_api_doc(); header('Location: ' . $swagger_ui . '?url=' . $proy); }
function post_configurar() { parent::post_configurar(); $img = toba_recurso::imagen_toba('nucleo/php.gif', true); $cliente = 'servicios/rest/ci_rutas_rest.php'; $url_api_doc = toba_rest::url_rest(); $url_cliente = toba::vinculador()->get_url('toba_editor', '30000014', array('archivo' => $cliente), array('prefijo' => toba_editor::get_punto_acceso_editor())); $url_servicio = toba::vinculador()->get_url('toba_editor', '30000014', array('archivo' => $this->path_servicio), array('prefijo' => toba_editor::get_punto_acceso_editor())); $html = "<div style='float:right'>\n\t\t<a style='font-weight:bold' href='{$url_api_doc}'>Consola y Documentacion API REST</a> del proyecto<br/>\n\t\t<a target='logger' href='{$url_cliente}'>{$img} Ver .php del Cliente</a>"; $html .= "<br><a target='logger' href='{$url_servicio}'>{$img} Ver .php del Servicio</a>"; $url_ejemplos = 'http://repositorio.siu.edu.ar/trac/toba/wiki/Referencia/Rest'; $html .= "<br>Documentación de <a target='_blank' href='{$url_ejemplos}'>servicios REST en toba</a></div>"; $html .= $this->pantalla()->get_descripcion(); $html .= "<style type='text/css'>\n\t\t\tpre { background-color: #ccc; padding: 5px; border: 1px solid gray; color: #333; }\n\t\t</style>"; $this->pantalla()->set_descripcion($html); }