servlets

Date or String declaration in a javabean

Should I declare an attribute in a javabean that holds a date value a user types in on an HTML form as a String or Date? I feel I should declare as a Date, however, since I do server validation on all form data, if the date doesn't validate, when I pass the form bean back to the jsp view for correcting, I lose the date value that the ...

Setting httponly in JSESSIONID cookie (Java EE 5)

I'm trying to set the httponly flag on the JSESSIONID cookie. I'm working in Java EE 5, however, and can't use setHttpOnly(). First I tried to create my own JSESSIONID cookie from within the servlet's doPost() by using response.setHeader(). When that didn't work, I tried response.addHeader(). That didn't work either. Then, I learned...

iphone application communicating with a java servlet on a WebSphere.

Hello, Here is a Generic question: I wish to build an iPhone application that will communicate with a Java Servlet installed in a webSphere, my iPhone application will ask the servlet to perform some SQL queries in the connected DB, and will receive the answers accordingly. Please help to understand the following questions: How shou...

How to invoke a Servlet (doGet) in a web application on startup?

I need to invoke a Servlet on application startup since it contains some application initialization logic. I know I can set load-on-startup configuration, but this will only invoke Servlet’s init method. I need to invoke a doGet method and pass some Url parameters to it. Servlet doGet method expects ServletRequest and ServletResponse o...

HTTP method GET is not supported by this URL

Hi, I'm calling servlets which has implemented CometProcessor interface, and whenever I try to call the servlets with get request, I'm getting the above error. May I know the reason? public class ChatServlets extends HttpServlet implements CometProcessor { public void event(CometEvent event) throws IOException, ServletExce...

question on regular servlets within GWT (working in dev mode ,not working in deployment in tomcat)

Hello guys, i am having trouble with my web application developed in GWT. the application allows users to upload and download using an upload servlet and a download servlet, the upload servlet was created using the gwtUpload library. the download servlet is using regular HTTPServlet. when i run the application within eclipse the downl...

How to call read event by using post request

Hello, I'm trying to call read event by sending post request to servlets in Tomcat. The code which I'm using in client side is in jquery $.post('just.do',{username:value},function(data){ $('#div').html(data); } ); but whenever I make a post request I get a response "Oh no" of begin event. I've not closed any connection in...

Spring MVC, forward

Is there any difference between public class Controller1 extends AbstractController { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { return new AnotherController().handleRequest(request, response); } } and @Controller...

Is this the right way to have "global" parameters for my servlets?

If I have: <context-param> <param-name>SomeParam</param-name> <param-value>SomeValue</param-value> </context-param> in my web.xml, is this the servlet way of specifying options ( like in the way a config file is used ) , or am I doing something wrong? I know about init-param that can be specified for a servlet, but I'd lik...

What's the right way of configuring the path to a sqlite database for my servlets to use?

I'm using SQLite as my database, and I'm a little bit confused about how I'd configure the path to it. Basically, I have a static String in one of my classes ( which, after initialization turns to something like this ): private static String DATABASE = "db/my.db"; The folder db is located directly under WebContent, so, to get access t...

How to run a service at a specific time using JSP/Servlets app?

Hi, I'm developing JSP/Servlets App,and I want to execute a service at a specific time , for example : For each day at 10:00 AM , delete any attachment from the "attachment" table in the database where column X== NULL. How can I do this in JSP/Servlets application ? I use Glassfish as a server . ...

ETag in Spring (ShallowEtagHeaderFilter)

Hi guys, I've followed http://static.springsource.org/spring/docs/3.0.2.RELEASE/spring-framework-reference/html/mvc.html#mvc-etag and put ShallowEtagHeaderFilter in my web.xml like this: <filter> <filter-name>etagFilter</filter-name> <filter-class>org.springframework.web.filter.ShallowEtagHeaderFilter</filter-class> </filter> ...

Handling unexpected end of requests in servlets

Hi, I am currently developing a REST web service with Jersey / Tomcat (but a generic Servlet/Container answer is welcome). If the client does some GET requests on services that return large amount of data, from a MySQL connection. To avoid any OOM exception, I use a streaming mode for MySQL. However, if the client aborts the request ...

ServletContext getResource not working

I'm trying to use ServletContext.getResource to retrieve a java.net.url reference to an image file (which I will then include in a PDF library using iText). When I use ServletContext.getRealPath("picture.jpg"), I get back a string URL. However, getResource always returns null. Example 1: String picture = ServletContext.getRealPath("pic...

Visualization api - hide data from displaying on browser using servlet

Generally the servlet extends httpservlet but in the code below the servlet extends DataSourceServlet and the page is created like this The text begins with google.visualization.Query.setResponse and ends with {c:[{v:'Bob'},{v:'Jane'}]}]}}); on the browser code: http://code.google.com/apis/visualization/documentation/dev/dsl_csv.html...

How to implement Flex front end with back ends of Java hibernate and JPA?

Hi guys I have a designed a back end solution with Java Hibernate and JPA. Now I want to implement it with Flex front end. How shall I do it? Is it possible without using BladeDS? Just using Servlet or something? Please guide Thanks ...

Can a plain servlet be configured as a seam component?

I created a plain servlet within a seam-gen (2.1.2) application, now I would like to use injection. Thus I annotated it with @Name and it's recognized as component: INFO [Component] Component: ConfigReport, scope: EVENT, type: JAVA_BEAN, class: com.mycompany.servlet.ConfigReport Unfortunatly the injection of the logger doesn't ...

Servlet File Upload Memory Consumption

Hi, I'm using a servlet to do a multi fileupload (using apache commons fileupload to help). A portion of my code is posted below. My problem is that if I upload several files at once, the memory consumption of the app server jumps rather drastically. This is probably OK if it were only until the file upload is finished, but the app s...

RESTlet startup initialization deprecated?

I'm trying to use the restlet.org library to build a RESTful web interface, and I've noticed that unlike it's servlet counterpart, it has no complement to GenericServlet.init(). Short of building another servlet to do my startup logic, is there any built-in way to avoid building my database factories and the like on the first request ...

How to stop Spring MVC blocking all other Servlets?

Hi, I'm using Spring 2.5 MVC and wan't to add another third-party Servlet. The Problem is, that Spring MVC catches all request, so the Servlet isn't getting any request. Here a web.xml Snippet: <servlet> <servlet-name>SpringMVC</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <l...