servlets

How does debug level (0-99) in the Tomcat server.xml affect speed?

The server.xml which controls the startup of Apache Tomcat's servlet container contains a debug attribute for nearly every major component. The debug attribute is more or less verbose depending upon the number you give it, zero being least and 99 being most verbose. How does the debug level affect Tomcat's speed when servicing large nu...

Does Weblogic 9.x support the 2.4 Servlet standard?

Seems like a simple enough question but I can't seem to find the answer. And hey, dead simple questions like this with dead simple answers is what Joel and Jeff want SO to be all about, right? ...

Are writes from within a Tomcat 6 CometProcessor non-blocking

I have a CometProcessor implementation that is effectively doing a Multicast to a potentially large number of clients. When an event occurs that needs propagated to to all the clients, the CometProcessor will need to loop through the list of clients writing out the response. If writing responses block then there is the possibility that...

debug JSP from eclipse

Hi, Does anyone know of a good tool for debugging JSPs from within Eclipse? I'd like to be able to set and watch breakpoints, step through the Java code/tags, etc within Eclipse while the app is running (under JBoss in my case). Presumably it's reasonably straightforward to debug the servlet class that's generated from a JSP, but it's ...

How can I share a variable or object between two or more Servlets?

I would like to know if there is some way to share a variable or an object between two or more Servlets, I mean some "standard" way. I suppose that this is not a good practice but is a easier way to build a prototype. I don't know if it depends on the technologies used, but I'll use Tomcat 5.5 Thanks. I want to share a Vector of obj...

How to map a Servlet to get extra path information with getPathInfo()

I am having an issue where Tomcat is treating extra path information as part of the servlet name. This is breaking a bunch of RESTFul functionality in our webapp (we use extra path info rather than ?name=value pairs for crawler friendly links). It was working correctly before, but it broke after adding explicit mappings and removing th...

Any clever ways of handling the context in a web app?

In Java, web apps are bundled in to WARs. By default, many servlet containers will use the WAR name as the context name for the application. Thus myapp.war gets deployed to http://example.com/myapp. The problem is that the webapp considers its "root" to be, well, "root", or simply "/", whereas HTML would consider the root of your appli...

Servlet for serving static content

I deploy a webapp on two different containers (Tomcat and Jetty), but their default servlets for serving the static content have a different way of handling the URL structure I want to use (details). I am therefore looking to include a small servlet in the webapp to serve its own static content (images, CSS, etc.). The servlet should ha...

Force Https in Websphere 6.1

Hi I was wondering how i can force a user who has requested a page using Http to use the secure https version? I am using Websphere 6.1 as my application server and Rad 7 as my development environment Thanks Damien ...

Handling context-path refs when migrating "/" site to Java EE packaging

An existing Java site is designed to run under "/" on tomcat and there are many specific references to fixed absolute paths like "/dir/dir/page". Want to migrate this to Java EE packaging, where the site will need to run under a context-root e.g. "/dir/dir/page" becomes "/my-context-root/dir/dir/page" Now, the context-root can be easil...

Servlet constructor and init() method

Why do we need an init() method in servlet? Can't we use the constructor to initialization? ...

Protecting internal view layer template pages in servlet applications

I have a very basic question about MVC web applications in Java. Since the olden days of raw JSP up until current technologies like Seam, a very basic pattern has always been the internal dispatch from the controller that initially accepted the request to the view layer that creates the output to be sent to the client. This internal di...

Aborting upload from a servlet

I'd like to limit the size of the file that can be uploaded to an application. To achieve this, I'd like to abort the upload process from the server side when the size of the file being uploaded exceeds a limit. Is there a way to abort an upload process from the server side without waiting the HTTP request to finish? ...

obtaining a requestDispatcher

What is the benefit of using the servletContext as opposed the request in order to obtain a requestDispatcher? servletContext.getRequestDispatcher(dispatchPath) and using argRequest.getRequestDispatcher(dispatchPath) ...

Extending Java Web Applications with plugins

I have this web application that has grown to an unmanageable mess. I want to split it into a common "framework" part (that still includes web stuff like pages and images) and several modules that add extra functionality and screens. I want this refactoring to also be useful as a plugin system for third-party extensions. All modules n...

Track completed downloads from glassfish

I want to be able to track completed downloads served by my glassfish server. I couldn't find a 100 percent correct solution using servlet life cycle listeners. Does anyone have a better idea? ...

Cookie getMaxAge

Hello I can't retrieve cookie maxage it always returns -1 Creating cookie: Cookie securityCookie = new Cookie("sec", "somevalue"); securityCookie.setMaxAge(EXPIRATION_TIME); Retrieve cookie: Cookie[] cookies = request.getCookies(); if (cookies != null) { for(int i=0; i<cookies.length; i++) { Cookie cookie = cookies[i]; ...

How can I include a servlet in a jsp page?

is it possible to include a servlet in a jsp page? if so how? ...

How to determine the order of listeners in web.xml

Hi, I got a bunch of servlet context listeners in my Java webapp, each of them gathering some information about the environment. Some of them depend on information which is gathered by another listener. But I can't determine the order in which the listeners are registered and called, so I have to duplicate code. I understand that the ...

Why does HttpServlet implement Serializable?

In my understanding of Servlet, the Servlet will be instantiated by the Container, his init() method will be called once, and the servlet will live like a singleton until the jvm is shut down. i do not expect my servlet to be serialized, since it will be constructed new when the app server recovers or is starting up normally. the servle...