2
голосов
2ответов
1467 просмотров

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. ...

0
голосов
1ответов
149 просмотров

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

1
голосов
3ответов
5392 просмотров

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 alway...

0
голосов
1ответов
305 просмотров

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-...

4
голосов
1ответов
5453 просмотров

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 Servl...

6
голосов
3ответов
12946 просмотров

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

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 Ac...

0
голосов
3ответов
1299 просмотров

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 rep...

1
голосов
3ответов
1678 просмотров

java web application integrating with active directory on OC4J server

I would like to make a servlet (application deployed on OC4J ) which will allow to enter users logged in domain (Active Directory) without any prompt for login and password. Is it possible to retrive in servlet : user name via getRemoteUser or getUserPrincipal methods without authentication form?...

1
голосов
2ответов
1642 просмотров

Access denied when my servlet tries to SSH from Tomcat

I've written a Servlet that uses the library ganymed-ssh2-build210.jar (it uses these classes: import ch.ethz.ssh2.Connection; import ch.ethz.ssh2.Session; import ch.ethz.ssh2.StreamGobbler;) to run commands over an SSH connection (for test purposes it connects to my local machine). When I run m...

28
голосов
1ответов
39996 просмотров

How to get the request string including parameters

I have an odd exception in our application and I'd like to log when it occurs and include the complete request string including the parameters. When I try log.warn("Weird request " + request.getRequestURL()); I get the request string but not the parameters which were included with ? and &amp...

9
голосов
3ответов
17679 просмотров

How to check whether a user is logged in or not in Servlets?

In a Java Servlet I want to check programmatically whether a user is logged in or not.

6
голосов
4ответов
2849 просмотров

JSP, JavaScript, and Java Objects

I have a JSP where I'm using a javascript framework to build a chart using the Google Visualization API. My servlet is returning a sales hashmap object with year as the key and integer (sales number) as the value. My javascript uses the sales object to add data to the Google chart API which bui...

0
голосов
1ответов
1141 просмотров

Security with JSP/JavaBeans/Servlets/MySQL

Background A html page will ask the user to type their username and password. These are credentials for a MySQL database (i.e. they will be used in JDBC connection so that no password is physically stored in the files). On submit a servlet will be called which tries to connect to the database. ...

1
голосов
3ответов
699 просмотров

Ambiguity in servlet-mapping

I have two servlets 'ExtensionServlet' and 'PatternServlet' and a static html page. The HTML code is given below. <html> <head> <title> Resolve servlet ambiguity </title> </head> <body> <form action="servlets/...

10
голосов
3ответов
24952 просмотров

How to rewrite URL in Tomcat 6

I'll build a web application and I want to use url rewriting. In apache this is done with mod_rewrite. But how can I rewrite urls with Tomcat 6? I want to use Struts 2 framework.

1
голосов
2ответов
508 просмотров

How do I prevent empty GET variables from displaying in the URL

I'm having a bit of a weird situation here. I have a form that submits using the GET method for a search function. On the subsequent page after a search, all the variables are displayed in the URL even if they are empty. For example if I make a search for movie title equaling "hello," I'll get th...

1
голосов
2ответов
2740 просмотров

Is it valid to sign a Java war file and include the MANIFEST.MF in <war root>/META-INF</war>

I am looking to sign a war file for distribution via Java Web Start. As I understand it, the jar signer tool ignores the contents of the META-INF directory so that the signing process does not change the digest value of the jar file. Will this same process work for a war file? I've never used ...

0
голосов
4ответов
6175 просмотров

Servlet --x--&gt; Ajax: Ajax code not receiving servlet response

I'm unable to figure out what is going on here in this ultra simple example. Problem Summary: I have a simple servlet that appears to run just fine if I drive it manually... by issuing its URL from the browser. By 'just fine' I mean: I can see in the browser HTML page whatever I write in the ser...

5
голосов
5ответов
2505 просмотров

Sending estimate HTTP Content-Length from Servlet etc

I often need to generate content dynamically from a servlet / restlet or whatever, and don't know the length ahead of time. If the client is a browser, the progress bar doesn't work properly, because I haven't set the Content-Length header. Is there any way of setting an estimated content length,...

54
голосов
7ответов
104414 просмотров

Retrieving JSON Object Literal from HttpServletRequest

I am writing code that needs to extract an object literal posted to a servlet. I have studied the API for the HttpServletRequest object, but it is not clear to me how to get the JSON object out of the request since it is not posted from a form element on a web page. Any insight is appreciated. ...

4
голосов
5ответов
4376 просмотров

Java servlets and database connection pooling

Just looking at examples of connection pooling on the web, they all implement connection pooling on a per servlet basis. So each servlet has its own pool of database connections. My question is, why is that preferable to something like a global pool of db connections? Since a global pool is s...

2
голосов
2ответов
8774 просмотров

Issue with multipart/form-data

I am not able to get values from both files and text input in a servlet when my form includes multipart/form-data. I am using the apache.commons.fileuploads for help with the uploads. Any suggestions. Also in the code below there are some things that I feel should be more efficient. Is there a be...

2
голосов
1ответов
2226 просмотров

Java Text Area not posting

The text area value I am trying to submit is around 400 chars and the value the servlet gets is null. When I limit this down to less that 75 chars the servlet will get the proper value. Has anyone seen this happen before? JSP &lt;form action="/admin/homepageupdates"&gt; &lt;div class="body"...

0
голосов
2ответов
420 просмотров

How to implement a login page without code duplication

I am currently making a dvd browsing system using JSP / Java Servlets and am having trouble figuring out a way to make my login page a bit more efficient. My current login system does this: When a user submits the correct email/password combination, a servlet checks to see if the combination is ...

0
голосов
1ответов
235 просмотров

Java-Servlets: String null or "null"

String says its not null but then later throw NullPointerException I had this problem(see the link), where I was sure that a String is null, but in fact the String was "null" jcasso told me: Since you get the string from a servlet i can say that this is normal. Java converts a null s...

0
голосов
2ответов
991 просмотров

How to remove templates in Eclipse

I am learning Java servlets technology. In a bookt that I am reading, they have asked me to work in a notepad for time being. When i Create a servlet in eclipse, it just auto fills some content to that servlet class which I want to write on my own to learn stuff. For example, the doGet and doPo...

2
голосов
1ответов
7781 просмотров

Servlets-JSP: How to put a delete-modify button for every row of HTML table!

I'm trying to add to every row of a HTML table a "delete" and a "modify" button. If I use this method, the value of the "id" is alawys the value of id from the first row, even if I pressed the button from the rows 2-n. &lt;% if (listx.size() &gt; 0) { int j = 0; for (int i =...

1
голосов
3ответов
1426 просмотров

How to use some configuration file for Java EE servlet?

I need to access some files on servers from servlet. They have different paths on my development machine and on the deployment server. I would like to put some config file (with paths) somewhere (like shared dir in capistrano deployment) so application could read it. Or maybe set some property on...

3
голосов
5ответов
7009 просмотров

Servlet concurrency/synchronization in Tomcat?

Is there a recommended way to synchronize Tomcat Servlet instances that happen to be competing for the same resource (like a file, or a database like MongoDB that isn't ACID)? I'm familiar with thread synchronization to ensure two Java threads don't access the same Java object concurrently, but ...

2
голосов
4ответов
6897 просмотров

Java servlet and authentication

I have a small application with 3-4 servlets and a basic module that provide me authentication like: public class Authentication { public boolean isUserAuthenticated(){ .... } } Is there a way to check the authentication using my class BEFORE every other servlet calls, without ...