Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

406 Not Acceptable exception mapping #80

Open
namedgraph opened this issue Jul 8, 2023 · 0 comments
Open

406 Not Acceptable exception mapping #80

namedgraph opened this issue Jul 8, 2023 · 0 comments

Comments

@namedgraph
Copy link
Member

When no matching response Variant is found, NotAcceptableExceptionMapper should be invoked and return a 406 Not Acceptable response.
Instead, the ClientErrorExceptionMapper is invoked and causes a 500 Internal Server Error:

curl -k 'https://localhost:4443/sparql?query=select%20*%0A%7B%0A%3Fs%20%3Fp%20%3Fo%0A%7D' -H 'User-Agent: python urllib/3.3.0' -H "Accept: whatever"
<!doctype html><html lang="en"><head><title>HTTP Status 500 – Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 – Internal Server Error</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> Internal Server Error</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><hr class="line" /><h3>Apache Tomcat/10.1.4</h3></body></html>
08-Jul-2023 18:08:40.538 SEVERE [http-nio-7070-exec-10] org.glassfish.jersey.server.ServerRuntime$Responder.processExceptionWithMapper An exception has been thrown from an exception mapper class com.atomgraph.client.mapper.ClientErrorExceptionMapper.
     jakarta.ws.rs.NotAcceptableException: HTTP 406 Not Acceptable
             at com.atomgraph.core.model.impl.Response.<init>(Response.java:90)
             at com.atomgraph.core.model.impl.Response.<init>(Response.java:80)
             at com.atomgraph.client.mapper.ExceptionMapperBase.getResponseBuilder(ExceptionMapperBase.java:77)
             at com.atomgraph.client.mapper.ClientErrorExceptionMapper.toResponse(ClientErrorExceptionMapper.java:38)
             at com.atomgraph.client.mapper.ClientErrorExceptionMapper.toResponse(ClientErrorExceptionMapper.java:29)
             at org.glassfish.jersey.server.ServerRuntime$Responder.processExceptionWithMapper(ServerRuntime.java:592)
             at org.glassfish.jersey.server.ServerRuntime$Responder.mapException(ServerRuntime.java:557)
             at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
             at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:269)
             at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
             at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
             at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
             at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
             at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
             at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
             at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:240)
             at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:697)
             at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
             at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
             at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:357)
             at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:311)
             at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
             at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
             at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:126)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
             at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
             at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
             at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400)
             at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
             at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:859)
             at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1734)
             at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
             at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
             at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
             at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
             at java.base/java.lang.Thread.run(Thread.java:833)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant