[英]Java servlet application running behind squid proxy on windows
[英]Running Proxy servlet on Openshift
此應用程序http://bit.ly/1vNUIsU最初與Openshift一起使用,刪除了該應用程序后,重新創建,但現在不再起作用,非常奇怪。 相同的代碼以前工作過。 不知道發生了什么。
無論如何,我已經嘗試了一切, rhc app-tidy
和rhc tail
但是應用程序一直在加載
Error 503 when accessed.
我不確定問題是否出在之前的Restlet上。 以防萬一,Openshift的Restlet可能是什么問題?
碼:
public class FirstStepsApplication extends Application {
private static final String ROOT_URI = "/";
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
Redirector proxy = new Redirector(getContext(), Constants.root,
Redirector.MODE_SERVER_OUTBOUND){
@Override
public void handle(Request request, Response response) {
String path = request.getResourceRef().getHostIdentifier() +
request.getResourceRef().getPath();
try {
URL url = new URL(path);
String host = url.getHost();
String pathParts = url.getPath();
if(pathParts.isEmpty() || pathParts.equals(ROOT_URI)){
pathParts = "/index.html";
}
String targetPattern = Constants.root + host + pathParts;
System.out.println("Target URL = " + targetPattern);
this.setTargetTemplate(targetPattern);
} catch (MalformedURLException e){
e.printStackTrace();
}
super.handle(request, response);
}
};
getConnectorService().getClientProtocols().add(Protocol.HTTP);
router.attachDefault(proxy);
return router;
}
}
此代碼以前與Opensift / JBoss一起使用。 不,它不會。
我設法使其與Tomcat 7 Cartridge而不是JBoss / Capedwarf一起使用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.