Package javax.servlet.http

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


    if (strIsZazlRequest != null && strIsZazlRequest.equals("true")) {
      isZazlRequest = true;
    }
    if (isZazlRequest && pathInfo.endsWith(".html") && pathInfo.startsWith(IDavinciServerConstants.USER_URL)) {
      HttpServletResponse resp = (HttpServletResponse)response;
      if (resp.containsHeader(EXPIRES)) {
        resp.setDateHeader(EXPIRES, 0);
        resp.setHeader(CACHE_CONTROL, "no-cache");
        resp.setHeader(PRAGMA, "no-cache");
      }
      PrintWriter out = response.getWriter();
View Full Code Here


            rsp.setStatus(SC_FORBIDDEN);
            rsp.setContentType("text/html;charset=UTF-8");
            PrintWriter out;
            try {
                OutputStream sout = rsp.getOutputStream();
                if (rsp.containsHeader("Content-Encoding")) {
                    // we serve Jelly pages with Content-Encoding:gzip.
                    // ServletResponse doesn't provide means for us to check the value of the header,
                    // so this is a hack.
                    sout = new GZIPOutputStream(sout);
                }
View Full Code Here

    {
        HttpServletRequest request=(HttpServletRequest)req;
        HttpServletResponse response=(HttpServletResponse)res;

        String ae = request.getHeader("accept-encoding");
        if (ae != null && ae.indexOf("gzip")>=0 && !response.containsHeader("Content-Encoding"))
        {
            if (_excluded!=null)
            {
                String ua=getUserAgent(request);
                if (_excluded.contains(ua))
View Full Code Here

  public static void ensureContentTypeHeader(FacesContext facesContext, String contentType) {
    // TODO PortletRequest
    if (facesContext.getExternalContext().getResponse() instanceof HttpServletResponse) {
      HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
      if (!response.containsHeader("Content-Type")) {
        response.setContentType(contentType);
      } else {
        try {
          String responseContentType = response.getContentType();
          if (!responseContentType.equalsIgnoreCase(contentType)) {
View Full Code Here

  public static void ensureContentTypeHeader(FacesContext facesContext, String contentType) {
    // TODO PortletRequest
    if (facesContext.getExternalContext().getResponse() instanceof HttpServletResponse) {
      HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
      if (!response.containsHeader("Content-Type")) {
        response.setContentType(contentType);
      } else {
        try {
          String responseContentType = response.getContentType();
          if (!responseContentType.equalsIgnoreCase(contentType)) {
View Full Code Here

        HttpServletRequest request=(HttpServletRequest)req;
        HttpServletResponse response=(HttpServletResponse)res;

        String ae = request.getHeader("accept-encoding");
        Boolean gzip=(Boolean)request.getAttribute("GzipFilter");
        if (ae != null && ae.indexOf("gzip")>=0 && !response.containsHeader("Content-Encoding") &&
            (gzip==null || gzip.booleanValue()) && !"HEAD".equalsIgnoreCase(request.getMethod()))
        {
            if (_excluded!=null)
            {
                String ua=getUserAgent(request);
View Full Code Here

    // for different environment ( portal, cocoon etc )
    if (response instanceof HttpServletResponse) {
      HttpServletResponse httpResponse = (HttpServletResponse) response;
//      httpResponse.setHeader(AjaxContainerRenderer.AJAX_UPDATE_HEADER,
//          senderString.toString());
      if(!httpResponse.containsHeader(AjaxContainerRenderer.AJAX_FLAG_HEADER)){
        httpResponse.setHeader(AjaxContainerRenderer.AJAX_FLAG_HEADER,
        "true");
      }
    } else {
      try {
View Full Code Here

  @Override
  @SuppressWarnings("deprecation")
  public boolean checkNotModified(long lastModifiedTimestamp) {
    HttpServletResponse response = getResponse();
    if (lastModifiedTimestamp >= 0 && !this.notModified &&
        (response == null || !response.containsHeader(HEADER_LAST_MODIFIED))) {
      long ifModifiedSince = -1;
      try {
        ifModifiedSince = getRequest().getDateHeader(HEADER_IF_MODIFIED_SINCE);
      }
      catch (IllegalArgumentException ex) {
View Full Code Here

  @Override
  public boolean checkNotModified(String etag) {
    HttpServletResponse response = getResponse();
    if (StringUtils.hasLength(etag) && !this.notModified &&
        (response == null || !response.containsHeader(HEADER_ETAG))) {
      String ifNoneMatch = getRequest().getHeader(HEADER_IF_NONE_MATCH);
      this.notModified = etag.equals(ifNoneMatch);
      if (response != null) {
        if (this.notModified && supportsNotModifiedStatus()) {
          response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
View Full Code Here

    {
        HttpServletRequest request=(HttpServletRequest)req;
        HttpServletResponse response=(HttpServletResponse)res;

        String ae = request.getHeader("accept-encoding");
        if (ae != null && ae.indexOf("gzip")>=0 && !response.containsHeader("Content-Encoding"))
        {
            if (_excluded!=null)
            {
                String ua=getUserAgent(request);
                if (_excluded.contains(ua))
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.