I tried using a filter. But Maverick is very good at doing
transformations (XSLT and Velocity).
To put it in another way: I can do a transformation transparantly by
pointing to an url...
So, what I would like to do, is actually processing *all* requests (also
to external HTML sources) and include them in my pages with *my*
look-and-feel.
Thanks to you guys (Eelco Hillenius + Jeff Schnitzer), I tried the
following successfully:
I made a servlet filter that redirects to a maverick command, lets call
it HTML2M.m (mmmmm!).
All *.html request are mapped to that filter. The filter takes the
address and appends it as
a parameter to the maverick command:
public void doFilter(ServletRequest request, ServletResponse
response, FilterChain filterChain) {
//... maverickCommand set previously to "HTML2M.m" ...
try {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
res.sendRedirect(
req.getContextPath() + "/" + maverickCommand +
"?target=" +
req.getRequestURL().toString());
} catch (IOException ex) {
//...
}
//... chain filter ...
}
So I can do the following:
1. Type some url in my browser, say http://localhost/MyPage.html
2. This is filtered and forwarded to the maverick command as
http://localhost/HTML2M.m?target=http://localhost/MyPage.html
3. A view is selected and precessed normally: i can take the $target and
include it in my page
(I used JSTL c:import but plan to move to jakarta scrape). Lets call
this page WrapURL.jps
4. Process this result further (transformations) in maverick:
<command name="HTML2M">
<view type="document" path="WrapURL.jsp">
<!--transform type="xslt" path="StripHTML.xsl"/-->
</view>
</command>
The transform could be used to select parts of the HTML in step3, or to
strip out styling stuff, or whatever. I could also use the XML features
of JSTL but I do not want to do that. I prefer Maverick for obvious
reasons ;-)
>Hmmmmm. Why not create a Filter to do that? It seems more natural
than
>trying to use Maverick.
>
>Jeff
>> -----Original Message-----
>> Hi,
>> I have a question on doing the following:
>> 1. If a command exists in maverick, execute it
>> 2. If it does not exist, e.g. for MyPage.html then do:
>> a. Load theat page (DocumentView)
>> b. perform any default transformation
>> (e.g. like stripping out any attributes on some tag, using
XSLT)
>> c. Show the transformed document.
>>
>> It seems that two things are missing:
>> 1. Reading in any *.extension command
>> 2. Views need a "path" attribute, but something like path="." (taking
>> the command as a path) does not work.
-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
[INVALID FOOTER]