List of usage examples for javax.servlet.http HttpServletResponse sendError
public void sendError(int sc, String msg) throws IOException;
Sends an error response to the client using the specified status and clears the buffer.
From source file:com.ecyrd.jspwiki.dav.WikiDavServlet.java
@Override protected void doDelete(HttpServletRequest arg0, HttpServletResponse response) throws ServletException, IOException { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "JSPWiki is read-only."); }
From source file:com.ecyrd.jspwiki.dav.WikiDavServlet.java
@Override protected void doPost(HttpServletRequest arg0, HttpServletResponse response) throws ServletException, IOException { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "JSPWiki is read-only."); }
From source file:com.ecyrd.jspwiki.dav.WikiDavServlet.java
@Override protected void doPut(HttpServletRequest arg0, HttpServletResponse response) throws ServletException, IOException { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "JSPWiki is read-only."); }
From source file:com.ecyrd.jspwiki.dav.WikiDavServlet.java
@Override public void doMove(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "JSPWiki is read-only."); }
From source file:se.vgregion.pubsub.push.web.PushController.java
@RequestMapping(value = "/", method = RequestMethod.GET) public void get(HttpServletResponse response) throws IOException { response.sendError(405, "This is the endpoint for the PubSubHubbub hub. " + "It only support POST requests according to the PubSubHubbub protocol"); }
From source file:com.collective.celos.servlet.JSONWorkflowServlet.java
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException { String id = req.getParameter(CelosClient.ID_PARAM); try {//w w w. java 2 s . c o m if (id == null) { res.sendError(HttpServletResponse.SC_BAD_REQUEST, CelosClient.ID_PARAM + " parameter missing."); return; } Scheduler scheduler = getOrCreateCachedScheduler(); Workflow wf = scheduler.getWorkflowConfiguration().findWorkflow(new WorkflowID(id)); if (wf == null) { res.sendError(HttpServletResponse.SC_NOT_FOUND, "Workflow not found: " + id); } else { ScheduledTime time = getRequestTime(req); try (StateDatabaseConnection connection = getStateDatabase().openConnection()) { List<SlotState> slotStates = scheduler.getSlotStates(wf, scheduler.getWorkflowStartTime(wf, time), time, connection); ObjectNode object = createJSONObject(slotStates); writer.writeValue(res.getOutputStream(), object); } } } catch (Exception e) { throw new ServletException(e); } }
From source file:com.econcept.init.AppAuthenticationEntryPoint.java
@Override public void commence(HttpServletRequest request, HttpServletResponse pResponse, AuthenticationException authException) throws IOException, ServletException { pResponse.addHeader("WWW-Authenticate", "xBasic realm=\"" + getRealmName() + "\""); pResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage()); }
From source file:com.graphaware.module.resttest.RestTestApi.java
@RequestMapping(value = "/assertSameGraph", method = RequestMethod.POST) @ResponseBody// w w w . ja v a 2s . c om public String assertSameGraph(@RequestBody RestTestRequest request, HttpServletResponse response) throws IOException { if (request.getCypher() == null) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Cypher statement must be provided"); } try { GraphUnit.assertSameGraph(database, request.getCypher(), resolveInclusionPolicies(request)); response.setStatus(HttpServletResponse.SC_OK); return null; } catch (AssertionError error) { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); return error.getMessage(); } }
From source file:com.graphaware.module.resttest.RestTestApi.java
@RequestMapping(value = "/assertSubgraph", method = RequestMethod.POST) @ResponseBody// w w w .j av a 2 s. co m public String assertSubgraph(@RequestBody RestTestRequest request, HttpServletResponse response) throws IOException { if (request.getCypher() == null) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Cypher statement must be provided"); } try { GraphUnit.assertSubgraph(database, request.getCypher(), resolveInclusionPolicies(request)); response.setStatus(HttpServletResponse.SC_OK); return null; } catch (AssertionError error) { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); return error.getMessage(); } }
From source file:io.fabric8.apiman.BearerTokenFilter.java
/** * Sends a response that tells the client that authentication is required. * /* www . j ava 2s . c o m*/ * @param response * the response * @throws IOException * when an error cannot be sent */ private void sendInvalidTokenResponse(HttpServletResponse response, String errMsg) throws IOException { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, errMsg); }