Re: Intercepting AuthenticationFilter and dispatching need help !
Fredy, Would you please show us exactly what you do, as I need to do the same sort of thing? I had a version that worked under 3.2, but it fails under Tomcat 4. Thanks Gerry - Original Message - From: Softwareentwicklung Hauschel [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Sent: Thursday, December 27, 2001 8:38 AM Subject: AW: Intercepting AuthenticationFilter and dispatching need help ! Hey, the problem is resolved ;-) It was a conflict between different versions of servlet.jar ;-( Fredy -Ursprngliche Nachricht- Von: Galbayar [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 26. Dezember 2001 01:13 An: Tomcat Users List Betreff: Re: Intercepting AuthenticationFilter and dispatching need help ! try use request.getRemoteUser() // or String auth = request.getHeader(Authorization); String userInfo =auth.substring(6).trim(); BASE64Decoder decoder = new BASE64Decoder(); String NameAndPassword =new String(decoder.decodeBuffer(userInfo)); StringTokenizer stk=new StringTokenizer(NameAndPassword,:); String Name=stk.nextToken(); String Password=stk.nextToken(); - Original Message - From: Softwareentwicklung Hauschel [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Sent: Tuesday, December 25, 2001 17:48 Subject: Intercepting AuthenticationFilter and dispatching need help ! Hey all, i want to check if the user is authenticated. I've read that the Filters are the right place to do that. If the User is not authenticated, so i want to dispatch him to a login page. Does anybody knows how to do that ? I've tryed it in the Filter in this way: ((HTTPServletRequest)servletRequest).getRequestDispatcher( pub/ueberweisung .jsp ).forward( servletRequest, servletResponse ); But there is always an Error compiling the jsp ?! if I call this jsp (plain html) without a filter it works without any problems ? Pleas help Fredy -Ursprngliche Nachricht- Von: Alex Chaffee [mailto:[EMAIL PROTECTED]] Gesendet: Samstag, 22. Dezember 2001 02:24 An: [EMAIL PROTECTED] Betreff: [FAQ] jGuru FAQ Update jGuru maintains FAQs and Forums on Servlets, JSP, and Tomcat (as well as many other Java topics). Here is an automated update on recent postings to Tomcat-related FAQs. Please direct flames and feedback to [EMAIL PROTECTED] . - Alex ++ JavaServer Pages (JSP) FAQ: http://www.jguru.com/faq/JSP Can I make a jsp custom tag to return a value in to a jsp variable.p I want a jsp custom tag to evaluate some condition based on the parameters I pass and return a boolean to the jsp page in a java variable (type boolean).p Can anybody give some sample of the code using similar functionality. brCan we some how use the get methods in the tagHandler in our jsp to retrieve the values? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=593533 Is it possible to invoke customtags onEvents like onClick? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=592466 Here is what I have: P 1. My application is under /opt/tomcat/webapps/myApp br 2. My jsp file is : /opt/tomcat/webapps/myApp/web/test.jsp br It contains; br . . . br lt;% br String configFile=getInitParameter(configFile); br System.out.println(configFIle=+configFile); br %gt; P 3. My web.xml is: /opt/tomcat/webapps/myApp/WEB-INF/web.xml br It contains: lt;web-appgt; br lt;servletgt; br lt;servlet-namegt;testlt;/servlet-namegt; br lt;jsp-filegt;/web/test.jsplt;/jsp-filegt; br lt;init-parametergt; br lt;param-namegt;configFilelt;/param-namegt; br lt;param-valuegt;TOTOlt;/param-valuegt; br lt;/init-parametergt; br lt;/servletgt; br lt;servlet-mappinggt; br lt;servlet-namegt;testlt;/servlet-namegt; br lt;url-patterngt;/web/test.jsplt;/url-patterngt; br lt;/servlet-mappinggt; br lt;/web-appgt; P What am I doing wrong? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=592461 I'm working on the JSP - Tomcat model, I'm using JSPC to pre-compile my JSPs, Is there a way to prevent any new (non pre-compiled) JSPs from being executed (compiled) in tomcat? ie. I do not want any new JSPs , which have not being pre-compiled to be executed via tomcat on the browser, Is there any property/configuration file which I need to change in Tomcat?? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=592460 Why use JSP? All that we can do with scriptlets we can do with JavaScript as well, I think. Can somebody explain? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=590882 We are building a series of JSP pages, each of which is responsible for producing a different area of the screen. Any given screen that the end user sees, therefore, is made up of a number of blocks, each of which has
Intercepting AuthenticationFilter and dispatching need help !
Hey all, i want to check if the user is authenticated. I've read that the Filters are the right place to do that. If the User is not authenticated, so i want to dispatch him to a login page. Does anybody knows how to do that ? I've tryed it in the Filter in this way: ((HTTPServletRequest)servletRequest).getRequestDispatcher( pub/ueberweisung .jsp ).forward( servletRequest, servletResponse ); But there is always an Error compiling the jsp ?! if I call this jsp (plain html) without a filter it works without any problems ? Pleas help Fredy -Ursprüngliche Nachricht- Von: Alex Chaffee [mailto:[EMAIL PROTECTED]] Gesendet: Samstag, 22. Dezember 2001 02:24 An: [EMAIL PROTECTED] Betreff: [FAQ] jGuru FAQ Update jGuru maintains FAQs and Forums on Servlets, JSP, and Tomcat (as well as many other Java topics). Here is an automated update on recent postings to Tomcat-related FAQs. Please direct flames and feedback to [EMAIL PROTECTED] . - Alex ++ JavaServer Pages (JSP) FAQ: http://www.jguru.com/faq/JSP Can I make a jsp custom tag to return a value in to a jsp variable.p I want a jsp custom tag to evaluate some condition based on the parameters I pass and return a boolean to the jsp page in a java variable (type boolean).p Can anybody give some sample of the code using similar functionality. brCan we some how use the get methods in the tagHandler in our jsp to retrieve the values? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=593533 Is it possible to invoke customtags onEvents like onClick? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=592466 Here is what I have: P 1. My application is under /opt/tomcat/webapps/myApp br 2. My jsp file is : /opt/tomcat/webapps/myApp/web/test.jsp br It contains; br . . . br lt;% br String configFile=getInitParameter(configFile); br System.out.println(configFIle=+configFile); br %gt; P 3. My web.xml is: /opt/tomcat/webapps/myApp/WEB-INF/web.xml br It contains: lt;web-appgt; br lt;servletgt; br lt;servlet-namegt;testlt;/servlet-namegt; br lt;jsp-filegt;/web/test.jsplt;/jsp-filegt; br lt;init-parametergt; br lt;param-namegt;configFilelt;/param-namegt; br lt;param-valuegt;TOTOlt;/param-valuegt; br lt;/init-parametergt; br lt;/servletgt; br lt;servlet-mappinggt; br lt;servlet-namegt;testlt;/servlet-namegt; br lt;url-patterngt;/web/test.jsplt;/url-patterngt; br lt;/servlet-mappinggt; br lt;/web-appgt; P What am I doing wrong? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=592461 I'm working on the JSP - Tomcat model, I'm using JSPC to pre-compile my JSPs, Is there a way to prevent any new (non pre-compiled) JSPs from being executed (compiled) in tomcat? ie. I do not want any new JSPs , which have not being pre-compiled to be executed via tomcat on the browser, Is there any property/configuration file which I need to change in Tomcat?? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=592460 Why use JSP? All that we can do with scriptlets we can do with JavaScript as well, I think. Can somebody explain? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=590882 We are building a series of JSP pages, each of which is responsible for producing a different area of the screen. Any given screen that the end user sees, therefore, is made up of a number of blocks, each of which has been generated by a single JSP. The top level JSP calls in the blocks using a jsp:include. We are trying to use the JSP errorPage directive on every JSP to display an error to the user if something goes wrong with any of the blocks, but are finding that we end up with the error page only taking up part of the screen (for the block which had an error), whereas we would like the whole screen to be filled up by the errorPage. In other words - if something goes wrong with any of the blocks that comprise a screen - we would like to display nothing but the error page. What is the best way to do this ? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=590880 ++ Servlets FAQ: http://www.jguru.com/faq/Servlets HttpUtils.parseQueryString is deprecated. What should we use instead ? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=587251 In some web.xml I find DOCTYPE reference of web-app_2_2.dtd,(in Weblogic 5.1 example) in others, of web-app_2.2.dtd (in java pet store). What is the difference between the two DTDs? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=586710 What are the steps that I need to follow to deploy my servlet in WebLogic 6.1? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=586701 How can I suppress the parameters from displaying in the URL? For instance, if I pass in a password, I don't want it to show up in the address bar. http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=586493 ++ Tomcat FAQ: http://www.jguru.com/faq/Tomcat
Re: Intercepting AuthenticationFilter and dispatching need help !
try use request.getRemoteUser() // or String auth = request.getHeader(Authorization); String userInfo =auth.substring(6).trim(); BASE64Decoder decoder = new BASE64Decoder(); String NameAndPassword =new String(decoder.decodeBuffer(userInfo)); StringTokenizer stk=new StringTokenizer(NameAndPassword,:); String Name=stk.nextToken(); String Password=stk.nextToken(); - Original Message - From: Softwareentwicklung Hauschel [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Sent: Tuesday, December 25, 2001 17:48 Subject: Intercepting AuthenticationFilter and dispatching need help ! Hey all, i want to check if the user is authenticated. I've read that the Filters are the right place to do that. If the User is not authenticated, so i want to dispatch him to a login page. Does anybody knows how to do that ? I've tryed it in the Filter in this way: ((HTTPServletRequest)servletRequest).getRequestDispatcher( pub/ueberweisung .jsp ).forward( servletRequest, servletResponse ); But there is always an Error compiling the jsp ?! if I call this jsp (plain html) without a filter it works without any problems ? Pleas help Fredy -Ursprüngliche Nachricht- Von: Alex Chaffee [mailto:[EMAIL PROTECTED]] Gesendet: Samstag, 22. Dezember 2001 02:24 An: [EMAIL PROTECTED] Betreff: [FAQ] jGuru FAQ Update jGuru maintains FAQs and Forums on Servlets, JSP, and Tomcat (as well as many other Java topics). Here is an automated update on recent postings to Tomcat-related FAQs. Please direct flames and feedback to [EMAIL PROTECTED] . - Alex ++ JavaServer Pages (JSP) FAQ: http://www.jguru.com/faq/JSP Can I make a jsp custom tag to return a value in to a jsp variable.p I want a jsp custom tag to evaluate some condition based on the parameters I pass and return a boolean to the jsp page in a java variable (type boolean).p Can anybody give some sample of the code using similar functionality. brCan we some how use the get methods in the tagHandler in our jsp to retrieve the values? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=593533 Is it possible to invoke customtags onEvents like onClick? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=592466 Here is what I have: P 1. My application is under /opt/tomcat/webapps/myApp br 2. My jsp file is : /opt/tomcat/webapps/myApp/web/test.jsp br It contains; br . . . br lt;% br String configFile=getInitParameter(configFile); br System.out.println(configFIle=+configFile); br %gt; P 3. My web.xml is: /opt/tomcat/webapps/myApp/WEB-INF/web.xml br It contains: lt;web-appgt; br lt;servletgt; br lt;servlet-namegt;testlt;/servlet-namegt; br lt;jsp-filegt;/web/test.jsplt;/jsp-filegt; br lt;init-parametergt; br lt;param-namegt;configFilelt;/param-namegt; br lt;param-valuegt;TOTOlt;/param-valuegt; br lt;/init-parametergt; br lt;/servletgt; br lt;servlet-mappinggt; br lt;servlet-namegt;testlt;/servlet-namegt; br lt;url-patterngt;/web/test.jsplt;/url-patterngt; br lt;/servlet-mappinggt; br lt;/web-appgt; P What am I doing wrong? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=592461 I'm working on the JSP - Tomcat model, I'm using JSPC to pre-compile my JSPs, Is there a way to prevent any new (non pre-compiled) JSPs from being executed (compiled) in tomcat? ie. I do not want any new JSPs , which have not being pre-compiled to be executed via tomcat on the browser, Is there any property/configuration file which I need to change in Tomcat?? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=592460 Why use JSP? All that we can do with scriptlets we can do with JavaScript as well, I think. Can somebody explain? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=590882 We are building a series of JSP pages, each of which is responsible for producing a different area of the screen. Any given screen that the end user sees, therefore, is made up of a number of blocks, each of which has been generated by a single JSP. The top level JSP calls in the blocks using a jsp:include. We are trying to use the JSP errorPage directive on every JSP to display an error to the user if something goes wrong with any of the blocks, but are finding that we end up with the error page only taking up part of the screen (for the block which had an error), whereas we would like the whole screen to be filled up by the errorPage. In other words - if something goes wrong with any of the blocks that comprise a screen - we would like to display nothing but the error page. What is the best way to do this ? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=590880 ++ Servlets FAQ: http://www.jguru.com/faq/Servlets HttpUtils.parseQueryString is deprecated. What should we use instead ? http://www.jguru.com/misc/faqtrampoline.jsp?src=notifyEID=587251 In some web.xml