Fixed compile errors by transferring more of the changes to this new branch. Previous upload doesn't compile.
This commit is contained in:
@@ -7,13 +7,22 @@ import com.foundation.web.WebApplication.PathSubstitution;
|
|||||||
import com.foundation.web.interfaces.IConnectionContext;
|
import com.foundation.web.interfaces.IConnectionContext;
|
||||||
import com.foundation.web.interfaces.IRequest;
|
import com.foundation.web.interfaces.IRequest;
|
||||||
import com.foundation.web.interfaces.IResponse;
|
import com.foundation.web.interfaces.IResponse;
|
||||||
|
import com.foundation.web.interfaces.ISession;
|
||||||
|
|
||||||
public class DefaultResourceRequestHandler extends ResourceRequestHandler {
|
public class DefaultResourceRequestHandler extends ResourceRequestHandler {
|
||||||
private IHashMap nameSubstitutionMap = new LiteHashMap(10);
|
private IHashMap nameSubstitutionMap = new LiteHashMap(10);
|
||||||
private IHashMap pathSubstitutionMap = new LiteHashMap(10);
|
private IHashMap pathSubstitutionMap = new LiteHashMap(10);
|
||||||
|
/**
|
||||||
|
* DefaultResourceRequestHandler constructor.
|
||||||
|
*/
|
||||||
public DefaultResourceRequestHandler() {
|
public DefaultResourceRequestHandler() {
|
||||||
|
|
||||||
}//DefaultResourceRequestHandler()//
|
}//DefaultResourceRequestHandler()//
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.foundation.web.ResourceRequestHandler#processWebSocketUpgrade(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void processWebSocketUpgrade(IRequest request, IResponse response, ISession session, boolean isSecure, boolean clientHadBadSession, IConnectionContext connectionContext, String connection, String secWebSocketKey, String secWebSocketProtocol, String secWebSocketVersion, String origin) {
|
||||||
|
response.setError(IResponse.ERROR_UPGRADE_REJECTED);
|
||||||
|
}//processWebSocketUpgrade()//
|
||||||
/**
|
/**
|
||||||
* Adds a resource name subtitution mapping where the old resource name will be replaced by the new resource name automatically prior to the request being processed.
|
* Adds a resource name subtitution mapping where the old resource name will be replaced by the new resource name automatically prior to the request being processed.
|
||||||
* @param oldName The old resource name.
|
* @param oldName The old resource name.
|
||||||
|
|||||||
@@ -223,6 +223,11 @@ public String getErrorHeader(int errorCode) {
|
|||||||
public ISession getSession(String sessionId) {
|
public ISession getSession(String sessionId) {
|
||||||
return null;
|
return null;
|
||||||
}//getSession()//
|
}//getSession()//
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.foundation.web.interfaces.IWebApplication#handleWebSocketUpgrade(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void handleWebSocketUpgrade(IRequest request, IResponse response, ISession session, boolean isSecure, boolean clientHadBadSession, IConnectionContext connectionContext, String connection, String secWebSocketKey, String secWebSocketProtocol, String secWebSocketVersion, String origin) {
|
||||||
|
}//handleWebSocketUpgrade()//
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.foundation.web.interfaces.IWebApplication#processRequest(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext)
|
* @see com.foundation.web.interfaces.IWebApplication#processRequest(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -85,4 +85,6 @@ public interface IWebServerApplicationDefaults {
|
|||||||
"<h2>For Apple Safari</h2>" +
|
"<h2>For Apple Safari</h2>" +
|
||||||
"<p>Safari has a built in auto update system, but if you are still having problems you can reinstall it: Go to the <a href='http://www.apple.com/safari/'>Apple Safari</a> website and click the \"Download Now\" link and follow the instructions.</p>" +
|
"<p>Safari has a built in auto update system, but if you are still having problems you can reinstall it: Go to the <a href='http://www.apple.com/safari/'>Apple Safari</a> website and click the \"Download Now\" link and follow the instructions.</p>" +
|
||||||
"</TD></TR></TABLE></BODY></HTML>";
|
"</TD></TR></TABLE></BODY></HTML>";
|
||||||
|
public static final String UPGRADE_FAILED =
|
||||||
|
"Socket upgrade request failed or was rejected.";
|
||||||
}//IWebServerApplicationDefaults//
|
}//IWebServerApplicationDefaults//
|
||||||
@@ -262,6 +262,12 @@ public String getErrorHeader(int errorCode) {
|
|||||||
public ISession getSession(String sessionId) {
|
public ISession getSession(String sessionId) {
|
||||||
return null;
|
return null;
|
||||||
}//getSession()//
|
}//getSession()//
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.foundation.web.interfaces.IWebApplication#handleWebSocketUpgrade(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void handleWebSocketUpgrade(IRequest request, IResponse response, ISession session, boolean isSecure, boolean clientHadBadSession, IConnectionContext connectionContext, String connection, String secWebSocketKey, String secWebSocketProtocol, String secWebSocketVersion, String origin) {
|
||||||
|
//Shouldn't ever get here I don't think.//
|
||||||
|
}//handleWebSocketUpgrade()//
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.foundation.web.interfaces.IWebApplication#processRequest(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext)
|
* @see com.foundation.web.interfaces.IWebApplication#processRequest(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ public ResourceRequestHandler() {
|
|||||||
Debug.log("Failed to read the framework.js file from the framework jar.", e);
|
Debug.log("Failed to read the framework.js file from the framework jar.", e);
|
||||||
}//catch//
|
}//catch//
|
||||||
}//ResourceRequestHandler()//
|
}//ResourceRequestHandler()//
|
||||||
|
/**
|
||||||
|
* Gives the web application a chance to handle the web socket upgrade.
|
||||||
|
*/
|
||||||
|
public abstract void processWebSocketUpgrade(IRequest request, IResponse response, ISession session, boolean isSecure, boolean clientHadBadSession, IConnectionContext connectionContext, String connection, String secWebSocketKey, String secWebSocketProtocol, String secWebSocketVersion, String origin);
|
||||||
/**
|
/**
|
||||||
* Allows the handler to substitute one path for another.
|
* Allows the handler to substitute one path for another.
|
||||||
* @param path The path that was provided by the client.
|
* @param path The path that was provided by the client.
|
||||||
|
|||||||
@@ -642,6 +642,10 @@ public IContent getErrorContent(int errorCode) {
|
|||||||
result = new HtmlContent(TLS_FAILURE);
|
result = new HtmlContent(TLS_FAILURE);
|
||||||
break;
|
break;
|
||||||
}//case//
|
}//case//
|
||||||
|
case IResponse.ERROR_UPGRADE_REJECTED: {
|
||||||
|
result = new HtmlContent(UPGRADE_FAILED);
|
||||||
|
break;
|
||||||
|
}//case//
|
||||||
}//case//
|
}//case//
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -670,10 +674,25 @@ public String getErrorHeader(int errorCode) {
|
|||||||
result = "HTTP/1.1 200 Browser Upgrade Required\r\n";
|
result = "HTTP/1.1 200 Browser Upgrade Required\r\n";
|
||||||
break;
|
break;
|
||||||
}//case//
|
}//case//
|
||||||
|
case IResponse.ERROR_UPGRADE_REJECTED: {
|
||||||
|
result = "HTTP/1.1 100 Socket Upgrade Failed/Rejected\r\n";
|
||||||
|
break;
|
||||||
|
}//case//
|
||||||
}//case//
|
}//case//
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}//getErrorHeader()//
|
}//getErrorHeader()//
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.foundation.web.interfaces.IWebApplication#handleWebSocketUpgrade(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
|
public void handleWebSocketUpgrade(IRequest request, IResponse response, ISession session, boolean isSecure, boolean clientHadBadSession, IConnectionContext connectionContext, String connection, String secWebSocketKey, String secWebSocketProtocol, String secWebSocketVersion, String origin) {
|
||||||
|
if(resourceRequestHandler != null) {
|
||||||
|
resourceRequestHandler.processWebSocketUpgrade(request, response, session, isSecure, clientHadBadSession, connectionContext, connection, secWebSocketKey, secWebSocketProtocol, secWebSocketVersion, origin);
|
||||||
|
}//if//
|
||||||
|
else {
|
||||||
|
response.setError(IResponse.ERROR_UPGRADE_REJECTED);
|
||||||
|
}//else//
|
||||||
|
}//handleWebSocketUpgrade()//
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.foundation.web.interfaces.IWebApplication#processRequest(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext)
|
* @see com.foundation.web.interfaces.IWebApplication#processRequest(com.foundation.web.interfaces.IRequest, com.foundation.web.interfaces.IResponse, com.foundation.web.interfaces.ISession, boolean, boolean, com.foundation.web.interfaces.IConnectionContext)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user