servlets

How to redirect to the login page when the session expires?

こ雲淡風輕ζ 提交于 2020-01-01 03:46:33
问题 I have three JSF 2.0 web modules and I need to redirect to the login page when the session expires. I have tried it using a HttpSessionListener , it is calling the sessionDestroyed() event method, but I am not able to forward/redirect the request in there. I think it is becasue there are no HttpServletRequest and HttpServletResponse objects. I also tried it using a PhaseListener , but it results in a "too many redirects" error in the webbrowser. public class SessionListener implements

Cross context communication between two web application deployed on same tomcat server

巧了我就是萌 提交于 2020-01-01 03:41:09
问题 I have two web application, webAppMaster and webAppSlave , deployed in same tomcat server. Now in webAppMaster application, there is a java class, RequestHandler whose processRequest method takes a customObject1 as parameter and returns customObject2 . Now, from RequestCreator class of webAppSlave application, I want to invoke processRequest method of RequestHandler class of webAppMaster application. How this should be done ? Thanks in advance. 回答1: You need to talk between applications as if

Servlet : SEVERE: Allocate exception for servlet

你说的曾经没有我的故事 提交于 2019-12-31 22:26:14
问题 The following stacktrace is what I get when i try to access a servlet, which seems running fine from Tomcat manager. 11 Sep, 2012 11:50:12 AM org.apache.catalina.core.ApplicationContext log INFO: Marking servlet LoginServlet as unavailable 11 Sep, 2012 11:50:12 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Allocate exception for servlet LoginServlet java.lang.Error: Unresolved compilation problems: The import javax.servlet cannot be resolved The import javax.servlet cannot

Servlet : SEVERE: Allocate exception for servlet

最后都变了- 提交于 2019-12-31 22:26:05
问题 The following stacktrace is what I get when i try to access a servlet, which seems running fine from Tomcat manager. 11 Sep, 2012 11:50:12 AM org.apache.catalina.core.ApplicationContext log INFO: Marking servlet LoginServlet as unavailable 11 Sep, 2012 11:50:12 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Allocate exception for servlet LoginServlet java.lang.Error: Unresolved compilation problems: The import javax.servlet cannot be resolved The import javax.servlet cannot

Access file in WebContent folder from a servlet

亡梦爱人 提交于 2019-12-31 22:25:56
问题 I'm trying to generate a PDF document using FOP. The pdf generation code is kept in a servlet and the xsl is in a specific folder in the WebContent folder. How can I access this xsl file by giving a relative path? It works only if I give the complete path in the File object. I need to generate the xml content dynamically. How can I give this dynamically generated xml as the source instead of a File object? Please provide your suggestions. 回答1: To get the path you can just do: String path = s

On the fly LESS compiler for java web app?

你说的曾经没有我的故事 提交于 2019-12-31 12:58:27
问题 I am looking for a way to compile CSS LESS files on the server side on demand during development. For example if the browser makes a request to /assets/css/foo.css I want the server to notice that there is an /assets/css/foo.less file and then to have this file complied and the resulting css returned. I am guessing there must be a LESS servlet somewhere that can do this? I am running tomcat 7 with Spring MVC application How do I configure a Java Web App to do on the fly LESS compilation? 回答1:

On the fly LESS compiler for java web app?

拥有回忆 提交于 2019-12-31 12:57:43
问题 I am looking for a way to compile CSS LESS files on the server side on demand during development. For example if the browser makes a request to /assets/css/foo.css I want the server to notice that there is an /assets/css/foo.less file and then to have this file complied and the resulting css returned. I am guessing there must be a LESS servlet somewhere that can do this? I am running tomcat 7 with Spring MVC application How do I configure a Java Web App to do on the fly LESS compilation? 回答1:

Raw Servlet vs. Spring MVC [closed]

元气小坏坏 提交于 2019-12-31 10:05:16
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . What are the reasons you should build your web application with raw Java Servlets or by using Spring MVC (or any other frameworks)? Are there exceptions when you should avoid Spring MVC, what are the advantages of doing it with Raw Servlets? 回答1: If you're building a really

Raw Servlet vs. Spring MVC [closed]

不羁岁月 提交于 2019-12-31 10:04:07
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . What are the reasons you should build your web application with raw Java Servlets or by using Spring MVC (or any other frameworks)? Are there exceptions when you should avoid Spring MVC, what are the advantages of doing it with Raw Servlets? 回答1: If you're building a really

Forward HttpServletRequest to a different server

♀尐吖头ヾ 提交于 2019-12-31 09:11:11
问题 I got a HttpServletRequest request in my Spring Servlet which I would like to forward AS-IS (i.e. GET or POST content) to a different server. What would be the best way to do it using Spring Framework? Do I need to grab all the information and build a new HTTPUrlConnection ? Or there is an easier way? 回答1: Unfortunately there is no easy way to do this. Basically you'll have to reconstruct the request, including: correct HTTP method request parameters requests headers ( HTTPUrlConnection doesn