javax.servlet.jsp.JspWriter#flush ( )源码实例Demo

下面列出了javax.servlet.jsp.JspWriter#flush ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Tomcat8-Source-Read   文件: JspRuntimeLibrary.java
/**
 * Perform a RequestDispatcher.include() operation, with optional flushing
 * of the response beforehand.
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are processing
 * @param relativePath The relative path of the resource to be included
 * @param out The Writer to whom we are currently writing
 * @param flush Should we flush before the include is processed?
 *
 * @exception IOException if thrown by the included servlet
 * @exception ServletException if thrown by the included servlet
 */
public static void include(ServletRequest request,
                           ServletResponse response,
                           String relativePath,
                           JspWriter out,
                           boolean flush)
    throws IOException, ServletException {

    if (flush && !(out instanceof BodyContent))
        out.flush();

    // FIXME - It is tempting to use request.getRequestDispatcher() to
    // resolve a relative path directly, but Catalina currently does not
    // take into account whether the caller is inside a RequestDispatcher
    // include or not.  Whether Catalina *should* take that into account
    // is a spec issue currently under review.  In the mean time,
    // replicate Jasper's previous behavior

    String resourcePath = getContextRelativePath(request, relativePath);
    RequestDispatcher rd = request.getRequestDispatcher(resourcePath);

    rd.include(request,
               new ServletResponseWrapperInclude(response, out));

}
 
源代码2 项目: Tomcat7.0.67   文件: JspRuntimeLibrary.java
/**
 * Perform a RequestDispatcher.include() operation, with optional flushing
 * of the response beforehand.
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are processing
 * @param relativePath The relative path of the resource to be included
 * @param out The Writer to whom we are currently writing
 * @param flush Should we flush before the include is processed?
 *
 * @exception IOException if thrown by the included servlet
 * @exception ServletException if thrown by the included servlet
 */
public static void include(ServletRequest request,
                           ServletResponse response,
                           String relativePath,
                           JspWriter out,
                           boolean flush)
    throws IOException, ServletException {

    if (flush && !(out instanceof BodyContent))
        out.flush();

    // FIXME - It is tempting to use request.getRequestDispatcher() to
    // resolve a relative path directly, but Catalina currently does not
    // take into account whether the caller is inside a RequestDispatcher
    // include or not.  Whether Catalina *should* take that into account
    // is a spec issue currently under review.  In the mean time,
    // replicate Jasper's previous behavior

    String resourcePath = getContextRelativePath(request, relativePath);
    RequestDispatcher rd = request.getRequestDispatcher(resourcePath);

    rd.include(request,
               new ServletResponseWrapperInclude(response, out));

}
 
源代码3 项目: tomcatsrc   文件: JspRuntimeLibrary.java
/**
 * Perform a RequestDispatcher.include() operation, with optional flushing
 * of the response beforehand.
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are processing
 * @param relativePath The relative path of the resource to be included
 * @param out The Writer to whom we are currently writing
 * @param flush Should we flush before the include is processed?
 *
 * @exception IOException if thrown by the included servlet
 * @exception ServletException if thrown by the included servlet
 */
public static void include(ServletRequest request,
                           ServletResponse response,
                           String relativePath,
                           JspWriter out,
                           boolean flush)
    throws IOException, ServletException {

    if (flush && !(out instanceof BodyContent))
        out.flush();

    // FIXME - It is tempting to use request.getRequestDispatcher() to
    // resolve a relative path directly, but Catalina currently does not
    // take into account whether the caller is inside a RequestDispatcher
    // include or not.  Whether Catalina *should* take that into account
    // is a spec issue currently under review.  In the mean time,
    // replicate Jasper's previous behavior

    String resourcePath = getContextRelativePath(request, relativePath);
    RequestDispatcher rd = request.getRequestDispatcher(resourcePath);

    rd.include(request,
               new ServletResponseWrapperInclude(response, out));

}
 
源代码4 项目: jeecg   文件: ComboTreeTag.java
public int doEndTag() throws JspTagException {
	JspWriter out = null;
	try {
		out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}finally{
		try {
			out.clear();
			out.close();
		} catch (Exception e2) {
		}
	}
	return EVAL_PAGE;
}
 
源代码5 项目: jeewx   文件: FormValidationTag.java
public int doStartTag() throws JspException {
	try {
		JspWriter out = this.pageContext.getOut();
		StringBuffer sb = new StringBuffer();
		if ("div".equals(layout)) {
			sb.append("<div id=\"content\">");
			sb.append("<div id=\"wrapper\">");
			sb.append("<div id=\"steps\">");
		}
		sb.append("<form id=\"" + formid + "\" action=\"" + action + "\" name=\"" + formid + "\" method=\"post\">");
		if ("btn_sub".equals(btnsub) && dialog)
			sb.append("<input type=\"hidden\" id=\"" + btnsub + "\" class=\"" + btnsub + "\"/>");
		out.print(sb.toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}
	return EVAL_PAGE;
}
 
源代码6 项目: jeecg   文件: ComboBoxTag.java
public int doEndTag() throws JspTagException {
	JspWriter out = null;
	try {
		out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}finally{
		try {
			out.clear();
			out.close();
		} catch (Exception e2) {
		}
	}
	return EVAL_PAGE;
}
 
源代码7 项目: jeecg   文件: ColorChangeTag.java
public int doEndTag() throws JspTagException {
	JspWriter out = null;
	try {
		out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}finally{
		try {
			out.clear();
			out.close();
		} catch (Exception e2) {
		}
	}
	return EVAL_PAGE;
}
 
源代码8 项目: jeecg   文件: TreeSelectTag.java
public int doEndTag() throws JspTagException {
	JspWriter out = null;
	try {
		out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}finally{
		try {
			out.clear();
			out.close();
			end().setLength(0);
		} catch (Exception e2) {
		}
	}
	return EVAL_PAGE;
}
 
源代码9 项目: packagedrone   文件: JspRuntimeLibrary.java
/**
 * Perform a RequestDispatcher.include() operation, with optional flushing
 * of the response beforehand.
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are processing
 * @param relativePath The relative path of the resource to be included
 * @param out The Writer to whom we are currently writing
 * @param flush Should we flush before the include is processed?
 *
 * @exception IOException if thrown by the included servlet
 * @exception ServletException if thrown by the included servlet
 */
public static void include(ServletRequest request,
                           ServletResponse response,
                           String relativePath,
                           JspWriter out,
                           boolean flush)
    throws IOException, ServletException {

    if (flush && !(out instanceof BodyContent))
        out.flush();

    // FIXME - It is tempting to use request.getRequestDispatcher() to
    // resolve a relative path directly, but Catalina currently does not
    // take into account whether the caller is inside a RequestDispatcher
    // include or not.  Whether Catalina *should* take that into account
    // is a spec issue currently under review.  In the mean time,
    // replicate Jasper's previous behavior

    String resourcePath = getContextRelativePath(request, relativePath);
    RequestDispatcher rd = request.getRequestDispatcher(resourcePath);

    rd.include(request,
               new ServletResponseWrapperInclude(response, out));

}
 
源代码10 项目: jeecg   文件: MutiLangTag.java
public int doEndTag() throws JspTagException {
	JspWriter out = null;
	try {
		out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}finally{
		try {
			out.clear();
			out.close();
		} catch (Exception e2) {
		}
	}
	return EVAL_PAGE;
}
 
源代码11 项目: jeecg   文件: DepartSelectTag.java
public int doEndTag() throws JspTagException {
	JspWriter out = null;
	try {
		out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}finally{
		try {
			out.clear();
			out.close();
		} catch (Exception e2) {
		}
	}
	return EVAL_PAGE;
}
 
源代码12 项目: jeecg   文件: OrgSelectTag.java
public int doEndTag() throws JspTagException {
	JspWriter out = null;
	try {
		out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}finally{
		try {
			out.clear();
			out.close();
		} catch (Exception e2) {
		}
	}
	return EVAL_PAGE;
}
 
源代码13 项目: jeecg   文件: CkeditorTag.java
public int doEndTag() throws JspTagException {
	JspWriter out = null;
	try {
		out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}finally{
		try {
			out.clear();
			out.close();
		} catch (Exception e2) {
		}
	}
	return EVAL_PAGE;
}
 
源代码14 项目: jeewx   文件: UploadTag.java
public int doEndTag() throws JspTagException {
	try {
		JspWriter out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}
	return EVAL_PAGE;
}
 
源代码15 项目: jeewx   文件: ChooseTag.java
public int doEndTag() throws JspTagException {
	try {
		JspWriter out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}
	return EVAL_PAGE;
}
 
源代码16 项目: jeewx   文件: AuthFilterTag.java
public int doEndTag() throws JspException {
	try {
		JspWriter out = this.pageContext.getOut();
			out.print(end().toString());
			out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}
	return EVAL_PAGE;
	
}
 
源代码17 项目: jeewx   文件: CkfinderTag.java
public int doEndTag() throws JspTagException {
	try {
		JspWriter out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}
	return EVAL_PAGE;
}
 
源代码18 项目: lognavigator   文件: RawContentTag.java
@Override
public int doEndTag() throws JspException {
	
	// Get input and ouput variables
	Reader rawContent = (Reader) pageContext.getAttribute(Constants.RAW_CONTENT_KEY, PageContext.REQUEST_SCOPE);
	JspWriter out = pageContext.getOut();
	
	try {
		// Copy input (rawContent) to output (out)
		char[] buffer = new char[StreamUtils.BUFFER_SIZE];
		int bytesRead = -1;
		while ((bytesRead = rawContent.read(buffer)) != -1) {
			String stringToWrite = new String(buffer, 0, bytesRead);
			stringToWrite = HtmlUtils.htmlEscape(stringToWrite);
			out.write(stringToWrite);
		}
		out.flush();

		return EVAL_PAGE;
	}
	catch (IOException e) {
		throw new JspException(e);
	}
	finally {
		IOUtils.closeQuietly(rawContent);
	}
}
 
源代码19 项目: jeecg   文件: AutocompleteTag.java
public int doEndTag() throws JspTagException {
	JspWriter out = null;
	try {
		out = this.pageContext.getOut();
		out.print(end().toString());
		out.flush();
	} catch (IOException e) {
		e.printStackTrace();
	}
	return EVAL_PAGE;
}
 
源代码20 项目: jeecg   文件: FormValidationTag.java
public int doStartTag() throws JspException {
		//SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		//long start = System.currentTimeMillis();
		//logger.debug("=================Form=====doStartTag==========开始时间:" + sdf.format(new Date()) + "==============================");
		JspWriter out = null;
		try {
			out = this.pageContext.getOut();
			StringBuffer sb = new StringBuffer();
				/*//			if(cssTheme==null){//手工设置值优先
				Cookie[] cookies = ((HttpServletRequest) super.pageContext
						.getRequest()).getCookies();
				for (Cookie cookie : cookies) {
					if (cookie == null || StringUtils.isEmpty(cookie.getName())) {
						continue;
					}
					if (cookie.getName().equalsIgnoreCase("JEECGCSSTHEME")) {
						cssTheme = cookie.getValue();
					}
				}
//			}
			if(cssTheme==null||"default".equals(cssTheme))cssTheme="";*/
			if ("div".equals(layout)) {
				sb.append("<div id=\"content\">");

				sb.append("<div id=\"wrapper\" style=\"border-left:1px solid #ddd;\">");

				sb.append("<div id=\"steps\">");
			}
			sb.append("<form id=\"" + formid + "\" " );

			if(this.getStyleClass()!=null){
				sb.append("class=\""+this.getStyleClass()+"\" ");
			}

					sb.append(" action=\"" + action + "\" name=\"" + formid + "\" method=\"post\">");
			if ("btn_sub".equals(btnsub) && dialog)
				sb.append("<input type=\"hidden\" id=\"" + btnsub + "\" class=\"" + btnsub + "\"/>");
			
			out.print(sb.toString());
			out.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			try {
				out.clearBuffer();
			} catch (Exception e2) {
				e2.printStackTrace();
			}
		}
		//long end = System.currentTimeMillis();
		//logger.debug("==============Form=====doStartTag=================结束时间:" + sdf.format(new Date()) + "==============================");
		//logger.debug("===============Form=====doStartTag=================耗时:" + (end - start) + "ms==============================");

		return EVAL_PAGE;
	}