Here is a quick smattering to do what you want; this is the dofilter for
the cclass you'll write that extends filter.  You'll want to append
stuff at the end... play with it a little and you'll get the idea pretty
quick.    You can alter anything in the body.. but for your case, just
add your meta tag to the end.     




        public void doFilter(ServletRequest request, ServletResponse
response, FilterChain chain) throws IOException, ServletException {
                
                
                HttpServletRequest req = (HttpServletRequest) request;
                HttpServletResponse res = (HttpServletResponse)
response;
                
                
                CharResponseWrapper wrapper = new
CharResponseWrapper((HttpServletResponse)response);
chain.doFilter(request, wrapper);


CharArrayWriter caw = new CharArrayWriter();
                                        String body =
wrapper.toString();
                                        StringBuffer newBody = new
StringBuffer();
                        caw.write(newBody.toString());

        
response.setContentLength(caw.toString().length());
        
response.getWriter().write(caw.toString());
                                        response.getWriter().close();
                                        }



-----Original Message-----
From: MW Mike Weiner (5028) [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 04, 2006 8:05 AM
To: Tomcat Users List
Subject: RE: Tomcat tag question

Well that was my thought as well, just wasn't sure how to go about that.
Any hints?

Thanks
Michael Weiner 


This e-mail and any attachments may contain confidential information
that is legally privileged. The information is solely for the use of the
intended recipient(s); any disclosure, copying, distribution, or other
use of this information is strictly prohibited. If you have received
this e-mail in error, please notify the sender by return e-mail and
delete this message. Thank you.

-----Original Message-----
From: John Powers [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 03, 2006 4:17 PM
To: Tomcat Users List
Subject: RE: Tomcat tag question

Or use a filter to append that <meta> tag onto any response that is
html...

-----Original Message-----
From: Darryl L. Miles [mailto:[EMAIL PROTECTED]
Sent: Monday, April 03, 2006 2:38 PM
To: Tomcat Users List
Subject: Re: Tomcat tag question

MW Mike Weiner (5028) wrote:
> Dear List readers
>  
> Sorry to bother you with what is most likely a silly question, but i 
> have been googling, and found no real answers and was hoping you might

> know. I am doing another Tomcat project and to that end, i need to get

> tomcat to behave in a certain way, namely i need tomcat to add an html

> tag to each page requested, like so:
>  
> <meta name="agmips" value="1.963752">
>  
> where the value is a box identified (bad# good# bad# good# bad# good#)
-
> 672 in this case, actually i would LOVE to be the hostname of the box,

> but can be anything really - even static if it cant be done
dynamically.
> Is this possible? And if so, would you mind sharing the trick with
this
> newbie?
>   

Hmm... Isn't this a job for JSP.  Rename your index.html to index.jsp
and add a new first line of:

<%@ page language="java" %>


Then insert this into the point you want the page output to change:

<meta name="agmips"value="<%=request.getServerName()%>">


Best of luck,
 

-- 

Darryl L. Miles



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to