📄 baseajaxobserver.java
字号:
/** * Copyright 2007 Jens Kapitza * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package net.sourceforge.ajaxtags.server;import java.util.Observable;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import net.sourceforge.ajaxtags.servlets.BaseAjaxServlet;import net.sourceforge.ajaxtags.xml.AjaxXmlBuilder;/** * ein Observer erstellen * * @author Jens Kapitza * @version $Revision$ $Date: 2007/08/01 15:21:29 $ $Author: jenskapitza $ * */public abstract class BaseAjaxObserver extends BaseAjaxServlet implements ICallbackClient { private boolean interrupt; public boolean isInterrupted() { return this.interrupt; } private AjaxXmlBuilder xml = null; @Override public String getXmlContent(HttpServletRequest request, HttpServletResponse response) throws Exception { this.xml = null; // daten zurücksetzen try { this.interrupt = false; catchClient(request); } catch (InterruptedException e) { this.interrupt = true; } if (isInterrupted() || this.xml == null) { return null; // wenn ich beendet werde dann muss ich nichts // senden, da ich nichts habe! } return this.xml.toString(); } /** * set an xml builder * * @param xml */ public void setXml(AjaxXmlBuilder xml) { this.xml = xml; } public void update(Observable o, Object arg) { if (o == null || arg == null || !(arg instanceof AjaxXmlBuilder)) { throw new NullPointerException(); } setXml((AjaxXmlBuilder) arg); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -