[Yanel-dev] Proposal to introduce the webapp protocol

Guillaume Déflache guillaume.deflache at wyona.com
Tue Aug 4 18:34:54 CEST 2009


Hi!

[I actually started writing that on July 28th, but figured I needed more 
hands-on coding before sending it. I think I have stripped all 
now-irrelevant-after-yanelhtdocs-protocol-implementation stuff]

Michael Wechner schrieb:
> Currently various global file locations are hard-coded (like for example 
> the login-screen XSLT)
> 
> src/webapp/src/java/org/wyona/yanel/servlet/security/impl/DefaultWebAuthenticatorImpl.java 
> 
> 
> File xsltLoginScreen = 
> org.wyona.commons.io.FileUtil.file(realmDir.getAbsolutePath(), "src" + 
> File.separator + "webapp" + File.separator + xsltLoginScreenDefault);
>                if (!xsltLoginScreen.isFile()) xsltLoginScreen = 
> org.wyona.commons.io.FileUtil.file(servletContextRealPath, 
> xsltLoginScreenDefault);
> 
> I would suggest that we introduce a "webapp" protocol, whoch would then 
> allow something like
> 
> href="webapp:/xslt/login-screen.xsl"
> 
> (which would be resolved to 
> ..../local/apache-tomcat-5.5.20/webapps/yanel/xslt/login-screen.xsl)
> 
> 
> WDYT?

Several remarks:

0) I wonder what you are referring to by "hardcoded" here, since
xslLoginScreenDefault can also be separately overridden in web.xml, is
it the "src/webapp" prefix?

1) current-realm-to-webapp fallback: consistency and code duplication
1.1) the global resource configs also use the same kind of fallback
($REALM_DIR/src/webapp/path/to/filename.txt or else
$WEBAPP_DIR/path/to/filename.txt) but duplicates the needed code in
http://svn.wyona.com/repos/public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java 

to handle it
1.1) the same fallback is however not used for the error screen: look
for "exception-and-info-screen-xslt" also in YanelServlet: any reason why?
1.3) I wondered if we want to use this fallback for other files; it
might make sense, but I seem to recall Simon saying to me that he
thought this fallback was not a very good idea: Simon, any thoughts
about this?

2) "webapp" protocol:
2.1) would you like the "webapp" protocol to also take care of the
fallback from the realm, or only of the Yanel servlet stuff? ...then
"webapp" name might be misleading
2.2) the way the fallback is implemented now will make it fail for 
unexploded
WARs, but maybe we don't care
2.3) also I wonder what is supposed to happen in the case of the Yanel
command-line? do we still want to support it BTW?
2.4) maybe the name "htdocs" could be use for the realms, but IMHO it 
should
refer only to documents that are also available directly through HTTP:
that's the case for all the other existing and suggested "*htdocs"
protocols that are also mapped under Yanel's reserved prefix

Cheers,
    Guillaume


More information about the Yanel-development mailing list