简体   繁体   English

在Openshift上运行代理Servlet

[英]Running Proxy servlet on Openshift

This app http://bit.ly/1vNUIsU originally worked with Openshift, after deleting the app, then re-creating, its not working anymore, its very odd. 此应用程序http://bit.ly/1vNUIsU最初与Openshift一起使用,删除了该应用程序后,重新创建,但现在不再起作用,非常奇怪。 The same code worked before. 相同的代码以前工作过。 Not sure what happened. 不知道发生了什么。

In any case, I've tried everything, rhc app-tidy and rhc tail but the app just keeps loading 无论如何,我已经尝试了一切, rhc app-tidyrhc tail但是应用程序一直在加载

Error 503 when accessed. 

I am not sure if the issue is with Restlet as it worked before. 我不确定问题是否出在之前的Restlet上。 What could be the issues of Restlet with Openshift just in case? 以防万一,Openshift的Restlet可能是什么问题?

Code: 码:

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;
    }
}

This code worked with Opensift/JBoss before. 此代码以前与Opensift / JBoss一起使用。 Not it wont. 不,它不会。

我设法使其与Tomcat 7 Cartridge而不是JBoss / Capedwarf一起使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM