RE: Tomcat Admin Web Interface

2001-06-14 Thread Eric Anderson

Count me in on working on an admin interface for Tomcat.  This along with a
better install/connector config program would go a long way to improve the
overall usability of Tomcat for me.

Having had experience working on server product GUIs, the plan to decide
what goes into the GUI before starting the project is definitely the best
way to go.  Even though there is a considerable amount of planning and
discussion that goes into the GUI requirements sheet, in the end it is
easier to deny unreasonable requests like, "we have this new functionality
two weeks before the release can you incorporate it into the admin
interface?", or "I'd like the GUI to wash and wax my car."  A hard and fast
list of GUI features for each release is essential to keeping the GUI
project manageable

My 2 cents.

Eric


On Thu, 14 Jun 2001, M B wrote:

> Hello All,
> 
> In response to the recent postings regarding Tomcat
> documentation and administration (Re: ~rant~ Docs,
> user list, etc.), I am willing to contribute much
> effort in this area.  In addition to documentation, I
> am particularly interested in helping to build an
> administrative web interface for Tomcat 4.0, something
> similar to JRun Management Console, for example.
> 

That would be awesome!

> Naturally, I want to coordinate my efforts with the
> Tomcat community.  Can anyone please point out where I
> should begin, or who I should contact?  Is there a
> project for this?  The Catalina TODO identifies John
> Shin as volunteer for producing an admin interface,
> but I thought I should email this list before
> contacting him directly.  
> 

He volunteered long, long, ago but I haven't heard anything from him
lately.

As it happens, I've been accumulating a list of functional requirements
for admin capabilities that I'd like to post for discussion.  I'll be
finished with what I'm thinking in the next couple of days.

What I'd like to see us do on issues like this is to discuss and agree on
a functional specs document that is checked in to the CVS repository, and
then start working together on the pieces.  It's a little more formal than
the usual :-) open source approach, but I think it will help in the long
run.  Does that sound like a useful plan?

> Thanks,
> Matt
> 

Craig



"[Patch]" for Bug 372

2001-06-04 Thread Eric Anderson

Hello all,

This is the first time I've submitted a patch to an open source project, so
please be gentle. As a new comer I chose something silly to repair.
Basically in 3.2 the bean that shows the example jsp source is broken.  I
made it possible to display jsp and html files that sit in a readable
directory of a Tomcat web application context.I also added color to the
code for easy reading.  Dumb, I know.  But I thought it was a good slow
start.  

I've attached the .java file to replace the old one.  Below is the diff.

Thanks

Eric

--- ShowSourceNew.java  Sun Jun  3 21:16:11 2001
+++ ShowSource.java Wed May 16 19:59:42 2001
@@ -1,15 +1,18 @@
 package examples;
 
+
 import javax.servlet.*;
 import javax.servlet.jsp.*;
 import javax.servlet.jsp.tagext.*;
+
 import java.io.*;
-import java.util.*;
 
 /**
  * Display the sources of the JSP file.
  */
-public class ShowSource extends TagSupport {
+public class ShowSource
+extends TagSupport
+{
 String jspFile;
 
 public void setJspFile(String jspFile) {
@@ -17,54 +20,32 @@
 }
 
 public int doEndTag() throws JspException {
-   if ((jspFile.indexOf( ".." ) >= 0) ||
(jspFile.toUpperCase().indexOf("/WEB-INF/") != -1) ||
(jspFile.toUpperCase().indexOf("/META-INF/") != -1)) throw new
JspTagException("Invalid JSP file " + jspFile);
+   if ((jspFile.indexOf( ".." ) >= 0) ||
+(jspFile.toUpperCase().indexOf("/WEB-INF/") != 0) ||
+(jspFile.toUpperCase().indexOf("/META-INF/") != 0))
+   throw new JspTagException("Invalid JSP file " + jspFile);
+
+InputStream in
+= pageContext.getServletContext().getResourceAsStream(jspFile);
+
+if (in == null)
+throw new JspTagException("Unable to find JSP file: "+jspFile);
+
+InputStreamReader reader = new InputStreamReader(in);
+   JspWriter out = pageContext.getOut();
 
-   JspWriter out = pageContext.getOut();
 
-   try {
-   
-   File f = new
File(pageContext.getServletContext().getRealPath(jspFile));
-   FileReader in = new FileReader(f);
-   if (in == null) throw new JspTagException("Unable to
find JSP file: "+jspFile);
-   int size = (int)f.length();
-   char[] data = new char[size];
-   int chars = 0;
-   while (chars < size){
-   chars += in.read(data, chars, size - chars);
-   }
-   out.println("");
-   for (int i=0; i < chars ; i++) {
-   if (data[i] == '<' && data [i+1] == '!' &&
data [i+2] == '-'){
-   out.print("'){
-   out.print("-->");
-   i = i + 3;
-   }
-   if (data[i] == '<' && data[i+1] == '%'){
-   out.print("<%");
-   i++;
-   }
-   else if (data[i] == '%' && data[i+1] ==
'>'){
-   out.print("%>");
-   i++;
-   }
-   else if (data[i] == '<'){
-   out.print("<");
-   }
-   else if (data[i] == '>'){
-   out.print(">");
-   }
-   else if (data[i] == '\n'){
-   out.println("");
-   }
-   else
-   out.print(data[i]);
-   }
+try {
+out.println("");
+out.println("");
+for(int ch = in.read(); ch != -1; ch = in.read())
+if (ch == '<')
+out.print("<");
+else
+out.print((char) ch);
+out.println("");
 out.println("");
-} 
-   catch (IOException ex) {
+} catch (IOException ex) {
 throw new JspTagException("IOException: "+ex.toString());
 }
 return super.doEndTag();


 ShowSource.java