Apache cxf服务端里,本人自定义了一个输入拦截器后,当本人拦截到客户端输入的信息不符合本人要求时,本人怎么中断代码的执行,让代码不调用后面的业务逻辑,而返回本人想返给客户端的信息,例如给客户端返回“您输入的信息有误”
public class ValidateInterceptor extends AbstractPhaseInterceptor<XMLMessage>{ public ValidateInterceptor(String phase) { super(phase); } public ValidateInterceptor() { super(Phase.PRE_INVOKE); } @Override public void handleMessage(XMLMessage arg0) throws Fault { MessageContentsList lstContent = MessageContentsList.getContentsList(arg0); try { MsgObject msgObject = (MsgObject)ValidateUtil.valitWlefParams(lstContent.get(0)); if("error".equals(msgObject.getReturnCode())) { msgObject.setReturnMessage("拦截器拦截错误"); System.out.println("拦截器拦截错误"); //中断业务逻辑的执行,并返回任意信息给客户端? } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
解决方案
100
???????