use of org.locationtech.geogig.rest.repository.FixedEncoder in project GeoGig by boundlessgeo.
the class Main method createRoot.
@Override
public Restlet createRoot() {
Router router = new Router() {
@Override
protected synchronized void init(Request request, Response response) {
super.init(request, response);
if (!isStarted()) {
return;
}
request.getAttributes().put(RepositoryProvider.KEY, repoProvider);
}
};
Router repo = new RepositoryRouter();
Router osm = new OSMRouter();
router.attach("/tasks", TaskStatusResource.class);
router.attach("/tasks/{taskId}.{extension}", TaskStatusResource.class);
router.attach("/tasks/{taskId}", TaskStatusResource.class);
router.attach("/osm", osm);
router.attach("/repo", repo);
router.attach("/{command}.{extension}", CommandResource.class);
router.attach("/{command}", CommandResource.class);
org.restlet.Context context = getContext();
// enable support for compressing responses if the client supports it.
// NOTE: restlet 1.0.8 leaves a dangling thread on each request (see
// EncodeRepresentation.getStream()
// This problem is fixed in latest versions (2.x) of restlet. See the javadocs for
// FixedEncoder for further detail
// Encoder responseEncoder = new com.noelios.restlet.application.Encoder(context);
FixedEncoder encoder = new FixedEncoder(context);
encoder.setEncodeRequest(false);
encoder.setEncodeResponse(true);
encoder.setNext(router);
Decoder decoder = new Decoder(context);
decoder.setDecodeRequest(true);
decoder.setDecodeResponse(false);
decoder.setNext(encoder);
return decoder;
}
Aggregations