Package javax.servlet.http

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


        String actualId = context.getApplication().getViewHandler().getActionURL(context, viewId);
        Object respObj = context.getExternalContext().getResponse();
        if (respObj instanceof HttpServletResponse)
        {
            HttpServletResponse respHttp = (HttpServletResponse) respObj;
            respHttp.sendError(HttpServletResponse.SC_NOT_FOUND, actualId);
            context.responseComplete();
        }
    }

    protected void handleRenderException(FacesContext context, Exception e)
View Full Code Here


        // This is incredibly lame, but I see no other option. -= SL =-
        HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
        try
        {
            context.responseComplete();
            response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
        }
        catch (IOException ioe)
        {
            throw new FacesException(ioe);
        }
View Full Code Here

    {
        HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
        try
        {
            context.responseComplete();
            response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
        }
        catch (IOException ioe)
        {
            throw new FacesException(ioe);
        }
View Full Code Here

        String actualId = this.getActionURL(context, viewId);
        Object respObj = context.getExternalContext().getResponse();
        if (respObj instanceof HttpServletResponse)
        {
            HttpServletResponse respHttp = (HttpServletResponse) respObj;
            respHttp.sendError(HttpServletResponse.SC_NOT_FOUND, actualId);
            context.responseComplete();
        }
    }

    /**
 
View Full Code Here

  public void testControllerCSRF() throws Exception {
    // Send it as an AJAX request but not a task queue request - should be denied.
    HttpServletRequest request = createMockRequest(CONTROLLER_PATH, false, true);
    HttpServletResponse response = createMock(HttpServletResponse.class);
    response.sendError(403, "Received unexpected non-task queue request.");
    replay(request, response);
    servlet.doPost(request, response);
    verify(request, response);
  }
View Full Code Here

    // Set before error and last one wins, so this is harmless.
    response.setContentType("application/json");
    EasyMock.expectLastCall().anyTimes();

    response.sendError(403, "Received unexpected non-XMLHttpRequest command.");
    replay(request, response);
    servlet.doGet(request, response);
    verify(request, response);
  }
View Full Code Here

            } else {
                // send 404 error if a URI is alias TO
                try {
                    List<GenericValue> aliasTos = delegator.findByAndCache("WebSitePathAlias", UtilMisc.toMap("webSiteId", webSiteId, "aliasTo", httpRequest.getRequestURI()));
                    if (UtilValidate.isNotEmpty(aliasTos)) {
                        httpResponse.sendError(HttpServletResponse.SC_NOT_FOUND, "Not Found");
                        return;
                    }
                } catch (GenericEntityException e) {
                    Debug.logError(e, module);
                }
View Full Code Here

                String previousNonce =
                    req.getParameter(Constants.CSRF_NONCE_REQUEST_PARAM);

                if (nonceCache == null || previousNonce == null ||
                        !nonceCache.contains(previousNonce)) {
                    res.sendError(HttpServletResponse.SC_FORBIDDEN);
                    return;
                }
            }
           
            if (nonceCache == null) {
View Full Code Here

                    sm.getString("applicationDispatcher.isUnavailable",
                    wrapper.getName()));
            long available = wrapper.getAvailable();
            if ((available > 0L) && (available < Long.MAX_VALUE))
                hresponse.setDateHeader("Retry-After", available);
            hresponse.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, sm
                    .getString("applicationDispatcher.isUnavailable", wrapper
                            .getName()));
            unavailable = true;
        }
View Full Code Here

    HttpServletResponse response =
      (HttpServletResponse) context.getExternalContext().getResponse();

    if (!_isValidEntry(name))
    {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST);
      return;
    }

    // Only use "text/html" for now, even if the browser thinks
    // it supports "text/html".
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.