I'd probably go with a Filter (mapped to '*.js') to do this. I'd rename the
physical something.js files to something.jsp, and the Filter would do
something like:
ServletContext context = null;
public void init(FilterConfig conf) {
context = conf.getServletContext();
}
public void doFilter(ServletRequest req, ServletResponse res, FilterChain
chain)
throws IOException, ServletException {
if( req instanceof HttpServletRequest ) {
HttpServletRequest hReq = (HttpServletRequest)req;
String path = hReq.getPathInfo();
URL file = context.getResource(path);
if(file == null) { // not a physical .js file
String newPath = path + "p"; // Yes, I know it's hacky
RequestDispatcher rd = context.getRequestDispatcher(newPath);
rd.forward(req, res);
return;
}
}
chain.doFilter(req, res);
}
"Adrian Beech" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> G'day folks,
>
> Is it possible to get Tomcat to process a include file and resolve
embedded
> scriptlets if the file is referenced from a client side tag?
> In the two .js files I'm trying to work with there are several scriptlets
> that need to be resolved by Tomcat prior to sending the content along to
the
> browser.
>
> I can use <%@ include file=... %> server side which works just dandy,
> however the resulting content is easily visible to the user if they happen
> to view the source of the currently displayed page. My preference is to
use
>