Questions tagged [servlet-3.0]

Java Servlets 3.0 is a new API that supports extensibility/pluggability, Ease of Development (EoD) using the newer language features, Async and Comet support, Security, and other features being as part of the revision for Java EE 6.

Version 3 of the servlet API adds the following to version 2.5

  • async response
  • multipart support
  • annotation configuration (no web.xml)
  • generics in the API
  • resources (including JSPs) in JARs under META-INF/resources

Links

941 questions
0
votes
1 answer

Android send image with httpPost to a Servlet multipart

I try to send an image to using the multipart, like I read here https://stackoverflow.com/a/2937140/1552648 but when it arrive to the servlet it doesn't take any thing. Here is the android java code, where I send some text and the image that I have…
user1552648
  • 1
  • 1
  • 2
0
votes
1 answer

HttpServletRequest.authenticate not asking for re-login

using the following code with the default configuration (HTTP Basic authentication + file realm in glassfish 3.1.2) as expected the client is asked for credentials. However, after a refresh or even on a new tab in the browser (even no cookies…
Mike
  • 121
  • 2
  • 8
0
votes
1 answer

How to rename resume(.doc) with new name in java

String oldName = D:\careers.bstalents.com\build\web\uploads\Resume\old.doc; String newName = D:\careers.bstalents.com\build\web\uploads\Resume\new.doc; File newFile = new File(newName); File oldFile = new File(oldName); …
Jitendra verma
  • 51
  • 1
  • 3
  • 10
0
votes
1 answer

Server Sent Event to update collection in Emberjs application on Java EE/jetty

The application has a widget where the list of items keep changing based on some events on the server side. The server has to push these changes to the browser. The application uses emberjs as javascript mvc framework and I have managed to…
Yeshvanthni
  • 207
  • 2
  • 15
0
votes
3 answers

persistence in servlet

can we not use an EntityManager in Servlet ? like this : @WebServlet(name = "ServletPrincipal", urlPatterns = { "/test" }) public class ServletPrincipal extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse…
0
votes
1 answer

Programmatic login based on JDBCRealm

I'm trying to implement OpenID authentication in a simple JSP app. The FORM-based authentication really drives me nuts, since there is no way to listen for pre, post-authenticate events. When I receive user information from OpenID-provider I…
jFrenetic
  • 5,384
  • 5
  • 42
  • 67
0
votes
1 answer

Retriving image from mysql database and display it in html page

I am simply trying to retrieve a image from database and display it. I have written the following code: RetreiveImage.java import myconnection.ConnetionDefault; import java.sql.*; import java.io.*; import javax.servlet.*; …
Pawan Gupta
  • 315
  • 1
  • 3
  • 16
0
votes
1 answer

What is the intended use-case for AsyncContext.start()?

Somebody just pointed out that AsyncContext.start() is a way to start a thread from within a Web Container. I am wondering what is the intended use-case for which this call was added to Java EE?
necromancer
  • 23,916
  • 22
  • 68
  • 115
0
votes
1 answer

What are the advantages or use cases of adding a Servlet, or a Filter programmatically?

This Question makes me wonder, cause I don't see programmatically adding a servlet using a contextListener (which runs once as far as I know ) advantages over DD or Annotations. and I wish to know about a common use case where it's helpful adding…
Ismail Marmoush
  • 13,140
  • 25
  • 80
  • 114
0
votes
1 answer

How to detect whether an AsyncContext has timed out?

Is it possible to tell from an AsyncContext, whether it has completed, timed out or still waiting to be completed? I know it's possible to listen for timeout or complete events, but I'd prefer not to define 4 AsyncListener listener methods just to…
Aivar
  • 6,814
  • 5
  • 46
  • 78
0
votes
1 answer

Can't pass parameters to Servlet via jQuery POST

I'm sending a POST request using jQuery: $.post( 'test', { foo: 'bar'} ); And I have a simple servlet for processing it: @WebServlet("/test") public class TestServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest…
jFrenetic
  • 5,384
  • 5
  • 42
  • 67
0
votes
1 answer

Glassfish - Reload XHTML/JSP files that are within the META-INF/resources folder

The servlet 3.0 specification allows one to package static resources like js/css/jsp/xhtml files within the META-INF/resources folder of jars that reside within the WEB-INF folder. If i would like to make a change to those XHTML files while the war…
Abbas Gadhia
  • 14,532
  • 10
  • 61
  • 73
-1
votes
1 answer

what is best way to redirect all request to login page in servlet

I am new to tomcat and servlet. here is the situation, I am trying to redirect user all url(direct url) to login page to force user log in. any suggestion?
ikel
  • 1,790
  • 6
  • 31
  • 61
-1
votes
2 answers

how to convert this java code into servlets

I am new to servlet. I am trying to connect to database using java with JDBC and OJDBC. I have already written a java code for this. Now I need to run it on Tomcat server. So I have chosen servlet .I have done this using Netbeans IDE, there I chose…
user998461
  • 73
  • 1
  • 4
  • 13
-1
votes
1 answer

Request Dispatcher is not include is not executing file but showing Its source code

Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root","12345"); Statement st =con.createStatement(); String mi = "select * from empinfo where…
Diana
  • 1
  • 3