flexÇëÇóÖÐץȡJAVAÒì³£ÐÅÏ¢
ÈçºÎ»ñÈ¡LCDSÇëÇó¹ý³ÌÖÐJAVAÅ׳öÀ´µÄExceptionÄØ£¿ µ±flexͨ¹ýÇëÇó¶ÔÏóÇëÇó·þÎñ¶ËµÄʱºò£¬ÇëÇó³É¹¦»á·¢mx.rpc.events.ResultEventʼþ£¬Óöµ½·þÎñ¶ËÒì³£»òÆäËû·Ç200µÄHTTP״̬Â루ÀýÈç404£¬403£©Ôò»á·¢mx.rpc.events.FaultEventʼþ£¬µ«ÇëÇóʧ°ÜÊÇÒòΪʲôÔÒòÄØ£¿ÒòΪ²»Í¬µÄÔÒò¿ÉÄܵ¼Ö½çÃæÉϲ»Í¬µÄ´¦Àí²Ù×÷£¬×î¼òµ¥µÄ°ì·¨¾ÍÊÇ´Ó·þÎñ¶ËµÄÒì³£ÖлñÈ¡£¬ÎÒÃÇ¿ÉÒÔ°ÑÕâЩÐÅÏ¢·ÅÔÚÒì³£ÖУ¬ÓÉÇ°¶ËFLEXÈ¥¶ÁÈ¡²¢´¦Àí£»
FaultEventʼþÖÐÓÐÒ»¸ömessageÊôÐÔ£¬ÊÇÒ»¸öÀàÐÍΪmx.messaging.messages.ErrorMessageµÄÏûÏ¢À࣬¸ÃÀàÖÐÓÐÒ»¸örootCauseÊôÐÔ£¬Òì³£µÄÏà¹ØÐÅÏ¢¶¼·ÅÔÚÕâ¸ö¶ÔÏóÖУ¬ÏȽ¨Ò»¸ö×Ô¶¨ÒåµÄJAVAÒì³££º
package com.hanover.ml.servicebroker;
public class CustomException extends Exception {
private int errorCode;
private String errorDesc;
public int getErrorCode(){
return errorCode;
}
public void setErrorCode(int value){
errorCode = value;
}
public String getErrorDesc(){
return errorDesc;
}
public void setErrorDesc(String value){
errorDesc = value;
}
}
ÀïÃæÓÐÁ½¸öÊôÐÔ£¬·Ö±ðÊÇerrorCodeºÍerrorDesc£¬·Ö±ð¿ÉÒÔ´ú±íÒì³£µÄÖÖÀàºÍÃèÊö£¬È»ºóÎÒÃÇÔÚµ÷Ó÷½·¨ÖÐץȡµ½ËùÓÐÒì³£²¢×ª³ÉÕâ¸ö×Ô¶¨ÒåµÄCustomException£º
public void getExceptionTest() throws CustomException
{
try{
//function content
//Âß¼Òì³£
CustomException ce = new CustomException();
ce.setErrorCode(201);
ce.setErrorDesc("¸Ã¼Ç¼Òѱ»É¾³ý");
throw ce;
}catch(NullPointerException ne){
CustomException ce = new CustomException();
ce.setErrorCode(101);
ce.setErrorDesc("type1 error desc");
throw ce;
}catch(Exception e){
CustomException ce = new CustomException();
ce.setErrorCode(101);
ce.setErrorDesc(e.getMessage());
throw ce;
}
}
½Ó×ÅÔÚflex¶ËµÄfaultʼþÖлñÈ¡Òì³£ÐÅÏ¢£º
public function fault(event:Object):void
{
var faultEvent:FaultEvent = event as FaultEvent;
var errorMessage:ErrorMessage = faultEvent.message as ErrorMessage;
if(errorMessage && errorMessage.rootCause)
{
Ïà¹ØÎĵµ£º
500´íÎó,classnotfoundÒì³££¬´úÂëûÓÐÎÊÌ⣬Êý¾Ý¿âҲûÎÊÌ⣬´òÁ˲¹¶¡£¬×°ÁËÇý¶¯£¬µ«ÊÇÔÚTOMCATÉÏÕÒ²»µ½ÄǸöÇý¶¯¶øÒý·¢µÄ´íÎ󡣡£¡£
½â¾ö°ì·¨£ºÊ×Ñ¡ÏîÉèÖÃÀMyRclipse->J2EE Project->Web Project->Deployment¹´ÉÏÄÇÈý¸öÇý¶¯¡£ ......
ÔÚJavaÓïÑÔÖУ¬equals()ºÍhashCode()Á½¸öº¯ÊýµÄʹÓÃÊǽôÃÜÅäºÏµÄ£¬ÄãÒªÊÇ×Ô¼ºÉè¼ÆÆäÖÐÒ»¸ö£¬¾ÍÒªÉè¼ÆÁíÍâÒ»¸ö¡£ÔÚ¶àÊýÇé¿ö
Ï£¬ÕâÁ½¸öº¯ÊýÊDz»Óÿ¼Âǵģ¬Ö±½ÓʹÓÃËüÃǵÄĬÈÏÉè¼Æ¾Í¿ÉÒÔÁË¡£µ«ÊÇÔÚһЩÇé¿öÏ£¬ÕâÁ½¸öº¯Êý×îºÃÊÇ×Ô¼ºÉè¼Æ£¬²ÅÄÜÈ·±£Õû¸ö³ÌÐòµÄÕý³£ÔËÐС£×î³£¼ûµÄÊǵ±
Ò»¸ö¶ÔÏó±»¼ÓÈëÊÕ¼¯¶ÔÏó£¨collection
ob ......
¶¨ÒåÔÚÒ»¸öÀàÄÚ²¿µÄÀà½ÐÄÚ²¿À࣬°üº¬ÄÚ²¿ÀàµÄÀà³ÆΪÍⲿÀà¡£ÄÚ²¿Àà¿ÉÒÔÉùÃ÷public¡¢protected¡¢privateµÈ·ÃÎÊÏÞÖÆ£¬¿ÉÒÔÉùÃ÷ΪabstractµÄ¹©ÆäËûÄÚ²¿Àà»òÍⲿÀà¼Ì³ÐÓëÀ©Õ¹£¬»òÕßÉùÃ÷Ϊstatic¡¢finalµÄ£¬Ò²¿ÉÒÔʵÏÖÌض¨µÄ½Ó¿Ú¡£staticµÄÄÚ²¿ÀàÐÐΪÉÏÏóÒ»¸ö¶ÀÁ¢µÄÀ࣬·ÇstaticÔÚÐÐΪÉÏÀàËÆÀàµÄÊôÐÔ»ò·½·¨ÇÒ½ûÖ¹ÉùÃ÷staticµÄ·½· ......
Ò»¡¢Àà×°ÔØÆ÷£ºÍ¨¹ý·Ö±ðʹÓò»Í¬µÄÀà×°ÔØÆ÷×°ÔØ¿É¿¿µÄ°üºÍ²»¿É¿¿µÄ°üÀ´ÊµÏÖ°² È«ÐÔ¡£
ÔÚ1.2°æ±¾µÄJavaÐéÄâ»ú¿ªÊ¼ÔËÐÐʱ£¬ÔÚÓ¦ÓóÌÐòÆô¶¯ÒÔÇ°£¬ËüÖÁÉÙ´´½¨Ò»¸öÓû§×Ô¶¨ÒåÀà×°ÔØÆ÷£¬Ò²¿ÉÄÜÊǶà¸ö¡£ËùÓÐÕâЩÀà×°ÔØÆ÷±»Á¬½ÓÔÚÒ»¸öË«Ç×--º¢×ӵĹØϵÁ´ÖУ¬ÔÚÕâÌõÁ´µÄ¶¥¶ËÊÇÆô¶¯Àà×°ÔØÆ÷£¬Ä©¶ËÊÇÒ»¸ö±»³ÆΪ“ϵͳÀà× ......
java ÐÞÊηûºÍ·ÃÎÊȨÏÞ½éÉÜ
ÐÞÊηû½éÉÜ£º
public
ʹÓöÔÏó:Àà¡¢½Ó¿Ú¡¢³ÉÔ±±äÁ¿¡¢·½·¨
½éÉÜ:ÎÞÂÛËüËù´¦ÔÚ°ü¶¨ÒåÔÚÄĸÃÀà(½Ó¿Ú¡¢³ÉÔ±)¶¼ÊÇ¿É·ÃÎÊ
protected
ʹÓöÔÏó:³ÉÔ±±äÁ¿¡¢·½·¨
½éÉÜ:³ÉÔ±±äÁ¿Ö»ÄÜÔÚ¶¨ÒåËü°üÖб»·ÃÎÊ£¬Èç¹ûÔÚÆäËû°üÖб»·ÃÎÊ£¬ÔòʵÏÖÕâ¸ö˼··½·¨Àà±ØÐëÊǸóÉÔ±ËùÊôÀà×ÓÀà
private
ʹÓöÔÏó:³É ......