Thanks for the reply.
I would like to implement this jsp-page (or at least a modification of it)
to solve my "old problem" with the authentication to certain pages of my
intranet-site. I want to use the url that is passed as a key to grant access
to certain pages of my publication.

<%
String s = new String();
String auth = request.getHeader("Authorization");
if (auth == null) {
        response.setStatus(response.SC_UNAUTHORIZED);
        response.setHeader("WWW-Authenticate", "NTLM");
        return;
}
if (auth.startsWith("NTLM ")) {
        byte[] msg = new
sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));
        int off = 0, length, offset;

        if (msg[8] == 1) {
            off = 18;

            byte z = 0;
            byte[] msg1 = {(byte)'N', (byte)'T', (byte)'L', (byte)'M',
(byte)'S',
                            (byte)'S', (byte)'P', z,
                            (byte)2, z, z, z, z, z, z, z,
                            (byte)40, z, z, z, (byte)1, (byte)130, z, z,
                            z, (byte)2, (byte)2, (byte)2, z, z, z, z, //
                            z, z, z, z, z, z, z, z};
            //
            response.setStatus(response.SC_UNAUTHORIZED);
            response.setHeader("WWW-Authenticate", "NTLM "
                  + new sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());
            return;
        }
        else if (msg[8] == 3) {
                off = 30;
                length = msg[off+17]*256 + msg[off+16];
                offset = msg[off+19]*256 + msg[off+18];
                s = new String(msg, offset, length);
                //out.println(s + " ");
        }
        else
                return;

        length = msg[off+1]*256 + msg[off];
        offset = msg[off+3]*256 + msg[off+2];
        s = new String(msg, offset, length);

        //out.println(s + " ");

        length = msg[off+9]*256 + msg[off+8];
        offset = msg[off+11]*256 + msg[off+10];
        s = new String(msg, offset, length);

        }

String lettres = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" ;
s = s.toUpperCase() ;
String compte = "" ;
char c ;
int i = 0 ;
while(i < s.length()) {
        c = s.charAt(i) ;
        if(lettres.indexOf(c) != -1) {
                compte = compte+""+c ;
        }
        i++ ;
}
s = compte;

StringBuffer url = new StringBuffer();
url = url.append ("/servlet/Identification?id=");
url = url.append (s);
%>

<html>
<head>
<title>Lutece</title>
</head>
<body>
<jsp:forward page="<%=url.toString()%>" />
</body>
</html>


Andreas Hartmann wrote:
> 
> Hi,
> 
> jazzhazze schrieb:
>> When a user visit my site I would like to load a custom .jsp page
>> (index.jsp
>> for example) with some script code, before the main Lenya index.html page
>> of
>> my publication is loaded?
> 
> I don't quite understand this - do you want to show this JSP page and 
> then make a redirect to the index.html page?
> 
>> Which files do I have to modify to make that work,
>> how should I modify them, and where should I put the .jsp file ?
> 
> You might try the JSPGenerator:
> 
> http://cocoon.apache.org/2.1/userdocs/jsp-generator.html
> 
> You could either store the JSP page as a Lenya document (with a 
> dedicated resource type like "jsp"), or in the file system (depending on 
> your requirements re. editing and versioning).
> 
> BTW, why do you want to use JSP? Did you already take a look at Cocoon 
> Flow and JX templates?
> 
> -- Andreas
> 
> 
> -- 
> Andreas Hartmann, CTO
> BeCompany GmbH
> http://www.becompany.ch
> Tel.: +41 (0) 43 818 57 01
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-load-a-JSP-page-%22before%22-loading-...-live-index.html-tp17552620p17597834.html
Sent from the Lenya - Users mailing list archive at Nabble.com.


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

Reply via email to