Index: sandbox/webservice/api/adapters/ExpressoAdapter.php
===================================================================
--- sandbox/webservice/api/adapters/ExpressoAdapter.php	(revision 6149)
+++ sandbox/webservice/api/adapters/ExpressoAdapter.php	(revision 6149)
@@ -0,0 +1,125 @@
+<?php
+class ExpressoAdapter extends Resource {
+
+	private $expressoVersion;
+	private $request;
+	private $params;
+	private $result;
+	private $error;	
+	private $id;
+	
+	function __construct($id){
+		$GLOBALS['phpgw_info'] = array(
+				'flags' => array(
+						'currentapp'        	=> 'login',
+						'noheader'              => True,
+						'disable_Template_class' => True
+				)
+		);
+		
+		include_once('../../header.inc.php');
+		$this->expressoVersion = substr($GLOBALS['phpgw_info']['server']['versions']['phpgwapi'],0,3);			
+	}
+	
+	protected function setRequest($request){
+		$this->request = $request;
+	}
+	
+	public function getRequest(){
+		return $this->request;
+	}
+	
+	protected function getExpressoVersion(){
+		return $this->expressoVersion;
+	}
+	
+	protected function setResult($result){
+		$this->result = $result;
+	}
+	
+	public function getResult(){
+		return $this->result;
+	}
+	
+	protected function setId($id){
+		$this->id = $id;
+	}
+	
+	public function getId(){
+		return $this->id;
+	}
+	
+	protected function setParams($params){		
+		$this->params = $params;
+	}
+	
+	public function getParams(){	
+		return $this->params;
+	}
+	
+	public function getParam($param){
+		return $this->params->$param;
+	}
+	
+	public function setError($error) {
+		$this-> error = $error;
+	}
+	
+	protected function getError() {
+		return $this-> error;
+	}
+	
+	public function post($request){
+		$this->setRequest($request);		
+		parse_str($request->data, &$array);		
+		$data = (object)$array;		
+		if($data){
+			if($data->params){								
+				$this->setParams(json_decode($data->params));
+			}
+			if($data->id)
+				$this->setId($data->id);
+		}
+	}	
+	
+	public function get($request){
+		$response = new Response($request);
+		$response->code = Response::OK;
+		$response->addHeader('content-type', 'text/html');		
+		$response->body = "<H4>Metodo GET nao permitido para este recurso.</H4>";		
+		return $response;
+	}
+	
+	public function getResponse(){
+		$response = new Response($this->getRequest());
+		$response->code = Response::OK;
+		$response->addHeader('content-type', 'application/json');
+
+		if($this->getId())
+			$body['id']	= $this->getId();
+		if($this->getResult())
+			$body['result']	= $this->getResult();
+		else
+			throw new ResponseException("",Errors::E_UNKNOWN_ERROR);
+		
+		$response->body = json_encode($body);
+		
+		return $response;
+	}
+	
+	protected function isLoggedIn(){
+		if($this->getParam('auth') != null) {
+			list($sessionid, $kp3) = explode(":", $this->getParam('auth'));
+			if($GLOBALS['phpgw']->session->verify($sessionid, $kp3)){									
+				return $sessionid;
+			}
+			else{
+				throw new ResponseException("",Errors::LOGIN_AUTH_INVALID);
+			}
+		}
+		else{
+			throw new ResponseException("",Errors::LOGIN_NOT_LOGGED_IN);
+		}		
+	}	
+			
+}
Index: sandbox/webservice/api/adapters/CatalogAdapter.php
===================================================================
--- sandbox/webservice/api/adapters/CatalogAdapter.php	(revision 6148)
+++ sandbox/webservice/api/adapters/CatalogAdapter.php	(revision 6149)
@@ -2,5 +2,5 @@
 
 
-class CatalogAdapter extends Expresso {	
+class CatalogAdapter extends ExpressoAdapter {	
 	private $minArgumentSearch;
 	private $userId;
Index: sandbox/webservice/api/adapters/MailAdapter.php
===================================================================
--- sandbox/webservice/api/adapters/MailAdapter.php	(revision 6148)
+++ sandbox/webservice/api/adapters/MailAdapter.php	(revision 6149)
@@ -1,5 +1,5 @@
 <?php
 
-class MailAdapter extends Expresso {
+class MailAdapter extends ExpressoAdapter {
 	protected $defaultFolders;
 	protected $imap;
Index: sandbox/webservice/api/library/Errors.php
===================================================================
--- sandbox/webservice/api/library/Errors.php	(revision 6148)
+++ 	(revision )
@@ -1,96 +1,0 @@
-<?php
-
-final class Errors {
-		
-	// Errors from -32000 to -32099 => Server error	:Reserved for implementation-defined server-errors.
-	const E_PARSE_ERROR 		= "-32700";	
-	const E_INVALID_REQUEST 	= "-32600";
-	const E_METHOD_NOT_FOUND 	= "-32601";
-	const E_INVALID_PARAMS 		= "-32602";
-	const E_INTERNAL_ERROR 		= "-32603";	
-
-	const E_HTTP_NOT_FOUND		= "404";
-	const E_UNKNOWN_ERROR		= "500";
-	
-	
-	// Errors inherited from Expresso Application.	
-	const LOGIN_SUCCESS_LOGOUT 			= "1";
-	const LOGIN_SESSION_EXPIRED 		= "2";
-	const LOGIN_NOT_LOGGED_IN 			= "3";
-	const LOGIN_COOKIES_REQUIRED 		= "4";
-	const LOGIN_BADLOGIN 				= "5";
-	const LOGIN_PASSWORD_EXPIRED 		= "6";
-	const LOGIN_AUTH_INVALID 			= "7";
-	const LOGIN_SESSION_NOT_VERIFIED 	= "10";
-	const LOGIN_ACCOUNT_EXPIRED 		= "98";
-	const LOGIN_LOGIN_BLOCKED 			= "99";
-	const LOGIN_INVALID_LOGIN 			= "200";
-	
-
-	const CATALOG_MIN_ARGUMENT_SEARCH	= "1001";	
-	const MAIL_NOT_SENT					= "1002";
-	const MAIL_TRASH_NOT_CLEANED		= "1003";
-	const MAIL_MESSAGE_NOT_FOUND		= "1004";
-	
-	static private $reservedErrors = array (			
-		self::E_PARSE_ERROR 		=> "Parse error",
-		self::E_INVALID_REQUEST 	=> "Invalid Request",
-		self::E_METHOD_NOT_FOUND 	=> "Method not found",
-		self::E_INVALID_PARAMS 		=> "Invalid params",
-		self::E_INTERNAL_ERROR		=> "Internal error",
-		self::E_HTTP_NOT_FOUND		=> 'A resource matching URI "%1" was not found',
-		self::E_UNKNOWN_ERROR		=> "HTTP Unknown error"
-	);
-	
-	
-	// Errors inherited from Expresso Application.
-	static private $applicationErrors = array(			
-
-		self::LOGIN_SUCCESS_LOGOUT 			=> "You have been successfully logged out",
-		self::LOGIN_SESSION_EXPIRED 		=> "Sorry, your login has expired",
-		self::LOGIN_NOT_LOGGED_IN 			=> "You are not logged in",
-		self::LOGIN_COOKIES_REQUIRED 		=> "Cookies are required to login to this site.",
-		self::LOGIN_BADLOGIN 				=> "bad login or password",
-		self::LOGIN_PASSWORD_EXPIRED 		=> "Your password has expired, and you do not have access to change it",
-		self::LOGIN_AUTH_INVALID			=> "Your auth is invalid",
-		self::LOGIN_SESSION_NOT_VERIFIED	=> "Your session could not be verified.",
-		self::LOGIN_ACCOUNT_EXPIRED 		=> "Account is expired",
-		self::LOGIN_LOGIN_BLOCKED			=> "Blocked, too many attempts!",
-		self::LOGIN_INVALID_LOGIN			=> "Bad login or password",
-		self::CATALOG_MIN_ARGUMENT_SEARCH	=> "Your search argument must be longer than %1 characters.",
-		self::MAIL_NOT_SENT					=> "Your mail could not be sent.",
-		self::MAIL_TRASH_NOT_CLEANED		=> "Your trash folder could not be cleaned.",
-		self::MAIL_MESSAGE_NOT_FOUND		=> "Message not found in folder %1."
-	);
-		
-	static public function set($code, $message){
-		return array ("code" => $code, "message" => $message);
-	}
-
-	static public function get($code, $argument = false){
-		$errors = self::$reservedErrors + self::$applicationErrors;		
-		$message = $errors[$code];
-		if(!$message)
-			$message = $errors[self::E_UNKNOWN_ERROR];
-		if($argument)
-			$message = str_replace("%1", $argument, $message);		
-		
-		return array ("code" => $code, "message" => $message); 
-	}
-	
-	static public function getResponse($request, $responseException){			
-			$response = new Response($request);
-			$response->code = Response::OK;
-			$response->addHeader('content-type', 'application/json');
-			if($request->id)
-				$body['id']	= $request->id;
-			
-			$code	 = $responseException->getCode();
-			$error = Errors::get($code);			
-			$message = ($responseException->getMessage() ? $responseException->getMessage() : $error['message']);			
-			$body['error'] = array("code" => $code, "message" => $message);		
-			$response->body = json_encode($body);
-			return $response;
-	}
-		
-}
Index: sandbox/webservice/api/library/Expresso.php
===================================================================
--- sandbox/webservice/api/library/Expresso.php	(revision 6148)
+++ 	(revision )
@@ -1,125 +1,0 @@
-<?php
-class Expresso extends Resource {
-
-	private $expressoVersion;
-	private $request;
-	private $params;
-	private $result;
-	private $error;	
-	private $id;
-	
-	function __construct($id){
-		$GLOBALS['phpgw_info'] = array(
-				'flags' => array(
-						'currentapp'        	=> 'login',
-						'noheader'              => True,
-						'disable_Template_class' => True
-				)
-		);
-		
-		include_once('../../header.inc.php');
-		$this->expressoVersion = substr($GLOBALS['phpgw_info']['server']['versions']['phpgwapi'],0,3);			
-	}
-	
-	protected function setRequest($request){
-		$this->request = $request;
-	}
-	
-	public function getRequest(){
-		return $this->request;
-	}
-	
-	protected function getExpressoVersion(){
-		return $this->expressoVersion;
-	}
-	
-	protected function setResult($result){
-		$this->result = $result;
-	}
-	
-	public function getResult(){
-		return $this->result;
-	}
-	
-	protected function setId($id){
-		$this->id = $id;
-	}
-	
-	public function getId(){
-		return $this->id;
-	}
-	
-	protected function setParams($params){		
-		$this->params = $params;
-	}
-	
-	public function getParams(){	
-		return $this->params;
-	}
-	
-	public function getParam($param){
-		return $this->params->$param;
-	}
-	
-	public function setError($error) {
-		$this-> error = $error;
-	}
-	
-	protected function getError() {
-		return $this-> error;
-	}
-	
-	public function post($request){
-		$this->setRequest($request);		
-		parse_str($request->data, &$array);		
-		$data = (object)$array;		
-		if($data){
-			if($data->params){								
-				$this->setParams(json_decode($data->params));
-			}
-			if($data->id)
-				$this->setId($data->id);
-		}
-	}	
-	
-	public function get($request){
-		$response = new Response($request);
-		$response->code = Response::OK;
-		$response->addHeader('content-type', 'text/html');		
-		$response->body = "<H4>Metodo GET nao permitido para este recurso.</H4>";		
-		return $response;
-	}
-	
-	public function getResponse(){
-		$response = new Response($this->getRequest());
-		$response->code = Response::OK;
-		$response->addHeader('content-type', 'application/json');
-
-		if($this->getId())
-			$body['id']	= $this->getId();
-		if($this->getResult())
-			$body['result']	= $this->getResult();
-		else
-			throw new ResponseException("",Errors::E_UNKNOWN_ERROR);
-		
-		$response->body = json_encode($body);
-		
-		return $response;
-	}
-	
-	protected function isLoggedIn(){
-		if($this->getParam('auth') != null) {
-			list($sessionid, $kp3) = explode(":", $this->getParam('auth'));
-			if($GLOBALS['phpgw']->session->verify($sessionid, $kp3)){									
-				return $sessionid;
-			}
-			else{
-				throw new ResponseException("",Errors::LOGIN_AUTH_INVALID);
-			}
-		}
-		else{
-			throw new ResponseException("",Errors::LOGIN_NOT_LOGGED_IN);
-		}		
-	}	
-			
-}
Index: sandbox/webservice/api/rest/dispatch.php
===================================================================
--- sandbox/webservice/api/rest/dispatch.php	(revision 6148)
+++ sandbox/webservice/api/rest/dispatch.php	(revision 6149)
@@ -3,21 +3,21 @@
 // load libraries
 require_once __DIR__.'/../library/tonic/lib/tonic.php'; 
-require_once(__DIR__."/../library/Errors.php");
-require_once(__DIR__."/../library/Expresso.php");
+require_once(__DIR__."/../Errors.php");
 
 // load adapters
-require_once("./../adapters/MailAdapter.php");
-require_once("./../adapters/CatalogAdapter.php");
+require_once(__DIR__."/../adapters/ExpressoAdapter.php");
+require_once(__DIR__."/../adapters/MailAdapter.php");
+require_once(__DIR__."/../adapters/CatalogAdapter.php");
 
 // Load all resources
-require_once("./core/ExpressoVersionResource.php");
-require_once("./core/LoginResource.php");
-require_once("./core/LogoutResource.php");
-require_once("./mail/FoldersResource.php");
-require_once("./mail/MessagesResource.php");
-require_once("./mail/CleanTrashResource.php");
-require_once("./mail/SendSupportFeedbackResource.php");
-require_once("./catalog/ContactsResource.php");
-require_once("./catalog/ContactPictureResource.php");
+require_once(__DIR__."/core/ExpressoVersionResource.php");
+require_once(__DIR__."/core/LoginResource.php");
+require_once(__DIR__."/core/LogoutResource.php");
+require_once(__DIR__."/mail/FoldersResource.php");
+require_once(__DIR__."/mail/MessagesResource.php");
+require_once(__DIR__."/mail/CleanTrashResource.php");
+require_once(__DIR__."/mail/SendSupportFeedbackResource.php");
+require_once(__DIR__."/catalog/ContactsResource.php");
+require_once(__DIR__."/catalog/ContactPictureResource.php");
 
 //Retrieveing the mapping of the URIs and his respectives classNames and classPath
Index: sandbox/webservice/api/rest/core/LoginResource.php
===================================================================
--- sandbox/webservice/api/rest/core/LoginResource.php	(revision 6148)
+++ sandbox/webservice/api/rest/core/LoginResource.php	(revision 6149)
@@ -1,5 +1,5 @@
 <?php
 
-class LoginResource extends Expresso {
+class LoginResource extends ExpressoAdapter {
 
 	private function getUserProfile(){
Index: sandbox/webservice/api/rest/core/LogoutResource.php
===================================================================
--- sandbox/webservice/api/rest/core/LogoutResource.php	(revision 6062)
+++ sandbox/webservice/api/rest/core/LogoutResource.php	(revision 6149)
@@ -1,4 +1,4 @@
 <?php
-class LogoutResource extends Expresso {
+class LogoutResource extends ExpressoAdapter {
 
 	public function post($request){
Index: sandbox/webservice/api/rest/core/ExpressoVersionResource.php
===================================================================
--- sandbox/webservice/api/rest/core/ExpressoVersionResource.php	(revision 6148)
+++ sandbox/webservice/api/rest/core/ExpressoVersionResource.php	(revision 6149)
@@ -1,5 +1,5 @@
 <?php
 
-class ExpressoVersionResource extends Expresso {		
+class ExpressoVersionResource extends ExpressoAdapter {		
 	public function post($request){
 		// to Receive POST Params (use $this->params)
