<%@page contentType="text/xml;charset=UTF-8" pageEncoding="ISO-8859-1" session="true"
%><%@page errorPage="Exception.jsp"
%><%@page import="com.fujitsu.iflow.model.bpm.BPMSession"
%><%@page import="com.fujitsu.iflow.common.UdaNameSanitizer"
%><%@page import="com.fujitsu.iflow.model.util.AEServers"
%><%@page import="com.fujitsu.iflow.model.util.QuickForm"
%><%@page import="com.fujitsu.iflow.model.util.URLEncoder"
%><%@page import="com.fujitsu.iflow.model.workflow.*"
%><%@page import="com.fujitsu.iflow.model.wfcore.*"
%><%@page import="com.fujitsu.iflow.model.util.WriterUTF8OutputStream"
%><%@page import="java.awt.Point"
%><%@page import="java.util.*"
%><%@page import="java.io.*"
%><%
    request.setCharacterEncoding("UTF-8");request.getParameterNames(); //Need dummy call for WL9.1
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setDateHeader("Expires", 0);           //prevents caching
    String planIdStr = request.getParameter("planId");

    BPMSession bps = (BPMSession) session.getAttribute("BPMSession");
    if (bps == null) {
        %><jsp:include page="PasswordPanel.jsp" flush="true"/><%
        return;
    }
    out.clearBuffer();
    try {
        Plan plan = bps.getPlan(Long.parseLong(planIdStr));

        // create an OutputStream object that does the right conversions
        // to write to the Writer -- still converts twice, but there is
        // no unnecessary buffering.
        WriterUTF8OutputStream wuos = new WriterUTF8OutputStream(out);
        plan.convertToBPEL(wuos);
    }
    catch (Exception e) {
      throw new Exception("ProcessDefinition.jsp unable to convert a process definition with the id = '"+e.toString()+"'.");
    }
%>
