
io.femo.http.drivers.server.HttpMiddlewareHandle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http-jdk7 Show documentation
Show all versions of http-jdk7 Show documentation
An easy to use HTTP API, that supports synchronous and asynchronous execution of HTTP request.
On android only asynchronous driver is supported.
This library has been backported to jdk 7 to retain compatibility with android!
The newest version!
package io.femo.http.drivers.server;
import io.femo.http.*;
import static io.femo.support.jdk7.HttpUtil.joinPaths;
/**
* Created by felix on 4/26/16.
*/
public class HttpMiddlewareHandle implements HttpHandle {
private String path;
private HttpMiddleware httpMiddleware;
@Override
public boolean matches(HttpRequest request) {
if(path != null) {
if(!request.path().equals(path)) {
return false;
}
}
return true;
}
@Override
public boolean handle(HttpRequest request, HttpResponse response) throws HttpHandleException {
httpMiddleware.handle(request, response);
return false;
}
@Override
public void parentPath(String path) {
if(this.path != null)
this.path = joinPaths(path, this.path);
}
@Override
public void prependPath(String path) {
this.path = joinPaths(path, this.path);
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public HttpMiddleware getHttpMiddleware() {
return httpMiddleware;
}
public void setHttpMiddleware(HttpMiddleware httpMiddleware) {
this.httpMiddleware = httpMiddleware;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy