servlets

Getting SSL context for HttpsURLConnection from X509Certificate

hi, I am pretty new to certificates, but I have to do something like this (in Java): 1) I have requestor's certificate in my hand: X509Certificate[] certs = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate"); 2) I need to request another url with that certificate (is it even possible?), something like:...

JSP and Servlet maintenance on Tomcat

I'm developing a JSP/Servlet webapp on Tomcat. How should I refresh some things (servlet classes, web.xml, JSPs etc.) while it is functioning? I can use a boolean variable in my servlets to detect it will be a maintenance period so all the requests will be ignored. (All my servlets extend my own base servlet class, so the only thing I h...

pass value from and to servlet using HttpMessage

Hello all, I'm trying to send byte[] to a servlet and get the result back using O'Reilly HttpMessage. But I get a null pointer exception on retrieving. This is the code on the client app: URL url = null; try { url = new URL("http://localhost:8080/ImageFilter/imagefilter"); } catch (MalformedURLException e) { e.printStackTra...

How to run program that sends bills to customers once a month?

Hi! I have a table in database with users and their expenses for traveling. I am using GWT and want to run a code once a month, that would query the database and send bills as PDFs to customers. I know how to create PDFs and send emails from servlet. How to run a program in java (or some other script if it isn't possible with java) that...

Is it portable to reference the request parameter map after a request-cycle?

I'd like to know if its conform to the java servlet specification 2.5 to reference/save the return value of request.getParameterMap() between requests. The final specification only states at page 203: Returns: an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map...

Session ID from Thread / Stacktrace

Not so much a problem I am having, just thinking about things. If i have a web application, lets take a call into a servlet. If the servlet calls into a data manager which calls into a database layer. Lets assueme that one of these levels throws an exception. Is there a way of identifying the session id that is present at the top of the...

Updating Method in Web-Based application - Java Servlets

I'm writing a servlet based back-end for a mobile phone app and I'm pretty new to web programming in general. Anyways my issue is I have a data model that associates users to a general feed and when that feed is updated by any one user I want the rest of the users associated with the feed to receive the updated model. From what I gat...

jsp:include , performance, modularization, alternatives and best practices, Part 96

Hi all, This is a follow-up to the 'overhead of jsp include' question below: http://stackoverflow.com/questions/1479218/jsp-performance-using-jspinclude In our application, developers have 'modularized' jsp fragments by heavy use of "jsp:includes" for "common" jsp code repeated throughout the application. Pros The pro's are as follo...

Display single record from database in JSP page through Java Servlet based on GET parameter, how?

I have a servlet that correctly returns the data I want from the database when it's doGet() method is called. I would like the doGet() to populate a java bean, which we then reference in the product.jsf page. I'd like call a URL like http://example.com/product.jsf?id=XXX And have the single record returned based on the ID based in the...

Render HTML table with JSF.

I need to render an HTML table from a Servlet, in response to an AJAX request. I'm wondering what the best way to go about this is? I've explored using an javax.faces.component.html.HtmlDataTable. One of the questions I have regarding this method is how to render the HTML once the table has been populated. From the looks of it, a Fac...

Getting Invalid at the top level of the document. Error processing resource 'http://localhost:8080/AjaxDecoder/response'. Line 1, ...

Getting the following error when loading the URL in the browser: The XML page cannot be displayed Invalid at the top level of the document. Error processing resource 'http://localhost:8080/AjaxDecoder/response'. Line 1, ... Using Eclipse with Tomcat integrated. My web.xml file is: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, I...

How to pass a string containing double quotes from a jsp to a servlet through URL using get method

Hi all, I want to set a jsp parameter to an attribute value which may contain special symbols, then use a form GET submit to pass the parameter to a servlet controller. For example, the parameter is: <input type="hidden" name="searchTerms" value="${sessionScope.combTerms}"></input> I noticed if sessionScope.combTerms contains double qu...

client request(J2ME) should be displayed on webserver and upcoming request should be queued and displayed

i need coding for above and suggest some procedures to do ...

NPE not occuring or being caught in Servlet

I have a pretty basic Servlet public class DreambearLoginServlet extends HttpServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { JSONObject ret = new JSONObject(); try { // handle the request try { ...

Guice Servlet project fails with IllegalAccessException on startup

I'm using the Guice servlet module and trying to get just the basic filter and listener running. When I start my servlet container I get a java.lang.IllegalAccessException wrapped in an AssertionError. Basically what appears to be happening is that Guice is trying to instantiate com.google.inject.servlet.ManagedServletPipeline which is...

Getting current session object in Java

Can I access session object from within a function where request object is not present? I know in Java we access session like this: HttpSession session = request.getSession(true); But what if we want to access session when request object is not present? Is it possible? is there an alternate way to get session object? Edit I ha...

Java Servlet Behaviour Question

I am currently implementing an OpenID Relying Party (RP) and Identity Provider (IdP) with Java HttpServlets using the OpenID4Java library. I have run into trouble getting two servlets to communicate with each other. I believe the problem I am having is to do more with how Servlets behave, however I have included info about my applicati...

Storing objects in session

I have a PersistenceCapable class @PersistenceCapable(identityType = IdentityType.APPLICATION) public class MyClass { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; .......... .......... } In my servlet, I need to store object of this class in session ............ MyClass u...

SolrJ Thread Safety

I am using CommonsHttpSolrServer in a Web Application. Is it safe to reuse the CommonsHttpSolrServer over multiple requests or should I instantiate a new object for each request? Could not find the answer in the API docs. ...

Grails 1.3.3 filters - either a NullPointerException or a ClassCastException

Hello, Today I upgraded our grails app from 1.0.3 to 1.3.3 and, of course, things started behaving weirdly. The problem I'm currently asking about is as follows: the web.xml contains: <filter> <filter-name>sitemesh</filter-name> <filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class> </filter> ...