Merged branch 'jetty-9.4.x' into 'master'.

This commit is contained in:
Simone Bordet 2016-07-21 18:50:54 +02:00
commit 41315abca3
2 changed files with 23 additions and 21 deletions

View File

@ -379,21 +379,23 @@ public class LocalConnector extends AbstractConnector
}
}
/** Wait for a response using a parser to detect the end of message
/**
* Wait for a response using a parser to detect the end of message
* @return Buffer containing full response or null for EOF;
* @throws Exception
* @throws Exception if the response cannot be parsed
*/
public String getResponse() throws Exception
{
return getResponse(false,30,TimeUnit.SECONDS);
}
/** Wait for a response using a parser to detect the end of message
* @param head
* @param time
* @param unit
/**
* Wait for a response using a parser to detect the end of message
* @param head whether the request is a HEAD request
* @param time the maximum time to wait
* @param unit the time unit of the {@code timeout} argument
* @return Buffer containing full response or null for EOF;
* @throws Exception
* @throws Exception if the response cannot be parsed
*/
public String getResponse(boolean head, long time,TimeUnit unit) throws Exception
{
@ -403,12 +405,13 @@ public class LocalConnector extends AbstractConnector
return null;
}
/** Wait for a response using a parser to detect the end of message
* @param head
* @param time
* @param unit
/**
* Wait for a response using a parser to detect the end of message
* @param head whether the request is a HEAD request
* @param time the maximum time to wait
* @param unit the time unit of the {@code timeout} argument
* @return Buffer containing full response or null for EOF;
* @throws Exception
* @throws Exception if the response cannot be parsed
*/
public ByteBuffer waitForResponse(boolean head, long time,TimeUnit unit) throws Exception
{

View File

@ -40,7 +40,6 @@ import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.server.Dispatcher;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.StringUtil;
@ -137,17 +136,17 @@ public class ErrorHandler extends AbstractHandler
generateAcceptableResponse(baseRequest,request,response,response.getStatus(),baseRequest.getResponse().getReason());
}
/* ------------------------------------------------------------ */
/** Generate an acceptable error response.
/**
* Generate an acceptable error response.
* <p>This method is called to generate an Error page of a mime type that is
* acceptable to the user-agent. The Accept header is evaluated in
* quality order and the method
* {@link #generateAcceptableResponse(Request, HttpServletRequest, HttpServletResponse, String)}
* {@link #generateAcceptableResponse(Request, HttpServletRequest, HttpServletResponse, int, String, String)}
* is called for each mimetype until {@link Request#isHandled()} is true.</p>
* @param baseRequest The base request
* @param request The servlet request (may be wrapped)
* @param response The response (may be wrapped)
* @throws IOException
* @throws IOException if the response cannot be generated
*/
protected void generateAcceptableResponse(Request baseRequest, HttpServletRequest request, HttpServletResponse response, int code, String message)
throws IOException
@ -168,8 +167,8 @@ public class ErrorHandler extends AbstractHandler
baseRequest.setHandled(true);
}
/* ------------------------------------------------------------ */
/** get an acceptable writer for an error page.
/**
* Returns an acceptable writer for an error page.
* <p>Uses the user-agent's <code>Accept-Charset</code> to get response
* {@link Writer}. The acceptable charsets are tested in quality order
* if they are known to the JVM and the first known is set on
@ -183,7 +182,7 @@ public class ErrorHandler extends AbstractHandler
* @param request The servlet request (may be wrapped)
* @param response The response (may be wrapped)
* @return A {@link Writer} if there is a known acceptable charset or null
* @throws IOException
* @throws IOException if a Writer cannot be returned
*/
protected Writer getAcceptableWriter(Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException
@ -223,7 +222,7 @@ public class ErrorHandler extends AbstractHandler
* @param request The servlet request (may be wrapped)
* @param response The response (may be wrapped)
* @param mimeType The mimetype to generate (may be *&#47;*or other wildcard)
* @throws IOException
* @throws IOException if a response cannot be generated
*/
protected void generateAcceptableResponse(Request baseRequest, HttpServletRequest request, HttpServletResponse response, int code, String message, String mimeType)
throws IOException