Wouldn't be better to subclass this servlet for Oracle? I think you can
specify the servlet class in the goldspike configuration if I'm not
mistaken. Just seems kind of yucky to have Oracle specific hacks in the
main codebase.
--Chris
Sorry if this is a double post, my first attempt bounced cuz it was too long
> Modified:
> trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java
> (772 => 773)
>
> --- trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java
> 2007-10-16 12:32:16 UTC (rev 772)
> +++ trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java
> 2007-10-17 15:20:11 UTC (rev 773)
> @@ -110,12 +110,42 @@
> return cgiClass.newInstance(cgiArgs, Block.NULL_BLOCK);
> }
>
> + /*
> + * This ugly hack is because Oracle servlets doesn't handle URIs like
> + * /people;browse correctly. We need to add this manually.
> + */
> + private String addMissingSemiColonParameterForOracle(String
> requestUriBefore, HttpServletRequest request) {
> + try {
> + java.lang.reflect.Field reqField =
> request.getClass().getField("requestURI");
> + Object reqData = reqField.get(request);
> + byte[] data =
> (byte[])reqData.getClass().getField("data").get(reqData);
> + int offset =
> reqData.getClass().getField("offset").getInt(reqData);
> + int length =
> reqData.getClass().getField("length").getInt(reqData);
> +
> + int p = offset+length;
> + int len = data.length;
> + if(p < len && data[p++] == ';') {
> + int start = p;
> + // Delimited by either ? or a space - possibly not a 100%
> safe
> + while(p < len && data[p] != '?' && data[p] != ' ') {
> + p++;
> + }
> + return requestUriBefore + ";" + new String(data, start,
> p-start);
> + }
> + } catch(Throwable e) {}
> + return requestUriBefore;
> + }
> +
> protected void setupEnvironment(Ruby runtime, HttpServletRequest
> request) {
> RubyHash env = (RubyHash)runtime.getObject().getConstant("ENV");
>
> String requestUri = chomp(request.getRequestURI(), "/");
> if (requestUri.length() == 0) requestUri = "/";
>
> +
> if(request.getClass().getName().indexOf("EvermindHttpServletRequest") != -1) {
> + requestUri = addMissingSemiColonParameterForOracle(requestUri,
> request);
> + }
> +
> // RFC3875 The Common Gateway Interface (CGI) Version 1.1
> setEnv(env, "AUTH_TYPE", request.getAuthType());
> if (request.getContentLength() != -1) {
>
>
> _______________________________________________
> Jruby-extras-devel mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/jruby-extras-devel
>
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel