You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by NormW <no...@bocnet.com.au> on 2004/03/17 06:11:50 UTC

PATCH jk_worker_status.c jk2_worker_status_service()

Greetings All.
The following link is a patch which I believe simplifies the structure of
the _sevice() function by removing some NULL tests and an If(test) from the
processing stream.
http://www.gknw.com/norm/jk_worker_status.c.diff
The following section shows the structure implemented rather the diff itself
as is the usual case.
By setting a default query_string first, the NULL tests are no loner
required. By doing the common headers first, only one if(qry=) test is
needed.
Norm
--------------------------------------
    if( w->mbean->debug > 0 )
        env->l->jkLog(env, env->l, JK_LOG_DEBUG, "status.service() %s %s\n",
                      JK_CHECK_NULL(uri), JK_CHECK_NULL(s->query_string));

    if( s->query_string == NULL ) {
        s->query_string="all";
    }

    /* Generate the header */
    s->status=200;
    s->msg="OK";
    s->headers_out->put(env, s->headers_out, "Pragma", "no-cache", NULL);
    s->headers_out->put(env, s->headers_out, "Cache-Control", "no-cache",
NULL);

    /** Decide if text or html. */
    if( strncmp( s->query_string, "qry=", 4) == 0 ) {
        s->headers_out->put(env, s->headers_out, "Content-Type",
"text/plain", NULL);
        s->head(env, s );
    } else {
        s->headers_out->put(env, s->headers_out, "Content-Type",
"text/html", NULL);
        s->head(env, s );
        s->jkprintf(env, s, "<style>%s</style>\n", DEFAULT_CSS );
    }

    /** Process the query string.
     */

--------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org