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);
}
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);
}
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);
}
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);
}
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();
}
}
Aggregations