From: Tom E. <tom...@jb...> - 2005-09-15 14:26:55
|
User: telrod Date: 05/09/15 10:26:43 Modified: src/main/org/jboss/remoting/transport/http HTTPServerInvoker.java Log: JBREM-190 - added support for OPTIONS Revision Changes Path 1.15 +25 -1 JBossRemoting/src/main/org/jboss/remoting/transport/http/HTTPServerInvoker.java (In the diff below, changes in quantity of whitespace are not shown.) Index: HTTPServerInvoker.java =================================================================== RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/http/HTTPServerInvoker.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -b -r1.14 -r1.15 --- HTTPServerInvoker.java 15 Sep 2005 08:08:08 -0000 1.14 +++ HTTPServerInvoker.java 15 Sep 2005 14:26:43 -0000 1.15 @@ -22,6 +22,7 @@ import java.net.SocketException; import java.util.HashMap; import java.util.Map; +import java.util.Date; import javax.management.MBeanServer; import javax.management.MBeanServerInvocationHandler; import javax.management.MalformedObjectNameException; @@ -33,6 +34,7 @@ import org.apache.commons.httpclient.NameValuePair; import org.jboss.remoting.InvocationRequest; import org.jboss.remoting.InvokerLocator; +import org.jboss.remoting.Version; import org.jboss.remoting.marshal.MarshalFactory; import org.jboss.remoting.marshal.Marshaller; import org.jboss.remoting.marshal.UnMarshaller; @@ -452,7 +454,29 @@ InvocationRequest request = null; - if(methodType.equals("GET") || methodType.equals("HEAD")) + if(methodType.equals("OPTION")) + { + dataOutput.write("HTTP/1.1 ".getBytes()); + String status = "200 OK"; + dataOutput.write(status.getBytes()); + String server = "Server: JBoss Remoting HTTP Server/" + Version.VERSION; + dataOutput.write(server.getBytes()); + String date = "Date: " + new Date(); + dataOutput.write(date.getBytes()); + String contentLength = "Content-Length: 0"; + dataOutput.write(contentLength.getBytes()); + String pub = "Public: OPTIONS, POST, GET, HEAD"; + dataOutput.write(pub.getBytes()); + String allow = "Allow: OPTIONS, POST, GET, HEAD"; + dataOutput.write(allow.getBytes()); + // content seperator + dataOutput.write(("\r\n" + "\r\n").getBytes()); + + //nothing more to do since do not need to call handler for this one + return keepAlive; + + } + else if(methodType.equals("GET") || methodType.equals("HEAD")) { request = createNewInvocationRequest(metadata, null); } |