servlets

Servlet filters for abuse prevention? (DoS, spam, etc)

I'm looking for a servlet filter library that helps me secure our web service against unauthorized usage and DDoS. We have "authorized clients" for our web service, so ideally the filter would help detect clients that aren't authorized or behave improperly, or detect multiple people using the same account. Also we need a way to prevent ...

SessionTimeout: web.xml vs session.maxInactiveInterval().

I'm trying to timeout an HttpSession in java. My container is weblogic. Currently, we have our session timeout set in the web.xml file, like this <session-config> <session-timeout>15</session-timeout> </session-config> Now, i'm being told that this will terminate the session (or is it all sessions?) in the 15th minute of use,...

Looking for a Java server tutorial

I'm planning out a Java application that needs to generate HTML pages for a web server. I have never worked with servers before so I'm looking for a tutorial I to follow. Based on my research, it seems like I should use a servlet. It's going to be a pretty lightweight application so I want to distribute the whole thing as a Java Web S...

Can I exclude some concrete urls from <url-pattern> inside <filter-mapping>?

I want some concrete filter to be applied for all urls except for one concrete (i.e. for /* except for /specialpath). Is there a possibility to do that? sample code: <filter> <filter-name>SomeFilter</filter-name> <filter-class>org.somproject.AFilter</filter-class> </filter> <filter-mapping> <filter-name>SomeFilter</filte...

Deploying multiple servlets to a single Tomcat Server

I'm using Eclipse and can get each of my servlets to work independently (using HTTP Client to test) through Eclipse. But the real work is getting them to work at the same time. I'm using Tomcat, but have no idea how to run all three servlets at the same time. They are all mapped properly in the web.xml file. How do I deploy these from E...

I'm looking for a way to have both a servlet and a jax ws listener preferably in the same class

Hi guys , I have a servlet that acts as controller for a jsp pages , and I want this servlet to able to listen to jax ws messages through the Provider interface , this would be an ideal solution. I also tried to have a different class that implements the Provider and with that class to pass messages to my servlet , but also it wasn't su...

How to download a file with Chinese name by using servlet ?

Hi everyone, I have file with its name in japanese and i want to download it by using a request to servlet. When the link is clicked on the browser for file downloading, the name of the file displayed by the browser(firefox in this case) is not japanese but a combination of characters from english charset and also the size of file is sho...

Best way to use welcome file in web application

Hello I have a Tomcat application where I have the choice to list the welcome (or index) page in the web.xml file as follows: <welcome-file-list> <welcome-file>/jsp/user/index.jsp</welcome-file> </welcome-file-list> And use scriptlets to call database methods to populate the page. Or I can use a servlet to call a welcome pag...

Lite protection of a website for private viewing?

Hi, I'm developing a web app. I'd like to be able to let some friends see it, but not others that stumble upon the url. I was going to put a landing page and then a simple password box. Once the correct password is entered, I'd just record it in the session and expose the site as usual for the rest of the time they keep the browser open...

Java JSP/Servlet: how to automatically serve either a .dmg or a .exe file?

What is the correct way to automatically serve either a .dmg or a .exe file depending on the OS/browser the user is using to connect to a Java Webapp? I'd like to do it server side, without having to use any JavaScript. For example if, from an OS X machine, I go to: absolute poker and click on "Download & Play" (it is just an example o...

What is the proper way of handling configurations (database login and passwords, etc.) in a dynamic web project?

I just got my hands on doing dynamic web programming using JSP. What is the proper way to handle the configurations? For example, database name, host, login, and password, and indexing directory in the server, etc. My concern is mostly about the security of the passwords. Currently I hard code the data into the .java files, I don't thin...

doPut() Servlet

I have a question regarding the doPut method in WebdavServlet implementation in Java. If you are not familiar with it, I don't think you need to be. doPut takes in 2 parameters, HttpServletRequest req, and HttpServletResponse resp. Basically, doPut puts a file into your servlet. I have some questions about how it is specifying WHICH ...

Are empty fields in form of JSP null or ""?

Hi, When a form is passed in to a servlet are empty fields "" or null? So for example in a form where you have First name as a field and last name as a field Dean - First Name - Last Name So what is it registered as in the servlet? Thanks in Advance Dean ...

How do I access file in WEB-INF in JSP?

I am using Tomcat. I would like to put the config file in WEB-INF instead of the default root class path which is WEB-INF/classes. Currently I put the config.xml in WEB-INF and use the following relative addressing to locate it: InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream("..//config.xml"); I...

Nice html output of a HashTable

I have a filled HashTable<MyObject>, MyObject contains a number and a String. What I need is the easy way to format the output so that it can be output to a html table and browsed via web-browser. I look for both framework - specific solutions and simple libraries that return a string with wrapped with html tags fi...

How to identify the URL of an Java web application from within?

My Java web application contains a startup servlet. Its init() method is invoked, when the web application server (Tomcat) is started. Within this method I need the URL of my web application. Since there is no HttpServletRequest, how to get this information? ...

Storing user specific data in java servlet?

A majority of my work has all been in .net, but this project was required to be done in java. So I have a question on handling session data. In .net, I would just do HttpContext.Session.Current in my classes and I would have access to the session data. But it looks like in java, I need to pass around the HttpSession object so I can d...

Java MIDlet and Servlet

Hi I am currently developing a MIDlet that plays Black Jack with a server. The MIDlet itself only sends out the following string signals:"wage amount","deal","hit",and "stand" to the dealer which is the server. Then the server deals with all the game logic and betting system. When the MIDlet receives response from the server, it will di...

Does spring mvc have response.write to output to the browser directly?

I am using spring mvc with freetemplate. In asp.net, you can write straight to the browser using Response.Write("hello, world"); Can you do this in spring mvc? ...

Convert a JSP contained in a String to a Servlet programatically

Hi there, I have a JSP in a string variable in a servlet and I would like to compile it as a JSP myself (on the fly, programatically). Right now what I am doing is saving the string to a file and accessing that file (which generates the resulting servlet) - something like: // and He created JSP from mere html code final String jsp = c...