<%@ include file="nlsResource.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.io.*, java.util.*,jet.cs.util.*,jet.server.api.http.*" %>
<%@ page import="jet.server.api.*" %>
<%@ include file="AuthCheck.jsp" %>

<%
	try{ 
	    HttpRptServer httpRptServer = HttpUtil.getHttpRptServer(); 

	    String user = HttpUtil.getUser(request); 
	    String cat = "/SampleReports/SampleReports.cat"; 
	    String rptName = "CustomerAnalysis.cls"; 
		
	    Properties ht = new Properties(); 
	    int rstType = APIConst.HTML;                                
	    ht.put(APIConst.TAG_RESULT_TYPE, String.valueOf(rstType)); 
                                  
	    String rst = httpRptServer.runReport(user, cat, rptName, ht); 
	    
	    if (rst != null) {
		httpRptServer.getTempResultOwnerManager().registerOwner(user,HttpUtil.getTempResultKey(new File(rst).getName())); 
			
		String rstURL = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() 
		    + "/servlet/sendfile/result/" + HttpUtil.encodeEsc(new File(rst).getName()); 	          
		response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
		response.setHeader("Location", rstURL);
		response.setHeader("Content-Location", rstURL);
	    }                 
	}catch(RptServerException e){ 
	    e.printStackTrace(); 
	}catch(Throwable t){                                         
	    t.printStackTrace();               
	}                                          
%>                                                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 