This app http://bit.ly/1vNUIsU originally worked with Openshift, after deleting the app, then re-creating, its not working anymore, its very odd. 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
Error 503 when accessed.
I am not sure if the issue is with Restlet as it worked before. What could be the issues of Restlet with Openshift just in case?
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. Not it wont.
I managed to get it working with Tomcat 7 Cartridge instead of JBoss/Capedwarf