Search in sources :

Example 26 with WebDoc

use of org.compiere.util.WebDoc in project adempiere by adempiere.

the class WFindAdv method doGet.

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    HttpSession sess = request.getSession(false);
    WWindowStatus ws = null;
    WebSessionCtx wsc = WebSessionCtx.get(request);
    if (sess != null)
        ws = WWindowStatus.get(request);
    if (wsc == null) {
        WebUtil.createTimeoutPage(request, response, this, null);
        return;
    }
    WebDoc doc = preparePage();
    body body = doc.getBody();
    String pTab = request.getParameter(P_Tab);
    if (pTab != null && pTab.equals("FindAdv")) {
        body.addElement(createPageFindAdv(request, response, ws));
    } else {
        body.addElement(createPageFind(request, response, ws));
    }
    WebUtil.createResponse(request, response, this, null, doc, true);
}
Also used : HttpSession(javax.servlet.http.HttpSession) WebDoc(org.compiere.util.WebDoc) WebSessionCtx(org.compiere.util.WebSessionCtx) org.apache.ecs.xhtml.body(org.apache.ecs.xhtml.body)

Example 27 with WebDoc

use of org.compiere.util.WebDoc in project adempiere by adempiere.

the class WForm method doGet.

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    WebDoc doc = WebDoc.create("WForm - Get - Not Implemented Yet");
    WebUtil.createResponse(request, response, this, null, doc, false);
}
Also used : WebDoc(org.compiere.util.WebDoc)

Example 28 with WebDoc

use of org.compiere.util.WebDoc in project adempiere by adempiere.

the class WReport method doPost.

//  doGet
/**
	 *  Process the HTTP Post request
	 */
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    WebDoc doc = WebDoc.createPopup("Report - Post - Not Implemented");
    WebUtil.createResponse(request, response, this, null, doc, false);
}
Also used : WebDoc(org.compiere.util.WebDoc)

Example 29 with WebDoc

use of org.compiere.util.WebDoc in project adempiere by adempiere.

the class WReport method doGet.

//  init
/**
	 * Process the HTTP Get request
	 */
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    log.fine("doGet");
    log.info(response.toString());
    WebSessionCtx wsc = WebSessionCtx.get(request);
    WWindowStatus ws = WWindowStatus.get(request);
    m_curTab = ws.curTab;
    //
    WebDoc doc = null;
    File file = null;
    if (ws == null) {
        doc = WebDoc.createPopup("No Context");
        doc.addPopupClose(wsc.ctx);
    } else /**else if (fileName!=null)
		{			
			int AD_PInstance_ID = WebUtil.getParameterAsInt(request, "AD_PInstance_ID");
			File file = new File (fileName);
			String error = WebUtil.streamFile(response, file);
			if (error == null)
				return;
			doc = WebDoc.createWindow(error);
		}**/
    {
        log.info("");
        if (!MRole.getDefault().isCanReport(ws.curTab.getAD_Table_ID())) {
            doc = WebDoc.createPopup("Access Cannot Report");
            doc.addPopupClose(wsc.ctx);
        }
        //	Query
        MQuery query = new MQuery(m_curTab.getTableName());
        //	Link for detail records
        String queryColumn = m_curTab.getLinkColumnName();
        //	Current row otherwise
        if (queryColumn.length() == 0)
            queryColumn = m_curTab.getKeyColumnName();
        //	Find display
        String infoName = null;
        String infoDisplay = null;
        for (int i = 0; i < m_curTab.getFieldCount(); i++) {
            GridField field = m_curTab.getField(i);
            if (field.isKey())
                infoName = field.getHeader();
            if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo")) && field.getValue() != null)
                infoDisplay = field.getValue().toString();
            if (infoName != null && infoDisplay != null)
                break;
        }
        if (queryColumn.length() != 0) {
            if (queryColumn.endsWith("_ID"))
                query.addRestriction(queryColumn, MQuery.EQUAL, new Integer(Env.getContextAsInt(wsc.ctx, m_curTab.getWindowNo(), queryColumn)), infoName, infoDisplay);
            else
                query.addRestriction(queryColumn, MQuery.EQUAL, Env.getContext(wsc.ctx, m_curTab.getWindowNo(), queryColumn), infoName, infoDisplay);
        }
        file = getPrintFormats(m_curTab.getAD_Table_ID(), request, m_curTab, query);
        String error = WebUtil.streamFile(response, file);
        if (error == null)
            return;
        doc = WebDoc.createWindow(error);
    }
    //
    WebUtil.createResponse(request, response, this, null, doc, false);
}
Also used : WebDoc(org.compiere.util.WebDoc) MQuery(org.compiere.model.MQuery) GridField(org.compiere.model.GridField) WebSessionCtx(org.compiere.util.WebSessionCtx) File(java.io.File)

Example 30 with WebDoc

use of org.compiere.util.WebDoc in project adempiere by adempiere.

the class StoreFilter method doFilter.

//	destroy
/**
	 * 	Filter
	 *	@param request request
	 *	@param response response
	 *	@param chain chain
	 *	@throws IOException 
	 *	@throws ServletException
	 */
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    //  Get URI
    String uri = "";
    if (request instanceof HttpServletRequest) {
        HttpServletRequest req = (HttpServletRequest) request;
        uri = req.getRequestURI();
    }
    //  Ignore static content
    boolean check = uri.indexOf("Servlet") != -1;
    boolean pass = true;
    // We need to check
    if (check) {
        String enc = request.getCharacterEncoding();
        try {
            enc = request.getCharacterEncoding();
            if (enc == null)
                request.setCharacterEncoding(WebEnv.ENCODING);
            if (enc == null)
                log.finer("Checked=" + uri);
            else
                log.finer("Checked=" + uri + " - Enc=" + enc);
        } catch (Exception e) {
            log.log(Level.SEVERE, "Set CharacterEndocung=" + enc + "->" + WebEnv.ENCODING, e);
        }
    }
    //  **  Start   **
    if (pass)
        chain.doFilter(request, response);
    else {
        log.warning("Rejected " + uri);
        String msg = "Error: Access Rejected";
        WebDoc doc = WebDoc.create(msg);
        //	Body
        body b = doc.getBody();
        b.addElement(new p(uri, AlignType.CENTER));
        //	fini
        response.setContentType("text/html");
        PrintWriter out = new PrintWriter(response.getOutputStream());
        doc.output(out);
        out.close();
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) org.apache.ecs.xhtml.p(org.apache.ecs.xhtml.p) WebDoc(org.compiere.util.WebDoc) org.apache.ecs.xhtml.body(org.apache.ecs.xhtml.body) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) PrintWriter(java.io.PrintWriter)

Aggregations

WebDoc (org.compiere.util.WebDoc)58 WebSessionCtx (org.compiere.util.WebSessionCtx)21 HttpSession (javax.servlet.http.HttpSession)13 org.apache.ecs.xhtml.td (org.apache.ecs.xhtml.td)13 org.apache.ecs.xhtml.p (org.apache.ecs.xhtml.p)12 org.apache.ecs.xhtml.tr (org.apache.ecs.xhtml.tr)12 org.apache.ecs.xhtml.table (org.apache.ecs.xhtml.table)11 org.apache.ecs.xhtml.body (org.apache.ecs.xhtml.body)9 org.apache.ecs.xhtml.input (org.apache.ecs.xhtml.input)9 org.apache.ecs.xhtml.form (org.apache.ecs.xhtml.form)8 org.apache.ecs.xhtml.script (org.apache.ecs.xhtml.script)7 Timestamp (java.sql.Timestamp)6 org.apache.ecs.xhtml.a (org.apache.ecs.xhtml.a)6 GridField (org.compiere.model.GridField)5 SQLException (java.sql.SQLException)4 org.apache.ecs.xhtml.i (org.apache.ecs.xhtml.i)4 File (java.io.File)3 IOException (java.io.IOException)3 Properties (java.util.Properties)3 ServletException (javax.servlet.ServletException)3