Merge remote-tracking branch 'origin/jetty-9.3.x' into jetty-9.4.x
This commit is contained in:
commit
9ff37122db
|
@ -18,7 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.embedded;
|
||||
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
||||
public class OneHandler
|
||||
|
|
|
@ -574,6 +574,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
}
|
||||
|
||||
try
|
||||
if (cause instanceof BadMessageException)
|
||||
{
|
||||
_state.onError(failure);
|
||||
}
|
||||
|
@ -595,13 +596,30 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
_response.reset(true);
|
||||
_response.setStatus(code == null ? 500 : code);
|
||||
_response.flushBuffer();
|
||||
}
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
if (x != failure)
|
||||
failure.addSuppressed(x);
|
||||
abort(failure);
|
||||
}
|
||||
|
||||
/** Unwrap failure causes to find target class
|
||||
* @param failure The throwable to have its causes unwrapped
|
||||
* @param targets Exception classes that we should not unwrap
|
||||
* @return A target throwable or null
|
||||
*/
|
||||
protected Throwable unwrap(Throwable failure, Class<?> ... targets)
|
||||
{
|
||||
while (failure!=null)
|
||||
{
|
||||
for (Class<?> x : targets)
|
||||
if (x.isInstance(failure))
|
||||
return failure;
|
||||
failure = failure.getCause();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isExpecting100Continue()
|
||||
|
|
|
@ -27,6 +27,8 @@ import static org.junit.Assert.assertThat;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -86,8 +88,34 @@ public class ErrorHandlerTest
|
|||
default:
|
||||
super.generateAcceptableResponse(baseRequest,request,response,code,message,mimeType);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
server.setHandler(new AbstractHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (baseRequest.getDispatcherType()==DispatcherType.ERROR)
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.sendError(((Integer)request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE)).intValue());
|
||||
return;
|
||||
}
|
||||
|
||||
if(target.startsWith("/charencoding/"))
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.sendError(404);
|
||||
return;
|
||||
}
|
||||
|
||||
if(target.startsWith("/badmessage/"))
|
||||
{
|
||||
throw new ServletException(new BadMessageException(Integer.valueOf(target.substring(12))));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
server.setHandler(new AbstractHandler()
|
||||
{
|
||||
|
|
54
pom.xml
54
pom.xml
|
@ -1373,6 +1373,60 @@
|
|||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>eclipse-sign</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>eclipse-sign</name>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho.extras</groupId>
|
||||
<artifactId>tycho-pack200a-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>pack200-normalize</id>
|
||||
<goals>
|
||||
<goal>normalize</goal>
|
||||
</goals>
|
||||
<phase>package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.cbi.maven.plugins</groupId>
|
||||
<artifactId>eclipse-jarsigner-plugin</artifactId>
|
||||
<version>${cbi-plugins.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho.extras</groupId>
|
||||
<artifactId>tycho-pack200b-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>pack200-pack</id>
|
||||
<goals>
|
||||
<goal>pack</goal>
|
||||
</goals>
|
||||
<phase>package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>8u00</id>
|
||||
<activation>
|
||||
|
|
Loading…
Reference in New Issue