Package javax.servlet.http

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


        else {
            final GuacamoleStatus status = GuacamoleStatus.CLIENT_UNAUTHORIZED;
            final String message = "Not authenticated";

            logger.info("HTTP request rejected: {}", message);
            response.addHeader("Guacamole-Status-Code", Integer.toString(status.getGuacamoleStatusCode()));
            response.addHeader("Guacamole-Error-Message", message);
            response.sendError(status.getHttpStatusCode());
        }

    }
View Full Code Here


            final GuacamoleStatus status = GuacamoleStatus.CLIENT_UNAUTHORIZED;
            final String message = "Not authenticated";

            logger.info("HTTP request rejected: {}", message);
            response.addHeader("Guacamole-Status-Code", Integer.toString(status.getGuacamoleStatusCode()));
            response.addHeader("Guacamole-Error-Message", message);
            response.sendError(status.getHttpStatusCode());
        }

    }
View Full Code Here

      ServletRequest request,
      ServletResponse response,
      FilterChain chain) throws IOException, ServletException {
    HttpServletResponse httpResponse = (HttpServletResponse) response;
    httpResponse.addDateHeader("Expire", 0L);
    httpResponse.addHeader("Pragma", "no-cache");
    httpResponse.addHeader("Cache-Control", "no-cache, must-revalidate, post-check=0, pre-check=0");
    chain.doFilter(request, response);
  }

  @Override
View Full Code Here

      ServletResponse response,
      FilterChain chain) throws IOException, ServletException {
    HttpServletResponse httpResponse = (HttpServletResponse) response;
    httpResponse.addDateHeader("Expire", 0L);
    httpResponse.addHeader("Pragma", "no-cache");
    httpResponse.addHeader("Cache-Control", "no-cache, must-revalidate, post-check=0, pre-check=0");
    chain.doFilter(request, response);
  }

  @Override
  public void init(FilterConfig filterConfig) throws ServletException {
View Full Code Here

            HttpServletRequest req = (HttpServletRequest)request;
            HttpServletResponse resp = (HttpServletResponse)response;
            if ("OPTIONS".equals(req.getMethod())) {
                if (checkOrigin(req, resp)) {
                    for (Map.Entry<String, String> e : optionsHeaders.entrySet()) {
                        resp.addHeader(e.getKey(), e.getValue());
                    }

                    // We need to return here since we don't want the chain to further process
                    // a preflight request since this can lead to unexpected processing of the preflighted
                    // request or a 405 - method not allowed in Grails 2.3
View Full Code Here

                    return;

                }
            } else if (checkOrigin(req, resp)) {
                if (exposeHeaders != null) {
                    resp.addHeader("Access-Control-Expose-Headers", exposeHeaders);
                }
            }
        }
        filterChain.doFilter(request, response);
    }
View Full Code Here

    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request= (HttpServletRequest) servletRequest;
        HttpServletResponse response= (HttpServletResponse) servletResponse;

        String origin=request.getHeader("origin");
        if (origin!=null) response.addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, origin);
        else response.addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*");
        response.addHeader(ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");

        // Allow all forms of requests
        final Enumeration aclMethods = request.getHeaders(ACCESS_CONTROL_REQUEST_METHOD);
View Full Code Here

        HttpServletRequest request= (HttpServletRequest) servletRequest;
        HttpServletResponse response= (HttpServletResponse) servletResponse;

        String origin=request.getHeader("origin");
        if (origin!=null) response.addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, origin);
        else response.addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*");
        response.addHeader(ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");

        // Allow all forms of requests
        final Enumeration aclMethods = request.getHeaders(ACCESS_CONTROL_REQUEST_METHOD);
        while (aclMethods.hasMoreElements()) {
View Full Code Here

        HttpServletResponse response= (HttpServletResponse) servletResponse;

        String origin=request.getHeader("origin");
        if (origin!=null) response.addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, origin);
        else response.addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*");
        response.addHeader(ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");

        // Allow all forms of requests
        final Enumeration aclMethods = request.getHeaders(ACCESS_CONTROL_REQUEST_METHOD);
        while (aclMethods.hasMoreElements()) {
            String value = (String) aclMethods.nextElement();
View Full Code Here

        // Allow all forms of requests
        final Enumeration aclMethods = request.getHeaders(ACCESS_CONTROL_REQUEST_METHOD);
        while (aclMethods.hasMoreElements()) {
            String value = (String) aclMethods.nextElement();
            response.addHeader( ACCESS_CONTROL_ALLOW_METHODS, value );
        }

        // Allow all types of headers
        final Enumeration aclHeaders = request.getHeaders(ACCESS_CONTROL_REQUEST_HEADERS);
        while (aclHeaders.hasMoreElements()) {
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.