servlets

RequestDispatcher forward between Tomcat instances

Deadly 提交于 2020-01-12 05:44:06
问题 I have a scenario where I have single entry point Servlet and further Servlets that requests are forwarded to that undertake heavy processing. I am looking at options to distribute this load and I would like to know if it is possible using Tomcat or another platform to forward requests between Servlets sitting on different servers using a cluster type configuration or similar. I have found some documentation on clustering Servlets and Tomcat but none indicate if Servlet request forwarding is

Where is the servlet jar file on JBoss 5.0.1?

旧街凉风 提交于 2020-01-12 05:42:05
问题 Hi All: I'm trying to set up my build file to be run for deployment on JBossAS 5.0.1, and I need to find the servlet jar file that I should use for the build.. All of the web pages I've looked at seem to indicate that the file is javax.servlet.jar and it should be in the C:\< install dir >\server\default\lib directory. I'm looking in this (and every other directory I can think of), but this file cannot be found. I'm either going crazy, have a wonky jboss install, or have bad info. Would

Where are the Java HttpSession attributes stored?

痴心易碎 提交于 2020-01-12 04:16:11
问题 Are the objects serialized and sent to the user and back on each connection (stored in cookies) ? Or are they stored in the server heap and the cookie is only a very small identifier ? Any information about this topic would be helpful. Thank you 回答1: You got it on the second guess. The cookie contains a JSESSIONID. That id is used to look up the user's HttpSession in a map that the server maintains. At least this is the most common way. There are more intricate ways that the server can

Where are the Java HttpSession attributes stored?

人走茶凉 提交于 2020-01-12 04:16:10
问题 Are the objects serialized and sent to the user and back on each connection (stored in cookies) ? Or are they stored in the server heap and the cookie is only a very small identifier ? Any information about this topic would be helpful. Thank you 回答1: You got it on the second guess. The cookie contains a JSESSIONID. That id is used to look up the user's HttpSession in a map that the server maintains. At least this is the most common way. There are more intricate ways that the server can

Manage Session when broswer has disable cookies

柔情痞子 提交于 2020-01-12 03:42:09
问题 I wants to know that How can i Manage Session if the client browser has disabled cookie feature.. If I wants to implement it in simple JSP - Servlet, then how can I do that ? Thanks in advance... 回答1: In the JSP side, you can use JSTL's <c:url> for this. <a href="<c:url value="page.jsp" />">link</a> Easy as that. It will automagically append the jsessionid when cookies are disabled. In the Servlet side you need HttpServletResponse#encodeURL() or -usually the preferred one inside Servlets-

How can one read a text file in a Struts 2 app [duplicate]

倾然丶 夕夏残阳落幕 提交于 2020-01-12 03:41:09
问题 This question already has answers here : Where to place and how to read configuration resource files in servlet based application? (6 answers) Closed 3 years ago . Developing a Struts 2 app I run in a following problem. I need to read a text file that is deployed in web server with my app. How can I access it knowing its relative path. In other words how can I find absolute path if I know relative path inside the deployed directory. When I had similar problem with servlets I used to use this

What's the purpose of async-supported in web.xml?

五迷三道 提交于 2020-01-11 18:21:43
问题 <servlet> <description>xxx</description> <servlet-name>xxx</servlet-name> <servlet-class>com.xxx.yyy</servlet-class> <async-supported>true</async-supported> </servlet> What's the purpose of async-supported in the servlet's web.xml configuration file? What case I can use it in? 回答1: Ironically, I was looking for the syntax of how to write this property in tomcat's web.xml and this is the first search item I opened from google - it's written correctly too (it works), so thanks. To answer your

What's the purpose of async-supported in web.xml?

会有一股神秘感。 提交于 2020-01-11 18:21:14
问题 <servlet> <description>xxx</description> <servlet-name>xxx</servlet-name> <servlet-class>com.xxx.yyy</servlet-class> <async-supported>true</async-supported> </servlet> What's the purpose of async-supported in the servlet's web.xml configuration file? What case I can use it in? 回答1: Ironically, I was looking for the syntax of how to write this property in tomcat's web.xml and this is the first search item I opened from google - it's written correctly too (it works), so thanks. To answer your

Servlet response write vs print? Which is better?

一个人想着一个人 提交于 2020-01-11 13:36:31
问题 I am having a string which needs to be sent as response from a servlet & I am having two approaches to send response back from it. First is using PrintWriter. response.getWriter().print(responseString); Second is using OutputStream. byte[] byteResponse = responseString.getBytes(Charset.forName("UTF-8")); response.getOutputStream().write(byteResponse); I want to know which is better and efficient way of sending response? Please suggest. 回答1: Use an OutputStream for binary data, and a Writer

How to forcibly create a new session in Java Servlets

点点圈 提交于 2020-01-11 13:12:26
问题 I am storing session ids in database at log in time. The problem I am facing is that if a different user logs in after first one, same session is entered in DB and welcome username still reflects the name of the one who logged in first on the same machine. I want to create a new session id each time a user logs in, but somehow my code doesn't work. HttpSession session = request.getSession(); String sessionID; request.getSession(true); sessionID = session.getId(); Note: the above code is