servlets

Adding external JAR´S to JDK

邮差的信 提交于 2020-01-04 05:08:34
问题 I just started developing online applications using Servlets and JSP. As you may know we need a doPost method which receives HttpServletRequest req,HttpServletResponse res) parameters. My question is the following. I understand I need to import the javax.servlet and javax.servlet.http.* package in order for this to work. I remember once a this crazy teacher who told me I could modify my jdk/jre/lib folder and add those external jar which I would use a lot in order to forget about changing the

Adding external JAR´S to JDK

余生长醉 提交于 2020-01-04 05:08:08
问题 I just started developing online applications using Servlets and JSP. As you may know we need a doPost method which receives HttpServletRequest req,HttpServletResponse res) parameters. My question is the following. I understand I need to import the javax.servlet and javax.servlet.http.* package in order for this to work. I remember once a this crazy teacher who told me I could modify my jdk/jre/lib folder and add those external jar which I would use a lot in order to forget about changing the

TaskQueue failing to do HTTP call - Missing mandatory headers?

可紊 提交于 2020-01-04 04:43:04
问题 Error is in this code: public String getVersion() { String result = null; int index = this.getRequest().getProtocol().indexOf(47); if (index != -1) { result = this.getRequest().getProtocol().substring(index + 1); } return result; } Error is "Couldn't find the mandatory "Host" HTTP header.": 10:34:29,889 INFO [org.restlet] (Thread-6 (HornetQ-client-global-threads-1773619305)) Couldn't find the mandatory "Host" HTTP header. 10:34:29,910 WARNING [org.restlet.Component.Server] (Thread-6 (HornetQ

request.getSession() creating new session after sendRedirect()

耗尽温柔 提交于 2020-01-04 04:41:13
问题 We are developing travel application. Through this flight, Hotel, Bus tickets will be booked. It is product based application. Nearly we have 25 clients(3 clients are using, for remaining still developing). We are maintaining one server for all clients. One server(application) multiple clients is the great achievement in my application. But the problem is every client is having different payment gateways for their money transfer like EBS, HDFC, ICICI, ATOM etc. We have to use sendRedriect()

Is it possible to get a List of all active Sessions?

时光怂恿深爱的人放手 提交于 2020-01-04 04:07:13
问题 When being in a Grails action I can access a HTTPSession with session . Is it also possible to get a list of all active sessions? 回答1: You can use getSessionsInfo() method of ScopesInfoService service of Application Info plugin. First install plugin(in BuildConfig) compile ":app-info:1.0.2"{ excludes 'jquery' } then make an entry in Config grails.plugins.appinfo.useContextListener = true finally inject service and use its getSessionsInfo() method def scopesInfoService ... scopesInfoService

Embedded Jetty does not find Annotated Servlet

假如想象 提交于 2020-01-04 03:50:14
问题 Short: I have a project that provides a war artifact which includes a servlet with annotations but no web.xml. If i try to use the war in jetty i always get only the directory listing of the war content but not the servlet execution. Any idea? Long story: My servlets look like this package swa; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet

Serve a static image file from the filesystem in a servlet?

感情迁移 提交于 2020-01-04 02:44:09
问题 How do I serve an image file in the filesystem from a servlet? 回答1: Have a look over here: Example Depot: Returning an Image in a Servlet Link broken. Wayback Machine copy inserted below: // This method is called by the servlet container to process a GET request. public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { // Get the absolute path of the image ServletContext sc = getServletContext(); String filename = sc.getRealPath("image.gif"); // Get the MIME

How to access the one Web application Context in another Web application Context

╄→гoц情女王★ 提交于 2020-01-04 02:19:36
问题 I have deployed two WAR's in a Tomcat6 server, Say for example WAR-A , WAR-B in Context-A and Context-B respectively. I've stored some data in Context-A , and I want to read that data in Context-B . I have gone through the net and got some way to acheive it. I make the session ID of Context-A available for all the contexts by cookies. And I have set the crossContext = true in server.xml too. But when I do serveltContext.getContext("Context-A"); in Context-B it's returning null . 回答1: The

HttpServletRequest.getRemotePort() returns different port per http request received on same machine?

孤人 提交于 2020-01-04 01:51:53
问题 I need to identify the remote ip and port of the clients that register to my service. Also, when the client web app goes down it un-registers itself from my web service. i am using HttpServletRequest.getRemoteAddress() and HttpServletRequest.getRemotePort() to identify the clients. but the problem is when i test on same machine i get different ports from the same client web app. I am running JAX-WS web service on GlassFish and the Client Web App is also installed on the same container. Also,

HttpServletRequest.getRemotePort() returns different port per http request received on same machine?

南楼画角 提交于 2020-01-04 01:49:07
问题 I need to identify the remote ip and port of the clients that register to my service. Also, when the client web app goes down it un-registers itself from my web service. i am using HttpServletRequest.getRemoteAddress() and HttpServletRequest.getRemotePort() to identify the clients. but the problem is when i test on same machine i get different ports from the same client web app. I am running JAX-WS web service on GlassFish and the Client Web App is also installed on the same container. Also,