servlets

Open-source Java server-side implementations of HTTP auth decoding

I have a requirement to perform HTTP authentication logic within a servlet application, rather than delegating this task to the container. Specifically, I need a way of taking the headers of an HttpServletRequest which contains HTTP auth headers, and having them decoded into a data structure representing the supplied credentials, which ...

How can I obtain the message resources object in a servlet?

Hi everyone, I'm developing a project with Struts and I was wondering if it's possible to get the message resources object in a servlet, which is included in the same project. There's no possibility to get that object with the method getResources(HTTPServletRequest) because the servlet does not extends an Action class. Is there a way t...

Run Jettys ServletTester within JUnit test

I'm trying to run Jettys ServletTester in my JUnit test. I created a simple HelloServlet first to test the setup, but I get an IllegalAccessException when I try to request the servlet. Here is what I have so far: My unit test @Before public void setUp() throws Exception { tester = new ServletTester(); tester.setContextPath("/co...

Java servlet deployment error webui-jsf-suntheme

I am receiving the following run-time error in the web browser (Firefox) when attempting to run a deployed Java servlet on a Linux server: unterminated string literal dojo.provide("webui.suntheme.browser");w...wGroupsContainer,_41f.rowGroups[i],"last I believe the problem is related to webui-jsf-suntheme. I can confirm that the appl...

Best way to read data from another website

Here's the situation: I have a web application (Java servlets) at "mycompany.com". A business partner is going to supply me with data from his application at "yourcompany.com". His application is driven by a web form (POST). I know nothing about his application other than the results will always be returned via a web page. For example...

login issue in servlet

i want code to check whether the user in logged in or not. I get replied with context that to use HttpServletRequest.getUserPrincipal(). But i do not know how to set the username in servlet so that it is further called by getUserPrincipal() Thank in advance ...

Mapping both static and dynamic files in Tomcat/Spring?

I was using the following in web.xml to configure a servlet to dynamically generate PDFs. <servlet-mapping> <servlet-name>pdfServlet</servlet-name> <url-pattern>*.pdf</url-pattern> </servlet-mapping> Now, I also have to serve a few static PDF files. What's the cleanest way to configure that? I'm currently only serving four o...

Handle http post request

Hi all! I have the following scenario to implement: I have an ASP.NET Web site. On a click of a button in my site the user is redirected to a 3rd party site. When the user does some actions in this 3rd party site, the site starts sending http post requests to my site with a special message every 1 minute. Now, the problem is that I sh...

Session Bean returning another Remote Session Bean reference [JBOSS]

Hi all, I have a Stateless Session Bean in my JBoss Server that contains a function returning an instance of another Session Bean (this one is stateful). My problem arises because this returned object doesn't seem to keep its persistence model (the EntityManager is null). What is the right way to return from a Session Bean another Ses...

jee servlet to create a file and show progress while creating it

I need to write a servlet that will return to the user a csv that holds some statistics. I know how to return just the file, but how can I do it while showing a progress bar of the file creation process? I am having trouble understanding how can I do something ajaxy to show the progress of the file creation, while creating the file at ...

How can I configure a Servlet in Eclipse to use a JPA project?

I am using Eclipse Galileo and I wanted to deploy a simple application, using JPA, GlassFish 2.1 and MySQL 5. Unfortunately, I could not find any tutorials for GlassFish 2.1 (just for 3.0, but I cannot use it). I created a JPA project, added a MySQL5 connection and generated an Entity from the database. The generate JPA class is: pac...

server side programming in java

how to write server side scripting and validation s in java by using servlets and jsp is there any reference site regarding to this.plesae help me . THAN Q ...

jetty: put index.html into webroot

when started, jetty per default loads all directories and war-files in its webapps directory, that i can access via context path (e.g. http:// hostname/app/ to access the project in webapps/app.war). Now when i open http:// hostname/ i get an 404 error and a list of the available contexts. To avoid that, i placed an index.html in the w...

Static Classes in Servlet

I make static classes in servlet, these classes are controllers for web pages. Requests are redirected to controllers by controller urls that are in static HashMap that contains all controllers. Are there any posibilities that user/session realted stuff could get messsed up with other users sessions? I will of course save all session rel...

autocomplete text box

i want to make a text box like stackoverflow have for the tag at askquestion page where data pop up as we write something. I want to fetch the tag from the database rather local static data. In my project i am using jsp servlet hibernate and spring Please tell me how to do.. thanks in advance ...

Difference between Apache Struts and Java EE?

I'm currently learning Java EE, or more specifically, Servlets and .jsp. In my programming, I already employ the Model-View-Controller model to write my code. And as far as I've googled, Apache Struts is just a server like Tomcat. So, what exactly is Apache Struts, in relation to Java, Java EE, and Servlet classes in Java EE? ...

Is there a way to make Tomcat start an app up as soon as the WAR has been deployed?

My app has a bit of expensive setup to do when it first starts up. It appears that as soon as I copy the WAR file in webapps, the log file says "Deploying web application archive Navaid.jar", but it doesn't actually run anything until I hit the URL. I'd rather than have the first person to hit the url endure the wait time for this star...

What are the differences between Servlet 2.5 and 3?

I'm rolling J2EE code that adheres to Servlet 2.5 and am wondering what the major differences are between 2.5 and 3. Pointers to official Sun docs and personal experiences most appreciated. If I shouldn't be concerning myself with 3 for the time being, just say so. Thanks! ...

Efficiently sending large amounts of data with ServletOutputStream

For content type "text/plain" which of the following is more efficient if I have to send huge data. ServletOutputStream sos = response.getOutputStream(); sos.write(byte[]) //or sos.println("") Thanks ...

how to get value from the fckeditor texfield

i have put fckeditor in jsp page. I want to get the value whatever we write on the editor textarea. I have put the code below in my jsp page. As we all know that getting value of text field like is done by writing String title = request.getParameter("title1"); in the same way i want the value from the fckeditor.. Thanks ...