servlets

Getting Json data from another domain, within a proxy servlet.

Hi folks, I'm working on a GWT project, in which I have to fetch some JSON data from a real web-domain. Due to SOP policy, GWT fails to get those data. To address this, as suggested in GWT docs, I have created some proxy servlets within GWT, which in turn should call the actual JSON provider external url. Does anybody know how should ...

Problem reading request body in servlet.

I'am writing a HTTP proxy that is part of a test/verification system. The proxy filters all requests coming from the client device and directs them towards various systems under test. The proxy is implemented as a servlet where each request is forwarded to the target system, it handles both GET and POST. Somtimes the response from the t...

I want to create a login page using servlets.

I want to create a login page using Servlet & JSP. I ve created a page which gets Username & password. I made a database with a table which contains Username & password. <form action="LoginPage" method="POST"> User name: <input type="text" name="userName" size="20"><br> Password: <input type="password" name="password" size="20...

Would Servlet 3 annotations enable secret backdoor access?

I hope people don't mind me asking a question which is slightly future gazing. Please forgive me if my understanding is incorrect (and please put me right!). Servlet 3 introduces several new annotations including: @WebServlet @WebFilter @WebListener and also a something called web-fragment.xml. These all seem to be aimed at maki...

Get relative path to XML file from a non-servlet class in a WAR

Hello, I have an XML file which I need to read and load the data in memory every time the app launches. So, while the project was in Eclipse, i hardcoded the path: "/path/to/xml" but when I create the WAR, how can I specify the relative path to the XML file. I can do it using URL url = getServletContext().getResource(fileName); But, I...

Browser Detection using java/J2EE

In order to achieve browser compatibility in application I am in need of Java class/Bean/Jar which will return the following information current browser of user its Name,version and also the OS of the user. Any thought on this will be really helpful, this should work well in latest versions of all the Modern Browsers such Chrome, Safar...

Caching Tomcat HttpClient testing

I'm using HttpClient for testing and when I have been restarting/redeploying to Tomcat I have been getting some sort of client side caching... For example I tried deleting my authentication servlet and ran my tester class (which connects using HttpClient) and I get the same response over and over. I'm going crazy trying to figure out wha...

Redirecting after writing to response throwing exception

Am working on an application which has a requirement to download bulk data from a file server with a maximum file size constraint fixed at 3 Mb.It means i would have a maximum download capacity of 3Mb.I am writing the input stream to the response output stream .My problem is I need to redirect my response to a jsp page after I downlaod.N...

Looking for a question that combines the understanding of few web technologies

I am teaching a web development course at a CS department, I wrote most of the final test by now, each question focus on a specific feature or a specific technology, I wonder if you can think of/recommend a question that combine the knowledge of few technologies.. The course mostly covers: HTML, CSS, JS, HTTP, Servlets, JSP and JDBC. ...

Passing array from javascript to java servlet using Jackson

Hello Im trying to pass an array from javascript to java servlet using Jackson, how this can be done..thanks ...

Accessibility of a servlet class from within an external web.xml file

I have two web applications.But only one among them includes Java servlet class.I want to access that servlet class from within the web.xml file of other application.Is it possible?.If yes,How will be it possible?. ...

request.setCharacterEncoding("UTF-8") wrong when going to myEclipse from JBuilder2008

hi I am working about a project.I was working with JBuilder2008 till last and my codes was true and my projefct whould work successfully.for today I have got to work with MyEclipse. and I have gote a problem: request.setCharacterEncoding("UTF-8"); has got a red line below 'setCharacterEncoding' and it has below problem message: The metho...

servlet html5 <video>

I have <video src="someServlet"> where I write in servletOutputStream bytes from some video file, but it does not work. When I write <video src="/somedirectory/somefile.ogg">, it works fine. Can anyone help? ...

Simple Servlet Question on ServletConfig instantiation

Apparently the following is generating a loop(the GenericServlet class is calling the subclass's init()) public void init() throws ServletException { ServletConfig c = this.getServletConfig(); super.init(c); } I'm probably just doing this wrong. Thank you guys in advance! ...

How to do file I/O with a servlet running on Tomcat

I am writing a Java servlet, using Tomcat as the container, which creates and serves PDF files to the end-user. Currently the PDF files are created in-memory and written out as a response to a POST. I would like to change this up somewhat so that the PDF files are written to disk (so they can be served up again later). I am having troub...

How to use JQuery to call a servlet.

How to use JQuery to call a servlet which I usually call like this http://localhost:8080?a=1&amp;b=2&amp;c=3. I particularly want to find out how to pass URL params. ...

Java Servlet Filters and SSL

Do Servlet filters have any issues with detecting SSL requests? I have a filter that works okay with normal http request but it does not detect https request. Any advice here would be appreciated. ...

How to make PDF editable Form? In PDF Form, user has to fill form and submit the PDF Form using Servlet?

Making PDF Form editable? ...

how to specify the contextPath

Hi I am using jetty servlets. I have the following structure. war/web-inf/web.xml war/classes/servlet.class (servlet I want to call) war/*.html Problem: ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); context.addServlet(new ServletHolder(new GreetingServic...

Java exception problem

I got this exception in time of running a web application in java. What does this mean? exception.name = javax.servlet.ServletException: BeanUtils.populate ...