Author: degenaro Date: Tue Aug 27 12:29:39 2019 New Revision: 1865988 URL: http://svn.apache.org/viewvc?rev=1865988&view=rev Log: UIMA-6117 DUCC Web Server (WS) should display "no data - not master" on Viz page
Modified: uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java Modified: uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java?rev=1865988&r1=1865987&r2=1865988&view=diff ============================================================================== --- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java (original) +++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java Tue Aug 27 12:29:39 2019 @@ -24,9 +24,11 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.uima.ducc.common.head.IDuccHead; import org.apache.uima.ducc.common.internationalization.Messages; import org.apache.uima.ducc.common.utils.DuccLogger; import org.apache.uima.ducc.common.utils.id.DuccId; +import org.apache.uima.ducc.ws.DuccHead; import org.apache.uima.ducc.ws.server.nodeviz.NodeViz; import org.eclipse.jetty.server.Request; @@ -36,6 +38,8 @@ public class DuccHandlerViz extends Ducc private static Messages messages = Messages.getInstance(); private static DuccId jobid = null; + private static IDuccHead dh = DuccHead.getInstance(); + public final String vizNodes = duccContextViz+"-nodes"; NodeViz viz = null; @@ -51,10 +55,21 @@ public class DuccHandlerViz extends Ducc String methodName = "handleServletVizNodes"; duccLogger.trace(methodName, jobid, messages.fetch("enter")); + String data = null; - //String data = "<html><p>"+methodName+" not yet implemented</p></html>"; - String data = viz.getVisualization(); - + if(dh.is_ducc_head_backup()) { + StringBuffer sb = new StringBuffer(); + sb.append("<tr>"); + sb.append("<td>"); + sb.append(messages.fetch("no data - not master")); + sb.append("</td>"); + sb.append("</tr>"); + data = sb.toString(); + } + else { + data = viz.getVisualization(); + } + duccLogger.debug(methodName, jobid, data); response.getWriter().println(data); duccLogger.trace(methodName, jobid, messages.fetch("exit"));