Package javax.servlet.http

Examples of javax.servlet.http.HttpServletResponse.reset()


        // handle dev response
        if (this.developmentMode && !context.getResponseComplete()
                && resp instanceof HttpServletResponse) {
            HttpServletResponse httpResp = (HttpServletResponse) resp;
            if (!httpResp.isCommitted()) {
              httpResp.reset();
              httpResp.setContentType("text/html; charset=UTF-8");
              Writer w = httpResp.getWriter();
              DevTools.debugHtml(w, context, e);
              w.flush();
              context.responseComplete();
View Full Code Here


            (HttpServletResponse) response.getResponse();

        try {

            // Reset the response if possible (else IllegalStateException)
            hres.reset();

            // Forward control to the specified location
            ServletContext servletContext =
                ((Context) container.getParent()).getServletContext();
            RequestDispatcher rd =
View Full Code Here

                if (response instanceof HttpServletResponse)
                {
                    HttpServletResponse httpResp = (HttpServletResponse) response;
                    if (!httpResp.isCommitted())
                    {
                        httpResp.reset();
                        if (facesContext.getPartialViewContext().isAjaxRequest())
                        {   
                            // ajax request --> xml error page
                            httpResp.setContentType("text/xml; charset=UTF-8");
                            try
View Full Code Here

  private void handleDownload(File file) throws Exception{
    if (file.exists()){
      HttpServletResponse response = this.context.getResponse();
      String filename = URLEncoder.encode(file.getName(), "utf-8");
            response.reset();
            response.setContentType("application/x-msdownload");
            response.addHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
            int fileLength = (int) file.length();
            response.setContentLength(fileLength);
            /*如果文件长度大于0*/
 
View Full Code Here

      File[] files = (File[])retn;
     
      String fileName = StringUtil.getNowTime("yyyyMMddHHmmss")+ "_" + "download.zip";
     
      HttpServletResponse resp = this.context.getResponse();
      resp.reset();
      resp.setContentType("application/zip")
            resp.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
           
          ServletOutputStream outputStream = resp.getOutputStream()
          ZipOutputStream zip = new ZipOutputStream(outputStream)
View Full Code Here

     */
    void reset() {
        Context.getContextStack().clear();
        HttpServletResponse response = getResponse();
        if (response != null) {
            response.reset();
        }
        ActionEventDispatcher.getDispatcherStack().clear();
        ControlRegistry.getRegistryStack().clear();
    }

View Full Code Here

                    // (This is necessary to ensure our Session Cookie, which ends
                    // in a trailing slash, isn't lost by some browsers, e.g. IE)
                    String locationWithTrailingSlash = realRequest.getRequestURI() + "/";
                   
                    // Reset any existing response headers -- instead we are going to redirect user to correct path
                    realResponse.reset();
                   
                    // Redirect user to homepage with trailing slash
                    realResponse.sendRedirect(locationWithTrailingSlash);
                }   
          // if force ssl is on and the user has authenticated and the request is not secure redirect to https
View Full Code Here

            // Open the file:
            input = new BufferedInputStream(new FileInputStream(file));
            int contentLength = input.available();

            // Initialise the servlet response:
            response.reset();
            response.setContentType(contentType);
            response.setContentLength(contentLength);
            response.setHeader(
                "Content-disposition", "attachment; filename=\"" + downloadName + ".xml\"");
            output = new BufferedOutputStream(response.getOutputStream());
View Full Code Here

            if (response.isCommitted()) {
                throw new ExportException(getClass());
            }

            try {
                response.reset();
                pageContext.getOut().clearBuffer();
            } catch (Exception e) {
                throw new ExportException(getClass());
            }
        }
View Full Code Here

            return false;
        }

        if (resetHeaders) {
            //Remove everything, including headers. The stream is often a file that may be cached.
            res.reset();
        }

        res.setHeader("Content-Encoding", HTTPSettings.lookup().getEncoding());
        if (contentDisposition != null) {
            res.setHeader("Content-Disposition", contentDisposition);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.