/** * Customize the error pahe * @param req The {@link Request} object * @param res The {@link Response} object * @throws java.lang.Exception */ protected void customizedErrorPage(Request req, Response res) throws Exception { /** * With Grizzly, we just return a 404 with a simple error message. */ res.setMessage("Not Found"); }
/** * Customize the error pahe * @param req The {@link Request} object * @param res The {@link Response} object * @throws java.lang.Exception */ protected void customizedErrorPage(Request req, Response res) throws Exception { /** * With Grizzly, we just return a 404 with a simple error message. */ res.setMessage("Not Found"); }
/** * Set the HTTP status and message to be returned with this response. * * @param status The new HTTP status * @param message The associated text message * */ public void setStatus(int status, String message) { if (isCommitted()) return; // Ignore any call from an included servlet if (included) return; response.setStatus(status); response.setMessage(message); }
/** * Set the HTTP status and message to be returned with this response. * * @param status The new HTTP status * @param message The associated text message * */ public void setStatus(int status, String message) { checkResponse(); if (isCommitted()) return; // Ignore any call from an included servlet if (included) return; response.setStatus(status); response.setMessage(message); }
/** * Set the HTTP status and message to be returned with this response. * * @param status The new HTTP status * @param message The associated text message * */ public void setStatus(int status, String message) { checkResponse(); if (isCommitted()) return; // Ignore any call from an included servlet if (included) return; response.setStatus(status); response.setMessage(message); }
res.setMessage("Not Found"); res.setStatus(404); ByteBuffer bb = HtmlHelper.getErrorPage("Not Found", "HTTP/1.1 404 Not Found\r\n", "Grizzly");
@Override public void setHeaders(Response response) { response.setMessage("WebSocket Protocol Handshake"); response.setHeader("Upgrade", "WebSocket"); response.setHeader(SERVER_SEC_WS_LOCATION_HEADER, getLocation()); response.setHeader(SERVER_SEC_WS_ORIGIN_HEADER, getOrigin()); } }
private static void handleUnsupportedVersion(final Response response) throws IOException { response.setStatus(400); response.setMessage("Bad Request"); response.addHeader(WebSocketEngine.SEC_WS_VERSION, Version.getSupportedWireProtocolVersions()); response.sendHeaders(); response.flush(); }
public void setHeaders(Response response) { response.setMessage(WebSocketEngine.RESPONSE_CODE_MESSAGE); response.setHeader(WebSocketEngine.SEC_WS_ACCEPT, secKey.getSecKey()); if (getEnabledExtensions() != null) { response.setHeader(WebSocketEngine.SEC_WS_EXTENSIONS_HEADER, join(getSubProtocol())); } }
/** * Send an error response with the specified status and message. * * @param status HTTP status code to send * @param message Corresponding message to send * * @exception IllegalStateException if this response has * already been committed * @exception IOException if an input/output error occurs */ public void sendError(int status, String message) throws IOException { if (isCommitted()) throw new IllegalStateException (sm.getString("response.sendError.ise")); // Ignore any call from an included servlet if (included) return; setError(); response.setStatus(status); response.setMessage(message); // Clear any data content that has been buffered resetBuffer(); // Cause the response to be finished (from the application perspective) setSuspended(true); }
/** * Send an error response with the specified status and message. * * @param status HTTP status code to send * @param message Corresponding message to send * * @exception IllegalStateException if this response has * already been committed * @exception IOException if an input/output error occurs */ public void sendError(int status, String message) throws IOException { checkResponse(); if (isCommitted()) throw new IllegalStateException (sm.getString("response.sendError.ise")); // Ignore any call from an included servlet if (included) return; setError(); response.setStatus(status); response.setMessage(message); // Clear any data content that has been buffered resetBuffer(); // Cause the response to be finished (from the application perspective) setSuspended(true); }
req.action( ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE , null); res.setStatus(302); res.setMessage("Moved Temporarily"); res.setHeader("Location", req.scheme() + "://" + req.serverName() + ":" + req.getServerPort() + "/index.html");
/** * Send an error response with the specified status and message. * * @param status HTTP status code to send * @param message Corresponding message to send * * @exception IllegalStateException if this response has * already been committed * @exception IOException if an input/output error occurs */ public void sendError(int status, String message) throws IOException { checkResponse(); if (isCommitted()) throw new IllegalStateException (sm.getString("response.sendError.ise")); // Ignore any call from an included servlet if (included) return; setError(); response.setStatus(status); response.setMessage(message); // Clear any data content that has been buffered resetBuffer(); // Cause the response to be finished (from the application perspective) setSuspended(true); }
req.action( ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE , null); res.setStatus(302); res.setMessage("Moved Temporarily"); res.setHeader("Location", req.scheme() + "://" + req.serverName() + ":" + req.getServerPort()
public void respond(WebSocketApplication application, Response response) { response.setStatus(101); response.setMessage("Web Socket Protocol Handshake"); response.setHeader("Upgrade", "websocket"); response.setHeader("Connection", "Upgrade"); setHeaders(response); if (!getSubProtocol().isEmpty()) { response.setHeader(WebSocketEngine.SEC_WS_PROTOCOL_HEADER, join(application.getSupportedProtocols(getSubProtocol()))); } try { response.sendHeaders(); response.flush(); } catch (IOException e) { throw new HandshakeException(e.getMessage(), e); } }
if (res.getStatus() == 404){ res.setStatus(200); res.setMessage("OK"); } else { return; } catch (IOException ioe) { res.setStatus(400); res.setMessage("Invalid URI: " + ioe.getMessage()); return; logger.log(Level.SEVERE,"service exception",t); res.setStatus(500); res.setMessage("Internal Error"); return;
if (res.getStatus() == 404){ res.setStatus(200); res.setMessage("OK"); } else { return; } catch (IOException ioe) { res.setStatus(400); res.setMessage("Invalid URI: " + ioe.getMessage()); return; logger.log(Level.SEVERE,"service exception",t); res.setStatus(500); res.setMessage("Internal Error"); return;
if (res.getStatus() == 404){ res.setStatus(200); res.setMessage("OK"); } else { return; } catch (IOException ioe) { res.setStatus(400); res.setMessage("Invalid URI: " + ioe.getMessage()); return; logger.log(Level.SEVERE,"service exception",t); res.setStatus(500); res.setMessage("Internal Error"); return;