use of org.mortbay.http.HttpException in project wso2-axis2-transports by wso2.
the class JettyEndpoint method setUp.
@Setup
@SuppressWarnings({ "unused", "serial" })
private void setUp(JettyServer server, HttpChannel channel) throws Exception {
this.server = server;
final String path = "/" + channel.getServiceName();
handler = new AbstractHttpHandler() {
public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException {
if (pathInContext.equals(path)) {
JettyEndpoint.this.handle(pathParams, request, response);
request.setHandled(true);
}
}
};
server.getContext().addHandler(handler);
handler.start();
}
use of org.mortbay.http.HttpException in project wso2-axis2-transports by wso2.
the class JettyByteArrayAsyncEndpoint method handle.
@Override
protected IncomingMessage<byte[]> handle(HttpRequest request) throws HttpException, IOException {
byte[] data = IOUtils.toByteArray(request.getInputStream());
logRequest(request, data);
ContentType contentType;
try {
contentType = new ContentType(request.getContentType());
} catch (ParseException ex) {
throw new HttpException(500, "Unparsable Content-Type");
}
return new IncomingMessage<byte[]>(contentType, data);
}
Aggregations