Changeset 7342


Ignore:
Timestamp:
10/02/12 17:25:40 (7 years ago)
Author:
alexandrecorreia
Message:

Ticket #3093 - Integrando API Rest(CELEPAR) com o ramo Trunk.

Location:
trunk
Files:
20 added
3 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/config/Tonic.srv

    r7230 r7342  
     1[/AvailableServers] 
     2AvailableServersResource = /availableServers/AvailableServersResource.php 
     3 
     4[/Catalog/Contacts] 
     5ContactsResource = /catalog/ContactsResource.php 
     6 
     7[/Catalog/ContactPicture] 
     8ContactPictureResource = /catalog/ContactPictureResource.php 
     9 
     10[/Calendar/Events] 
     11EventsResource = /calendar/EventsResource.php 
     12 
     13[/dynamiccontacts] 
     14DynamicContactsResource = /catalog/DynamicContactsResource.php 
     15 
     16[/dynamiccontact/:id] 
     17DynamicContactResource = /catalog/DynamicContactResource.php 
     18 
     19[/ExpressoVersion] 
     20ExpressoVersionResource = /core/ExpressoVersionResource.php 
     21 
     22[/groups] 
     23GroupsResource = /catalog/GroupsResource.php 
     24 
     25[/group/:id] 
     26GroupResource = /catalog/GroupResource.php 
     27 
     28[/Login] 
     29LoginResource = /core/LoginResource.php 
     30 
     31[/Logout] 
     32LogoutResource = /core/LogoutResource.php 
     33 
     34[/Mail/AddFolder] 
     35AddFolderResource = /mail/AddFolderResource.php 
     36 
     37[/Mail/Attachment] 
     38AttachmentResource = /mail/AttachmentResource.php 
     39 
     40[/Mail/CleanTrash] 
     41CleanTrashResource = /mail/CleanTrashResource.php 
     42 
     43[/Mail/DelFolder] 
     44DelFolderResource = /mail/DelFolderResource.php 
     45 
     46[/Mail/DelMessage] 
     47DelMessageResource = /mail/DelMessageResource.php 
     48 
     49[/Mail/Folders] 
     50FoldersResource = /mail/FoldersResource.php 
     51 
     52[/Mail/RenameFolder] 
     53RenameFolderResource = /mail/RenameFolderResource.php 
     54 
     55[/Mail/Messages] 
     56MessagesResource = /mail/MessagesResource.php 
     57 
     58[/Mail/Send] 
     59SendResource = /mail/SendResource.php 
     60 
     61[/Mail/SendSupportFeedback] 
     62SendSupportFeedbackResource = /mail/SendSupportFeedbackResource.php 
     63 
     64[/personalContact] 
     65PersonalContactResource = /catalog/PersonalContactResource.php 
     66 
     67[/personalContact/:id] 
     68PersonalContactResource = /catalog/PersonalContactResource.php 
     69 
    170[/token] 
    271TokenResource = /oauth/TokenResource.php 
     72 
     73[/usercontacts] 
     74UserContactsResource = /catalog/UserContactsResource.php 
    375 
    476[/usersldap] 
     
    880UserResource = /user/UserResource.php 
    981 
    10 [/personalContact] 
    11 PersonalContactResource = /catalog/PersonalContactResource.php 
    12  
    13 [/personalContact/:id] 
    14 PersonalContactResource = /catalog/PersonalContactResource.php 
    15  
    1682[/sharedcontact/:id] 
    1783SharedContactResource = /catalog/SharedContactResource.php 
    1884 
    19 [/groups] 
    20 GroupsResource = /catalog/GroupsResource.php 
    21  
    22 [/group/:id] 
    23 GroupResource = /catalog/GroupResource.php 
    24  
    2585[/sharedgroup/:id] 
    2686SharedGroupResource = /catalog/SharedGroupResource.php 
    27  
    28 [/dynamiccontacts] 
    29 DynamicContactsResource = /catalog/DynamicContactsResource.php 
    30  
    31 [/dynamiccontact/:id] 
    32 DynamicContactResource = /catalog/DynamicContactResource.php 
    33  
    34 [/usercontacts] 
    35 UserContactsResource = /catalog/UserContactsResource.php 
  • trunk/prototype/config/user.ini

    r6599 r7342  
    5656gidNumber = gidNumber 
    5757telephoneNumber=telephoneNumber 
     58 
     59[Applications.mapping] 
     60mail = expressoMail1_2 
     61catalog = contactcenter 
     62calendar = calendar 
  • trunk/prototype/rest/dispatch.php

    r6528 r7342  
    11<?php 
    22// load Tonic library 
    3 require_once __DIR__ . '/../library/tonic/lib/tonic.php'; 
    4 require_once __DIR__ . '/../api/controller.php'; 
    5 require_once ROOTPATH . '/rest/oauth/OAuth2StorageUserCredential.php'; 
     3require_once(__DIR__ . '/../library/tonic/lib/tonic.php'); 
     4require_once(__DIR__.'/../library/utils/Errors.php'); 
     5require_once(__DIR__ . '/../api/controller.php'); 
     6require_once(ROOTPATH . '/rest/oauth/OAuth2StorageUserCredential.php'); 
     7 
     8// load adapters 
     9require_once(__DIR__."/../adapters/ExpressoAdapter.php"); 
     10require_once(__DIR__."/../adapters/MailAdapter.php"); 
     11require_once(__DIR__."/../adapters/CatalogAdapter.php"); 
     12require_once(__DIR__."/../adapters/CalendarAdapter.php"); 
    613 
    714//Retrieveing the mapping of the URIs and his respectives classNames and classPath 
     
    1825$classpath = array(); 
    1926 
    20 foreach( $config as $uri => $classFile ){ 
     27foreach( $config as $uri => $classFile ) 
     28{ 
    2129    foreach( $classFile as $className => $filePath ) 
    2230    { 
    23         $autoload[ $uri ] = $className; 
    24         $classpath[ $className ] = $filePath; 
     31                $autoload[ $uri ] = $className; 
     32                $classpath[ $className ] = $filePath; 
    2533    } 
    2634} 
     
    4957 
    5058} catch (ResponseException $e) { 
    51     switch ($e->getCode()) { 
    52     case Response::UNAUTHORIZED: 
    53         $response = $e->response($request); 
    54         $response->addHeader('WWW-Authenticate', 'Basic realm="Tonic"'); 
    55         break; 
    56     default: 
    57         $response = $e->response($request); 
     59    switch ($e->getCode()) 
     60    { 
     61            case Response::UNAUTHORIZED: 
     62                $response = $e->response($request); 
     63                $response->addHeader('WWW-Authenticate', 'Basic realm="Tonic"'); 
     64                break; 
     65             
     66                default: 
     67                        $response = new Response($request); 
     68                        $response->code = Response::OK; 
     69                        $response->addHeader('content-type', 'application/json'); 
     70                        if($request->id) 
     71                        { 
     72                                $body['id']     = $request->id; 
     73                        } 
     74                        $body['error'] = array("code" => "".$e->getCode(), "message" => $e->getMessage()); 
     75                         
     76                        $response->body = json_encode($body); 
     77                         
     78                        //$response = $e->response($request); 
    5879    } 
    5980} 
     81 
    6082$response->output(); 
    6183 
     84?> 
  • trunk/rest/setup/default_records.inc.php

    r6528 r7342  
    1515$oProc->query("INSERT INTO rest_client (client_id, client_secret) values (1, '$secret');"); 
    1616$dados = array(); 
    17 $oProc->query("select * from phpgw_config where config_app='phpgwapi'"); 
     17$oProc->query("SELECT * FROM phpgw_config WHERE config_app='phpgwapi'"); 
    1818while ($oProc->next_record()) 
    1919{ 
     
    3838$config['oauth']['client_secret'] = $secret; 
    3939 
     40$serverID = "001"; 
     41$config['ServersRest-'.$serverID]['serverID'] = $serverID; 
     42$config['ServersRest-'.$serverID]['serverName'] = $_SERVER['HTTP_HOST']; 
     43$config['ServersRest-'.$serverID]['serverDescription'] = 'Expresso - ' . $_SERVER['HTTP_HOST']; 
     44$config['ServersRest-'.$serverID]['serverUrl'] = 'http://' . $_SERVER['HTTP_HOST'] . $dados['webserver_url']; 
     45$config['ServersRest-'.$serverID]['serverContext'] = '/rest/'; 
     46$config['ServersRest-'.$serverID]['serverStatus'] = 'true'; 
     47 
    4048Config::writeIniFile($config , dirname(__FILE__) . '/../../prototype/config/REST.ini', true); 
    41      
    4249 
    4350?> 
Note: See TracChangeset for help on using the changeset viewer.