servlets

Where do Spring configuration files go in a maven WAR module?

I've looked at a bunch of sample project and I can't seem to tease out a common best practice. I've seen Spring bean files sometimes go in the web-app/WEB-INF directory. I've seen this in conjunction with with a servlet definition in web.xml like this: <servlet> <servlet-name>my-stuff</servlet-name> <servlet-class>org.springf...

xml properties file location in web java app

Hi, I have a web app in java, and in a servlet I need to load properties from a xml file. The code is XMLReader reader = XMLReaderFactory.createXMLReader(); ... FileInputStream fis = new FileInputStream("myconf.xml"); reader.parse(new InputSource(fis)); My question is: where should the myconf.xml file be placed in the war file...

Is there anything wrong with using private classes in my Java Servlet?

I have Servlet that looks something like this: public class MyServlet extends Servlet { private class Page { private Page(HttpServletRequest request, HttpServletResponse response) { /* Do stuff */ } } protected void doGet(HttpServletRequest request, HttpServletResponse response) { Page page = new Page(request...

view data form database table to table tag in jsp page

I want to apply MVC2 J2EE approach in my work with JSP pages. I want to separate the code in Servlet and design in JSP. The problem I am facing is that I want to display all users and their data from DB table to HTML table in JSP page Now How should I call the servlet from JSP page, since there is no form in display page and I don't kn...

Interacting with objects managed by DWR from JSP

I'm working with Direct Web Remoting (DWR) as part of a 'plain' dynamic Java project (hosted on a Tomcat 6.0 server with Java 6). I have a simple JSP page which interacts with session-level variables within my user's session. However, I also have a session-level object managed by DWR via the 'new' constructor. Is it possible to, from w...

Displaying .gif file in JSP form using Servlet program.

I have written a servlet java program. During the execution of one particular loop of the program, I need the a gif file to be displayed in the JSP form indicating that the process is going on. I am not aware of implementing the same inside the loop. Kindly advise on how the same has to be done, such that a gif file is displayed in th...

C/C++ libraries for HTTP programming

What well known C/C++ libraries are out there that could allow one to implement servlets, or at least provide most of the essentials for dealing with HTTP/CGI protocols such as http headers, error codes, cookies, GET/POST etc. So far I have only found CPPSERV. EDIT: Looking for server side solutions. ...

session management -session not destroying automatically in jsp

Dear all in my application i am maintaining the session using HttpSessionListener public void sessionCreated(HttpSessionEvent se) public void sessionDestroyed(HttpSessionEvent se) If one user close the browse abruptly, the browser's session should be destroyed, but it is not destroying automatically. OS : Linux application : Jboss ...

halt servlet response

Hi to all! I'm facing the following problem. i have a servlet that serves a client request with a video clip. But this video clip is a product of another thread (transcoder). If the clip is not ready to be downloaded because the transcoder thread haven't finished its job, the client request fails! Any suggestions about how to deal with t...

displaying available time slots for reservation in a web application

I am trying to implement a search feature of an instrument reservation table using JDBC and jSP, a reservation is identified by a date and a sequence number of the time slot on that date (if the time slot is 1 hour then there are are 24 possible sequence number) and a number of time slots. now a user should be able to search for the clos...

Detect session timeout in Spring 3/Spring Security 2.0.5

I have a web application running under Spring 3 with SpringSecurity 2.0.5. To present the user the changes to the site since his last visit, I try to register the time when his session is destroyed. Therefore I registered org.springframework.context.ApplicationListener<HttpSessionDestroyedEvent> and also a javax.servlet.http.HttpSessionL...

Tomcat to run a twitter stream monitoring app?

I'm a newbie when it comes to Java for web application stuff, so forgive me if I'm missing something obvious. I'm building an app that uses the Twitter Streaming API and Jtwitter to listen for various tweets, do some database record-keeping, and send out some tweeted replies. The application has no web component, although there will be...

Tomcat 6.x web.xml default and custom servlet routing

I have two servlets defined in the web.xml file, namely the default2 and myservlet. The default2 servlet is used to map the static files like the javascript and css. The myservlet is used for getting dynamic content. <servlet> <servlet-name>default2</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servl...

Stream linearized PDF from servlet to browser (fast web view)

Hi! I'm running a web app that provides a servlet. this servlet opens a pdf file from a Network File System and finally streams it to the requesting browser. All the pdf files are linearized by adobe lifecycle pdf generator and ready for fast web view. unfortunately, the fast web view does not work. I guess it's a problem of how to ope...

Tomcat 6 with servlet 3 spec

Contrary to the documentation, is it possible to use the servlet 3 spec with tomcat 6? ...

Hide JSP page from direct access, but how do you access to the target page?

The URL below, the first content in the chosen answer describes JSP hiding. http://stackoverflow.com/questions/2523430/hidden-features-of-jsp-servlet/2525995#2525995 I so far understand that I can put jsp files under /WEB-INF directory. So that it prevents a user from direct access like http://test.com/WEB-INF/register.jsp (return 404)...

Why won't my Servlet respond to JSON requests in UTF-8?

My Servlet just won't use UTF-8 for JSON responses. MyServlet.java: public class MyServlet extends HttpServlet { protected void doPost(HttpServletRequest req, HttpServletResponse res) throws Exception { PrintWriter writer = res.getWriter(); res.setCharacterEncoding("UTF-8"); res.setContentType("application/json; charse...

How to skip a filter in the filter chain in java

Hi All, I have 2 filters in my application. Based on some condition, I want to choose whether to execute the second filter or not. Is there a way to do this? I did some googling with no success. I want the request to continue without executing the second filter. Is that possible? Any help will be appreciated. ...

Send encripted data from a middlet to a servlet

What the best solution for send encripted data from a middlet to a servlet if I have to send small data in fast manner I try https but the data is inflate, "I don't why" I this moment I have implemented AESLigthEngine with CBC mode (block mode) because CFB mixed mode is slow ...

Get full servlet URL during startup under Tomcat 7

I have a web application written using Tomcat 6 and I'm trying to make it work with Tomcat 7. During its startup the application, besides other things, registers its web service component at some remote directory. For this it needs to supply its own URL. The following (a little bit naive) method should return webservice URL: import org....