Package javax.servlet.http

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


      final HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();

      response.setContentType(mime);

      if (asAttachment)
        response.addHeader("Content-Disposition", "attachment;filename=" + filename);

      response.setContentLength(data.length);

      final OutputStream writer = response.getOutputStream();
View Full Code Here


                        LongHelper.asInt(timeToLive.inMillis() / 1000);
                    if (maxAgeInSeconds < 0) {
                        maxAgeInSeconds = 0;
                    }
                }
                response.addHeader("Cache-Control", "max-age=" + maxAgeInSeconds);
            } else {
                // from the spec:
                // To mark a response as "never expires," an origin server sends
                // an Expires date approximately one year from the time the
                // response is sent. HTTP/1.1 servers SHOULD NOT send Expires
View Full Code Here

                // dates more than one year in the future.
                final SystemClock clock = cachingDirectives.getClock();
                final long oneYearInSeconds = 365 * 24 * 60 * 60;
                response.addDateHeader("Expires",
                    clock.getCurrentTime().inMillis() + oneYearInSeconds * 1000);
                response.addHeader("Cache-Control", "max-age=" + oneYearInSeconds);
            }
            response.addHeader("Vary", VARY_HEADER_VALUE);
        } else {
            // disable caching
            response.addHeader("Cache-Control", "no-cache");
View Full Code Here

                final long oneYearInSeconds = 365 * 24 * 60 * 60;
                response.addDateHeader("Expires",
                    clock.getCurrentTime().inMillis() + oneYearInSeconds * 1000);
                response.addHeader("Cache-Control", "max-age=" + oneYearInSeconds);
            }
            response.addHeader("Vary", VARY_HEADER_VALUE);
        } else {
            // disable caching
            response.addHeader("Cache-Control", "no-cache");
            response.addHeader("Pragma", "no-cache");
            final Calendar calendar =
View Full Code Here

                response.addHeader("Cache-Control", "max-age=" + oneYearInSeconds);
            }
            response.addHeader("Vary", VARY_HEADER_VALUE);
        } else {
            // disable caching
            response.addHeader("Cache-Control", "no-cache");
            response.addHeader("Pragma", "no-cache");
            final Calendar calendar =
                new GregorianCalendar(1990, Calendar.JANUARY, 1);
            response.addDateHeader("Expires", calendar.getTimeInMillis());
        }
View Full Code Here

            }
            response.addHeader("Vary", VARY_HEADER_VALUE);
        } else {
            // disable caching
            response.addHeader("Cache-Control", "no-cache");
            response.addHeader("Pragma", "no-cache");
            final Calendar calendar =
                new GregorianCalendar(1990, Calendar.JANUARY, 1);
            response.addDateHeader("Expires", calendar.getTimeInMillis());
        }
    }
View Full Code Here

    //TODO: fix this to work in PortletRequest as well
    if (externalContext.getResponse() instanceof HttpServletResponse) {
      final HttpServletResponse httpServletResponse
          = (HttpServletResponse) externalContext.getResponse();
      httpServletResponse.addHeader("Transfer-Encoding", "chunked");
      PrintWriter responseWriter = httpServletResponse.getWriter();
      // buf.delete(buf.indexOf("<"), buf.indexOf(">")+1);
      responseWriter.print(buf.toString());
      responseWriter.flush();
      responseWriter.close();
View Full Code Here

            while ( hdr != null || val != null )
            {
                String lhdr = hdr != null ? hdr.toLowerCase() : null;
                if ( hdr != null && val != null && !_DontProxyHeaders.contains( lhdr ) )
                {
                    response.addHeader( hdr, val );
                }
                context.log( "res " + hdr + ": " + val );

                h++;
                hdr = connection.getHeaderFieldKey( h );
View Full Code Here

                h++;
                hdr = connection.getHeaderFieldKey( h );
                val = connection.getHeaderField( h );
            }
            response.addHeader( "Via", "1.1 (jetty)" );

            // Handle
            if ( proxy_in != null )
            {
                IO.copy( proxy_in, response.getOutputStream() );
View Full Code Here

    //TODO: fix this to work in PortletRequest as well
    if (externalContext.getResponse() instanceof HttpServletResponse) {
      final HttpServletResponse httpServletResponse
          = (HttpServletResponse) externalContext.getResponse();
      httpServletResponse.addHeader("Transfer-Encoding", "chunked");
      PrintWriter responseWriter = httpServletResponse.getWriter();
      // buf.delete(buf.indexOf("<"), buf.indexOf(">")+1);
      responseWriter.print(buf.toString());
      responseWriter.flush();
      responseWriter.close();
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.