Re: How to stop JSP access

[email protected] Mon, 30 Jun 2003 18:31:26 +0200
Newsgroups gmane.comp.java.mvc.devel
Message-ID <OF7885D052.8656D335-ONC1256D55.005AA8AE-C1256D55.005AEEE9@diamond.philips.com>
Thanks that works great
jon









[email protected]
2003-06-30 12:40 PM
Please respond to mvc-programmers

 
        To:     [email protected]
        cc:     (bcc: Jon Pallas/EHV/CE/PHILIPS)
        Subject:        Re: [MVC-Programmers] How to stop JSP access
        Classification: 



Put all JSPs under WEB-INF.
NO ONE CAN NOW GET TO THEM, only trough action or servlet.
.V

[email protected] wrote:

Hi All 

What i want to do is make sure that you are logged on before you can 
access any pages 

I have extended the RequestProcessor this works,  but the problem is that people can still point to the .JSP 
pages 


Any tips? 

Thanks 
Jon 

protected boolean processPreprocess(HttpServletRequest request, HttpServletResponse 
response) { 
                boolean continueProcessing = true; 
                HttpSession session = request.getSession(); 
                Object user = session.getAttribute(Constants.USER_KEY); 
                if (user == null) { 
                        ForwardConfig config = 
appConfig.findForwardConfig("login"); 
                        try { 
                                response.sendRedirect(config.getPath()); 
                        } 
                        catch (Exception ex) { 
                                log.error("Problem sending redirect from processPreprocess()"); 
                        } 
                } 
                return continueProcessing; 
        } 

-- 
Vic Cekvenich,
Struts Instructor,
1-800-917-JAVA

Advanced <a href ="baseBeans.com">Struts Training</a> and project recovery 
in North East.
Open Source <a href ="baseBeans.com">Content Management</a>  basicPortal 
sofware
Best practice<a href ="baseBeans.com">Struts Support</a> v.1.1 helper 
ScafflodingXPress