Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/java/org/joist/publish ProxyModule.java

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

CVS update: joist/java/org/joist/publish ProxyModule.java

Author stack
Full name Michael Stack
Date 2000-10-27 18:12:54 PDT
Message User: stack
  Date: 00/10/27 18:12:54

  Modified: java/org/joist/publish ProxyModule.java
  Log:
  Hard coded string length and assumptions about the query string that don't hold in Helm environment (query always as '&' in it)
  
  Revision Changes Path
  1.6 +47 -3 joist/java/org/joist​/publish/ProxyModule​.java
  
  Index: ProxyModule.java
  ====================​====================​====================​=======
  RCS file: /cvs/joist/java/org/​joist/publish/ProxyM​odule.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ProxyModule.java 2000/10/27 23:49:55 1.5
  +++ ProxyModule.java 2000/10/28 01:12:53 1.6
  @@ -71,6 +71,11 @@
   */
   public class ProxyModule
   {
  + /** debug flag.
  + */
  + public static final boolean debug = true;
  +
  +
       /** default server to connect to */
       private static String SERVER_NAME = "localhost";
       /** default port to connect to */
  @@ -179,6 +184,9 @@
                       "query [req.getQueryString( )] is null" );
               }
           }
  +
  + if( debug )
  + log.debug( "QUERY: " + query );
                   
           try
           {
  @@ -186,11 +194,11 @@
           }
           catch (Exception e)
           {
  - page = query.substring(5, query.indexOf("&"));
  + page = getPageFromQueryStr( query );
           }
           if (page == null)
           {
  - page = query.substring(5, query.indexOf("&"));
  + page = getPageFromQueryStr( query );
           }
   
           // build up the request URL
  @@ -268,8 +276,44 @@
   
           // EXECUTE POST FILTERS!
           NoodleFilterLoader.g​etInstance().doExecu​tePostFilters(noodle​Data);
  + }
  +
  + /** Try to get the page value from the passed in query
  + *
  + * @param inQueryStr Query string we're to pull PAGE_VAR
  + * value from.
  + *
  + * @exception NullPointerException If we can't find
  + * PAGE_VAR value in passed string.
  + */
  + private static String getPageFromQueryStr( String inQueryStr )
  + {
  + String strReturn = null; // PAGE_VAR argument to return
  + int indexStart = -1;
  + int indexEnd = -1;
  +
  + if( inQueryStr == null )
  + throw new NullPointerException( "inQueryStr is null" );
  + indexStart = inQueryStr.indexOf( PAGE_VAR );
  + if( indexStart < 0 ) // A bit of misuse of NullPointerException
  + throw new NullPointerException( "No PAGE_VAR in inQueryStr" );
  + indexStart += PAGE_VAR.length( ); // Put index past PAGE_VAR
  + indexStart += 1; // Put index past the '='
  +
  + // End of PAGE_VAR is at end of string or at first
  + // first occurance past current index of a '&'
  + // -- the query args seperator.
  + //
  + indexEnd = inQueryStr.indexOf( indexStart, '&' );
  + if( indexEnd > 0 )
  + strReturn = inQueryStr.substring( indexStart, indexEnd );
  + else
  + strReturn = inQueryStr.substring( indexStart );
  +
  + return strReturn;
       }
  -
  +
  +
       /**
           this method strips the "page" variable from
           the querystring.

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: joist/java/org/joist/publish ProxyModule.java stack Michael Stack 2000-10-27 18:12:54 PDT
Messages per page: