本文整理了Java中org.eclipse.jetty.server.Response.sendError
方法的一些代码示例,展示了Response.sendError
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.sendError
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Response
类名称:Response
方法名:sendError
暂无
代码示例来源:origin: jersey/jersey
@Override
public void failure(final Throwable error) {
try {
if (!response.isCommitted()) {
try {
if (configSetStatusOverSendError) {
response.reset();
//noinspection deprecation
response.setStatus(INTERNAL_SERVER_ERROR, "Request failed.");
} else {
response.sendError(INTERNAL_SERVER_ERROR, "Request failed.");
}
} catch (final IllegalStateException ex) {
// a race condition externally committing the response can still occur...
LOGGER.log(Level.FINER, "Unable to reset failed response.", ex);
} catch (final IOException ex) {
throw new ContainerException(LocalizationMessages.EXCEPTION_SENDING_ERROR_RESPONSE(INTERNAL_SERVER_ERROR,
"Request failed."), ex);
}
}
} finally {
LOGGER.log(Level.FINEST, "failure(...) called");
commit();
rethrow(error);
}
}
代码示例来源:origin: theonedev/onedev
@Override
public void sendError(int sc) throws IOException
{
sendError(sc, null);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
@Override
public void sendError(int sc) throws IOException
{
sendError(sc, null);
}
代码示例来源:origin: jenkinsci/winstone
@Override
public void sendError(int sc) throws IOException
{
sendError(sc, null);
}
代码示例来源:origin: Nextdoor/bender
@Override
public void sendError(int sc) throws IOException
{
sendError(sc, null);
}
代码示例来源:origin: org.eclipse.jetty/jetty-security
response.sendError(HttpStatus.FORBIDDEN_403,"!Secure");
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
@Override
public void sendError(int sc) throws IOException
{
if (sc == 102)
sendProcessing();
else
sendError(sc, null);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
@Override
public void sendError(int sc) throws IOException
{
if (sc == 102)
sendProcessing();
else
sendError(sc, null);
}
代码示例来源:origin: org.eclipse.jetty/server
public void sendError(int sc) throws IOException
{
if (sc==102)
sendProcessing();
else
sendError(sc,null);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public void sendError(int sc) throws IOException
{
switch (sc)
{
case -1:
_connection.getEndPoint().close();
break;
case 102:
sendProcessing();
break;
default:
sendError(sc,null);
break;
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
public void sendError(int sc) throws IOException
{
switch (sc)
{
case -1:
_connection.getEndPoint().close();
break;
case 102:
sendProcessing();
break;
default:
sendError(sc,null);
break;
}
}
代码示例来源:origin: jenkinsci/winstone
protected void sendError(int code, String reason)
{
try
{
_response.sendError(code, reason);
}
catch (Throwable x)
{
if (LOG.isDebugEnabled())
LOG.debug("Could not send error " + code + " " + reason, x);
}
finally
{
_state.errorComplete();
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
public void sendError(int sc) throws IOException
{
switch (sc)
{
case -1:
_connection.getEndPoint().close();
break;
case 102:
sendProcessing();
break;
default:
sendError(sc,null);
break;
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
public void sendError(int sc) throws IOException
{
switch (sc)
{
case -1:
_connection.getEndPoint().close();
break;
case 102:
sendProcessing();
break;
default:
sendError(sc,null);
break;
}
}
代码示例来源:origin: stackoverflow.com
private static String API_PACKAGE = "package where TestRESTService class";
public static final URI BASE_URI = UriBuilder
.fromUri("http://localhost/")
.port(8000)
.build();
private static HttpServer initServer() throws IOException {
System.out.println("Starting grizzly... " + BASE_URI);
HttpServer httpServer = GrizzlyServerFactory.createHttpServer(BASE_URI, new HttpHandler() {
@Override
public void service(Request rqst, Response rspns) throws Exception {
rspns.sendError(404);
}
});
// Initialize and register Jersey Servlet
WebappContext context = new WebappContext("GrizzlyContext", "/");
ServletRegistration registration = context.addServlet(
ServletContainer.class.getName(), ServletContainer.class);
registration.setInitParameter(ServletContainer.RESOURCE_CONFIG_CLASS,
PackagesResourceConfig.class.getName());
registration.setInitParameter(PackagesResourceConfig.PROPERTY_PACKAGES, API_PACKAGE);
registration.addMapping("/*");
context.deploy(httpServer);
return httpServer;
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
protected void handleOptions(Request request,Response response) throws IOException
{
if (!HttpMethod.OPTIONS.is(request.getMethod()))
response.sendError(HttpStatus.BAD_REQUEST_400);
request.setHandled(true);
response.setStatus(200);
response.getHttpFields().put(HttpHeader.ALLOW,"GET,POST,HEAD,OPTIONS");
response.setContentLength(0);
response.complete();
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
protected void handleOptions(Request request,Response response) throws IOException
{
if (!HttpMethod.OPTIONS.is(request.getMethod()))
response.sendError(HttpStatus.BAD_REQUEST_400);
request.setHandled(true);
response.setStatus(200);
response.getHttpFields().put(HttpHeader.ALLOW,"GET,POST,HEAD,OPTIONS");
response.setContentLength(0);
response.complete();
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
public void handle(HttpChannel connection) throws IOException, ServletException
{
final String target=connection.getRequest().getPathInfo();
final Request request=connection.getRequest();
final Response response=connection.getResponse();
if (LOG.isDebugEnabled())
LOG.debug("{} on {}{}{} {} {}{}{}", request.getDispatcherType(), connection, System.lineSeparator(),
request.getMethod(), target, request.getProtocol(), System.lineSeparator(), request.getHttpFields());
if (HttpMethod.OPTIONS.is(request.getMethod()) || "*".equals(target))
{
if (!HttpMethod.OPTIONS.is(request.getMethod()))
response.sendError(HttpStatus.BAD_REQUEST_400);
handleOptions(request,response);
if (!request.isHandled())
handle(target, request, request, response);
}
else
handle(target, request, request, response);
if (LOG.isDebugEnabled())
LOG.debug("RESPONSE for {} h={}{}{} {}{}{}", target, request.isHandled(), System.lineSeparator(),
response.getStatus(), response.getReason(), System.lineSeparator(), response.getHttpFields());
}
代码示例来源:origin: Nextdoor/bender
public void handle(HttpChannel<?> connection) throws IOException, ServletException
{
final String target=connection.getRequest().getPathInfo();
final Request request=connection.getRequest();
final Response response=connection.getResponse();
if (LOG.isDebugEnabled())
LOG.debug(request.getDispatcherType()+" "+request.getMethod()+" "+target+" on "+connection);
if (HttpMethod.OPTIONS.is(request.getMethod()) || "*".equals(target))
{
if (!HttpMethod.OPTIONS.is(request.getMethod()))
response.sendError(HttpStatus.BAD_REQUEST_400);
handleOptions(request,response);
if (!request.isHandled())
handle(target, request, request, response);
}
else
handle(target, request, request, response);
if (LOG.isDebugEnabled())
LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus()+" handled="+request.isHandled());
}
代码示例来源:origin: jenkinsci/winstone
public void handle(HttpChannel channel) throws IOException, ServletException
{
final String target=channel.getRequest().getPathInfo();
final Request request=channel.getRequest();
final Response response=channel.getResponse();
if (LOG.isDebugEnabled())
LOG.debug("{} {} {} on {}", request.getDispatcherType(), request.getMethod(), target, channel);
if (HttpMethod.OPTIONS.is(request.getMethod()) || "*".equals(target))
{
if (!HttpMethod.OPTIONS.is(request.getMethod()))
response.sendError(HttpStatus.BAD_REQUEST_400);
handleOptions(request,response);
if (!request.isHandled())
handle(target, request, request, response);
}
else
handle(target, request, request, response);
if (LOG.isDebugEnabled())
LOG.debug("handled={} async={} committed={} on {}", request.isHandled(),request.isAsyncStarted(),response.isCommitted(),channel);
}
内容来源于网络,如有侵权,请联系作者删除!