REST¼Ü¹¹ÓëJavaʵÏÖ1——REST¸ÅÄî
ÓÉÓÚÓиöºÏ×÷ÏîÄ¿£¬Óõ½ÁËREST£¬ÎÒÃÇÕâ±ßµÄ·þÎñÆ÷ÊÇjavaµÄ£¬ºÏ×÷·½ÄDZßÖ÷ÒªÊÇPHP»·¾³£¬ÎªÁËÔ¶³Ìµ÷ÓõÄÎÊÌ⣬ʹÓÃÁËREST×÷ΪAPIµÄʵÏÖ·½
°¸¡£ÏÖÔÚÏîÄ¿×öµÃ²î²»¶àÁË£¬ÏÂÃæ¼ÇÏÂ×Ô¼ºµÄÒ»µãÐĵã¬ËãÊDZʼǰɡ£
REST£¨Representational State Transfer£©µÄ˵·¨À´×Ô“Architectural Styles and the Design of Network-based
Software Architectures”
£¨Roy Fielding£¬University of California -
Irvine£¬2000£©£¬ÊÇFielding´óÅ£µÄһƪ²©Ê¿ÂÛÎÄ£¬´ÓÍøÉÏËÑË÷ÏÂÓ¦¸Ã¿ÉÒÔÕÒµ½ÖÐÎÄ°æ¡£Ê×ÏÈREST¸ù±¾²»ÊǸö¼¼Êõ£¬Ö»ÊÇÒ»¸ö¼Ü¹¹·½Ê½µÄ×Ü
³Æ£¬¸úweb
serviceҲû̫´ó¹Øϵ£¬Ö»ÊÇ´ÕÇÉËü¿ÉÒÔÂú×ã×î¼òµ¥µÄÔ¶³ÌÐÅÏ¢»ñÈ¡µÄÐèÒª¡£RESTÒ²ÍêÈ«²»ÊÇж«Î÷£¬ÆäʵÔçÆÚµÄHTML¾²Ì¬ÍøÒ³¶¼ÊÇREST£¬Ö»²»
¹ýËæן÷ÖÖ¶¯Ì¬½Å±¾ÓïÑÔµÄʹÓ㬻¥ÁªÍøµÄ¼Ü¹¹Ò²Æ«ÀëÁËÔçÆÚµÄÉ趨£¬RESTµ¹ÊÇÓе㲦ÂÒ·´ÕýµÄζµÀ¡£
RESTµÄÖ÷ÒªÌØÕ÷°üÀ¨£º
1£¬ËùÓеĶ«Î÷¶¼ÊÇ×ÊÔ´£¬×ÊÔ´ÓÃURI±íʾ£¬Ã¿Ò»¸ö»á»°¶¼ÊÇÎÞ״̬µÄ¡£
Õâ¾ä»°É¶Òâ˼£¬¼ÇµÃÒÔÇ°µÄ¾²Ì¬ÍøÒ³²»£¬http://localhost/hello.jspÕâʵ¼Ê¾ÍÊÇÒ»¸ö×ÊÔ´£¬Õâ¸öURI¾ÍÊÇËûµÄµØÖ·¡£Äã¿Ï
¶¨ËµÕâô¼òµ¥»¹ÓÃѧREST£¿£¬¶Ô£¬REST¾ÍÊÇÕâô¼òµ¥£¬µ«ÊÇÇé¿öÔÙ¸´ÔÓÒ»µã£¬±ÈÈçҪд¸ö¹ºÂòÉÌÆ·µÄÒ³Ã棬ÔÛÃÇÓÃJSF»òÕßstruts£¬´Óºǫ́
SessionÈ¡¸ö¿Í»§ID£¬ÔÙ´Ó¹ºÎï³µÀïÍ·°ÑÉÌÆ·ÁбíÈ¡³öÀ´£¬ÎÒÃǸßÐ˵ÄдÁËÒ»¸öhttp://localhost/buyProduct.doÍê³ÉÁË
Õâ¸ö¹¦ÄÜ£¬ÄÇôÕâ¸öhttp://localhost/buyProduct.doµÄURI¾Í²»ÊÇRESTÁË£¬ËûÒÀÀµÓÚÔËÐÐʱ»·¾³ºÍSessionÀïµÄ±ä
Á¿£¬ÕâÑùµÄURI²»Äܱ»Öظ´Ö´ÐУ¬Ò²¾ÍÊÇ˵ֱ½ÓÕ³µ½ä¯ÀÀÆ÷ÔËÐп϶¨Òª±¨´íµÄ¡£ÊDz»ÊÇRESTÒ²ºÜÈÝÒ׿´£¬ÕâÍæÒâͨ¹ýURIÄÜ·ÃÎʲ»£¬ÄÜ·ÃÎʾÍÊÇREST¡£
2£¬¹«¿ªÄ¿Â¼½á¹¹Ê½µÄ URI
¿´ÁËÉÏÃæÄǸöÀý×Ó£¬ÄÇôÔõôдÕâ¸öURIÄØ£¬ÆäʵRESTÏ£ÍûµÄURIÊDzÉÓÃĿ¼½á¹¹Ê½µÄURI£¬ÓÃÒ»ÖÖ´ø²ã´ÎµÄ½á¹¹±íʾ¶Ô×ÊÔ´µÄ»ñÈ¡£¬±ÈÈçÎÒÒª
»ñÈ¡ÂÛ̳µÄÒ»¸ötopic£¬URIµÄ¶¨Òå¾Í¿ÉÒÔ±íʾ³Éhttp://localhost/discussion/topics/103£¬ÔÚÕâÀï
topics¾ÍÊÇÉÏÎÄÎÒÃÇ˵µ½µÄ×ÊÔ´£¬ºóÃæµÄ103ÊÇ×ÊÔ´µÄID¡£ÕâÑùµÄURI¼ò½àÃÀ¹Û£¬ËÑË÷ÒýÇæÓѺ㬿ÉÒÔ±»ä¯ÀÀÆ÷»º´æ£¬Óë»á»°×´Ì¬Î޹أ¬È»ºóÄã¿ÉÄÜÒª
ÎÊÁË£¬ÄÇÎÒÒÔǰдµÄhttp://localhost/discussion/topics?id=103ÕâÑùµÄURIÄØ£¿ÆäʵÕâÖÖÒ²¿ÉÒÔËã
REST£¬URIµÄ±íʾ·½Ê½ÊÇÓÉ¿ª·¢Õß¾ö¶¨µÄ£¬µ±È»http://localhost/discussion/topics?id=103ÕâÖÖд·¨Ëƺõ¶Ô
ËÑË÷ÒýÇæ²
Ïà¹ØÎĵµ£º
LuceneÊÇÒ»¸ö»ùÓÚJavaµÄÈ«ÎÄË÷Òý¹¤¾ß°ü¡£
»ùÓÚJavaµÄÈ«ÎÄË÷ÒýÒýÇæLucene¼ò½é£º¹ØÓÚ×÷ÕߺÍLuceneµÄÀúÊ·
È«ÎļìË÷µÄʵÏÖ£ºLueneÈ«ÎÄË÷ÒýºÍÊý¾Ý¿âË÷ÒýµÄ±È½Ï
ÖÐÎÄÇзִʻúÖƼò½é£º»ùÓÚ´Ê¿âºÍ×Ô¶¯ÇзִÊËã·¨µÄ±È½Ï
¾ßÌåµÄ°²×°ºÍʹÓüò½é£ºÏµÍ³½á¹¹½éÉܺÍÑÝʾ
Hacking Lucene£º¼ò»¯µÄ²éѯ·ÖÎöÆ÷£¬É¾³ýµÄʵÏÖ£¬¶¨ÖƵÄÅÅÐò£ ......
¹ØÓÚ Java Concurrency
×Ô´ÓJavaµ®Éú֮ʱ£¬Java ¾ÍÖ§³Ö²¢ÐеĸÅÄ±ÈÈçÏ̺߳ÍËø»úÖÆ¡£Õâ¸ö½Ì³Ì°ïÖú¿ª·¢¶àÏß³ÌJava³ÌÐòÔ±Äܹ»Àí½âºËÐĵÄJava²¢ÐÐÀíÄîÒÔ¼°ÈçºÎʹÓÃËûÃÇ¡£ ÄÚÈÝÉæ¼°µ½JavaÓïÑÔÖеÄỊ̈߳¬ ÖØÁ·¼¶ÒÔ¼°ÇáÁ¿¼¶Í¬²½»úÖÆ ÒÔ¼°JavaSE 5 ÖеÄËø£¬Ô×ÓÁ¿ ²¢ÐÐÈÝÆ÷£¬Ï̵߳÷¶È ÒÔ¼°Ïß³ÌÖ´ÐÐÕß ......
1.ÔÚÄã¾õµÃÓдíµÄµØ·½ÉèÖöϵã
2.µã»÷¼×¿Ç³æÒ»ÑùµÄ°´Å¥ÏÂÃæµÄ×Ó°´Å¥£¬Ò²ÊǼ׿dzæÒ»ÑùµÄ£¬½ÐDebug
3.ÔËÐгÌÐò£¬µ±³ÌÐòÔËÐе½¸Õ²ÅÉèÖöϵãµÄλÖþͻáÍ£ÏÂÀ´£¬²¢ÇÒÄÇÐдúÂëµ×É«»á¸ßÁÁÏÔʾ¡£
4.½Ó×ÅÄãÔÚÈçϽçÃæÄã¿ÉÒÔ¿´µ½ÄãÏëÒªµÄÐÅÏ¢
5.ÔÚVariablesÀïÃæ¿ÉÒԲ鿴ËùÓбäÁ¿µÄÖµ£¬±ÈÈç¸Õ²ÅÉèÖõĶϵãÀïÃæµÄstrClassNameµÄÖµ¾Í ......
/**
* Copyright (c) 2010 IBOBO Corporation. All Rights Reserved.
*/
package com.ibm.util.dao.hib;
/**
* [Java Generics] get T.Class from <T>
*
* @author <a ......
eclipseÑ¡Ò»¸ö±äÁ¿ºó£¬Õâ¸öÀàÀïµÄ¸Ã±äÁ¿²»±äÉ«ÎÊÌâ½â¾ö£º
alt + shift + o
/**
* дÈëÈÕÖ¾
* filePath ÈÕÖ¾ÎļþµÄ·¾¶
* code ҪдÈëÈÕÖ¾ÎļþµÄÄÚÈÝ
*/
public
static
boolean
print(String filePath,String code) {
try
{
File tofile
=
new
File(filePath);
......