RESTWiki
REST APIã使ãã表示ãæ°è¦ä½æãç·¨éãåé¤ãè¡ããwikiãä½ã£ã¦ã¿ããã¨ã¯äºãã®ããå æ¥ã®PofEAAèªæ¸ä¼ã®æã«é«æ©ã¡ã½ããã®é«æ©ããã¨Railsã§RESTå®ç¾ããã«ã¯ãã¨ãã話ããã¦ãã¦æ°ã«ãªã£ãã®ã§ããã£ã¨å®è£ ã http://rails2u.com:8008/rest/åå ã¨ããURIã«å¯¾ãã¦HTTPã®GET,POST,PUT,DELETEã¡ã½ãããéãã¨è¡¨ç¤ºãä½æãç·¨éãåé¤ããã¨ããç°¡åãªæ©è½ã®ç©ãä½ã£ããã ãã©ãããã ãããã¤ã¾ããªããã§ããã³ãã¨ã³ãã¨ãã¦xmlhttprequestã使ã£ã¦å種æä½ãè¡ããã¤ã³ã¿ã¼ãã§ã¤ã¹ãä»ãã¦Wikiã£ã½ãããã
Railsã§ã®RESTå®è£ ã¯æåãåãã«ã¯ã³ã¬ç³»ã®webservice apiãç°¡åã«æ±ããActionWebService(railsã®ä¸»è¦ã©ã¤ãã©ãªã®ä¸ã¤)ããããããªããï¼ã¨ãããã¨ã§ActionWebServiceã®ä¸èº«ãè¦ãã¦ã¿ãã¨ãRESTã®å®è£ ããã¦ãªãã¦TODOã«ã¯
Add :rest dispatching mode
ã¨ãæ¸ãã¦ããããããã¼ãï½âï½ãã¨ããããã§èªåå®è£ ãã¨ãã£ã¦ãAtomPPãªã©ã使ã£ãé«åº¦ãªç©ã§ã¯ãªããããã¹ãã§ããã¨ãããã ãã®ä»çµã¿ãªã®ã§ãã£ã¨ããéã«å®è£ å®äºãrequestã®ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ããã®method?ã§HTTPã®ã©ã®ã¡ã½ãããå¤æã§ããã®ã§ããã§å¦çæ¯ãåããã ãã ãããããã°æãPUTãDELETEã¡ã½ããã®éä¿¡ã«ã¯wfetchã£ã¦ããMS謹製ã®ã½ããã¦ã§ã¢ã使ããã§ãã¯ãhttp://rails2u.com:8008/rest/foobar ãªããã«å®éã«PUTã¨ãDELETEãéã£ã¦ã¿ãã¨ãã¡ãã¨åãã¦ããã¨ã解ãããºã
ã¤ã³ã¿ã¼ãã§ã¤ã¹é¨åã®å®è£ ã¯ãprototype.jsã®Ajaxæ©è½ã使ã£ããéãã¡ã½ãããæå®ã§ããã®ã§æ¥½ãªãã ãã©ãä¸é¨putãæèãã¦ãªãé¨åããã£ãã®ã§ãããã¸ãã¯ã¡ããã£ã¨å¼ã£ãã
å¦çã¯xmlhttprequestã®ã¹ãã¼ã¿ã¹ã³ã¼ãã«ãã£ã¦æ¯ãåããè¡ã£ã¦ããããã¨ãã°ãã¼ã¸è¡¨ç¤ºæã«æåGETã§ãã¼ã¿ãåã£ã¦ããã®ã ãã©ã404ãè¿ã£ãå ´åã¯ã¨ã©ã¼ã¡ãã»ã¼ã¸ãåºãã¦æ°è¦ä½æã®ãªã³ã¯ãå¼µã£ãããåå¨ãããã¼ã¿ã«POSTããå ´åã¯500ãè¿ãã®ã§ã¨ã©ã¼ã表示ã¨ããããããã®å ´å403ã®æ¹ãããã®ããªâ¦ãã¦ãããJavaScripté¨ã®å®è£ ã¯é常ã«æ±ãã³ã¼ããªã®ã§ãªã¬ã¤ãã¹ï½âï½ã
æå¾ã«å ¬éãããã¨lighttpdã®è¨å®è¡ã£ã¦ãããªã¬ã使ã£ã¦ã1.3.13ã ã¨501ãè¿ã£ã¦ãããã§ããã©ï¼PUTã¨DELETEã¡ã½ãããå®è£ ããã¦ç¡ããã§ããã©ï¼ã§ã1.4.3è½ã¨ãã¦ã½ã¼ã¹ã¿ããå®è£ ããã¦ãã£ã½ãã®ã§ã³ã³ãã¤ã«ãã¦åããã¦ã¿ãã¨ãã£ã±ããªã¬ã®ç°å¢ãã1.3.14以éã ã¨æ´èµ°ãããâ¦ãPUTã¡ã½ããã®æåãããããããã£ã¦ãã¨ãã¼ããããããã·ã£ãå対ã§çã¦ãã人ã«ãlighttpd + fastcgi + catalyst + AtomPPã·ãããã§PUTæ£å¸¸ã«æ¾ãã¦ãããã¨äºãããã®ã§ç°å¢ä¾åãªæ°ãâ¦ããããªãããªã§ä»æ¹ãªãwebrickãdaemon modeã§port8008ã§åããã¦ããâ¦ã
ã½ã¼ã¹ã³ã¼ã㯠http://rails2u.com/misc/restwiki_0.1.tar.gz ã«ç½®ãã¦ããã®ã§è¦ãã人ã¯ã©ãããã©ã¤ã»ã³ã¹ã¯ä¿®æ£BSDã©ã¤ã»ã³ã¹ã§ãã