com.nitorcreations.willow.servers.ElasticsearchProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of willow-servers Show documentation
Show all versions of willow-servers Show documentation
Willow operational servlets and servers
The newest version!
package com.nitorcreations.willow.servers;
import java.net.URI;
import java.net.URISyntaxException;
import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.proxy.ProxyServlet;
@Singleton
public class ElasticsearchProxy extends ProxyServlet {
private static final long serialVersionUID = -1295459728251583300L;
@Override
protected String rewriteTarget(HttpServletRequest request) {
String path = request.getPathInfo();
String query = request.getQueryString();
try {
return new URI("http", null, "localhost", 5240, path, query, null).toString();
} catch (URISyntaxException e) {
return null;
}
}
}