Java Web Service Apache CXF ѧϰ
ÏîÄ¿ÖÐÓõ½web service£¬ÓÚÊÇÑо¿Á˶þÌ죬ÏÂÃæ¸ù¾ÝÕâ¶þÌìÓõ½µÄ×ܽáһϣ¬µ±È»×î¶àµÄ»¹ÊǸù¾Ýapache cxf¹ÙÍøÎĵµhttp://cxf.apache.org ¿´Îĵµ£¬µ±È»Ò²²»ÊǶ¼¿´£¬Ö»¿´ÁË×Ô¼ºÐèÒªµÄ¡£
»ù´¡ÖªÊ¶Ñ§Ï°—— Hello Demo
Hello Demo¿ªÊ¼ÁË£¡
µÚÒ»£¬Ð½¨HelloDemo Web ÏîÄ¿ µ¼Èëjar°ü¡£jar°ü´Óhttp://cxf.apache.orgÏÂÔØ¡£
µÚ¶þ£¬Ð½¨½Ó¿ÚIHello.java¼°ÆäʵÏÖÀ࣬°üΪ£ºtest.hello ´úÂëÈçÏ£º
½Ó¿Ú£ºIHello.java
package test.hello;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService(targetNamespace = "test.hello.ns")
public interface IHello {
public String sayHello(@WebParam(name = "name") String name);
}
ʵÏÖÀࣺHelloImpl.java
package test.hello;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService(endpointInterface = "test.hello.IHello", targetNamespace = "test.hello.ns")
public class HelloImpl implements IHello {
public String sayHello(@WebParam(name = "name") String name) {
return "Hello " + name;
}
}
ÔÚ´ËÀí½âÁ½¸ö×¢½â @WebService @WebParam ¿ÉÒÔ¿´API£¬@WebService˵Ã÷ÊÇÒ»¸öweb ·þÎñ£¬²ÎÊýtargetNamespace Ö¸ÃûÃüÃû¿Õ¼ä£¬×¢Òâ½Ó¿ÚÓëʵÏÖÀàÃüÃû¿Õ¼ä±ØÐëÊÇÒ»Öµģ¬Èç¹û²»ÊÇÒ»Ö»ᱨ´í¡£
µÚÈý£¬ÔÚWEB-INFÏÂн¨beans.xml ´úÂëÈçÏ£º
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint
id="hello"
implementor="test.hello.HelloImpl"
address="/hello">
</jaxws:endpoint>
<
Ïà¹ØÎĵµ£º
JAVA³ÌÐòµÄÍâ±í×ÜÊÇÒ»°åÒ»Ñ۵ģ¬¿´¶àÁËÄÑÃâÉóÃÀÆ£ÀÍ£¬Äܲ»ÄÜʹÎÒÃǵÄJAVA³ÌÐòÍâ¹Û±äµÃ¸üÃÀ¹Û¸ü¶ÀÌØÄØ£¿´ð°¸Êǿ϶¨µÄ£¬ÎÒÃÇ¿ÉÒÔÈÃJAVA³ÌÐò¸ù¾ÝͼƬÀ´Éú³É×Ô¶¨ÒåµÄ²»¹æÔò´°Ìå¡£±ÈÈçÏÂͼµÄÕâÖÖÍâ¹Û£º
ͼÖеÄÕâ¸öÈËÎï(ÀÙÃ×ÀòÑÇ)±ãÊǶ¨ÒåºÃµÄ²»¹æÔò´°Ì壬ÔõôÑù£¿ºÜƯÁÁ°É£¡ÄÇôÈÃÎÒÃÇ¿ªÊ¼Ñ§Ï°°É¡£
Ê×ÏÈÒªË ......
Finalizer ²»¿É¼Æ»®µÄ,Ò²ÊÇΣÏÕµÄ,Ò»°ãÒ²ÊDz»±ØÒªµÄ.
²»ÄÜÔÚfinalizerÖзÅÈκÎÓëÒÀÀµÊ±¼äÏà¹ØµÄ²Ù×÷,ÒòΪÄã²»ÖªµÀËüʲôʱºò±»Ö´ÐÐ. ±ÈÈçÔÚfinalizerÖйرÕÎļþµÄ×ö·¨¾ÍÊÇ´íÎóµÄ, ¸ù¾ÝJVMµÄʵÏÖ·½Ê½²»Í¬,ÓпÉÄܵ¼Ö´ò¿ªµÄÎļþÊý¹ý¶à¶øÎÞ·¨ÔÙ´ò¿ªÎļþ.
Ò²²»ÄÜÔÚfinalizerÖиıä״̬,Èç¸øÊý¾Ý¿â½âËøµÈ.
finalizer»¹ÄÜ´øÀ´Ñ ......
package PairTestMyCode.copy;
import java.util.*;
public class PairTest2
{
public static void main(String[] args)
{
GregorianCalendar[] birthdays =
{
new GregorianCalendar(1906, Calendar.DECEMBER, 9), // G. Hopper
new GregorianCalendar(1815, Cal ......
¶¨ÒåÔÚÒ»¸öÀàÄÚ²¿µÄÀà½ÐÄÚ²¿À࣬°üº¬ÄÚ²¿ÀàµÄÀà³ÆΪÍⲿÀà¡£ÄÚ²¿Àà¿ÉÒÔÉùÃ÷public¡¢protected¡¢privateµÈ·ÃÎÊÏÞÖÆ£¬¿ÉÒÔÉùÃ÷ΪabstractµÄ¹©ÆäËûÄÚ²¿Àà»òÍⲿÀà¼Ì³ÐÓëÀ©Õ¹£¬»òÕßÉùÃ÷Ϊstatic¡¢finalµÄ£¬Ò²¿ÉÒÔʵÏÖÌض¨µÄ½Ó¿Ú¡£staticµÄÄÚ²¿ÀàÐÐΪÉÏÏóÒ»¸ö¶ÀÁ¢µÄÀ࣬·ÇstaticÔÚÐÐΪÉÏÀàËÆÀàµÄÊôÐÔ»ò·½·¨ÇÒ½ûÖ¹ÉùÃ÷staticµÄ·½· ......
Ò»¡¢BorderLayoutTest.java
package com.briup.md08;
import java.awt.*;
import javax.swing.*;
/*BorderLayoutÌصã
1¡¢×é¼þµÄ´óСÓÉÈÝÆ÷¾ö¶¨
2¡¢ÈÝÆ÷±»»®·ÖΪ5¸öÇøÓò£¬Ã¿¸öÇøÓòÖ»ÄÜÖ±½Ó¼ÓÈë3¸ö×é¼þ
3¡¢×é¼þ¼ÓÈëµÄλÖÃÐèÒªÖ¸¶¨£¬Ä¬ÈÏΪCENTER
4¡¢×é¼þÖ®¼äĬÈÏûÓмä϶
5¡¢Èç¹û³ýCENTER ÒÔÍâµÄÇøÓòûÓмÓÈë×é¼þ£¬Æ ......