servlets Questions

4

Solved

I am trying to compile and deploy a simple web app from command line. servlet-api.jar from Apache Tomcat does not compile my java file, but javax.servlet-api-4.0.1 from the maven central repository...
Halmstad asked 16/10, 2020 at 10:31

6

Solved

We have two parts in our app: Server - provide REST services Client - consume them via Spring restTemplate In addition to the HTTP status our server returns an HTTP body with JSON that describe er...
Liquidation asked 25/5, 2013 at 11:14

12

I am trying to get the whole body from the HttpServletRequest object. The code I am following looks like this: if ( request.getMethod().equals("POST") ) { StringBuffer sb = new StringBuffer(); ...
Messidor asked 11/11, 2011 at 22:16

5

Solved

ServletOutputStream output = response.getOutputStream(); output.write(byte[]); What is the most effective way to write File to javax.servlet.ServletOutputStream? EDIT: won't this be more effect...
Ashleighashlen asked 10/1, 2011 at 9:48

4

Solved

I have tried to resolve by adding missing/unnecessary jar's but nothing works for me. if you know how to resolve this issue then kindly help... Thank you in advance. I am using JDK 9.0.4 install...
Megaton asked 27/2, 2018 at 20:46

8

Solved

I creating a Java EE 7 project using Eclipse Maven plugin. My problem is when I run the application the class that implements SerlvetContextListener does not get invoked. What is causing this probl...
Mundy asked 21/8, 2013 at 20:54

12

Is there any way that I could get the original IP address of the client coming to the server? I can use request.getRemoteAddr(), but I always seem to get the IP of the proxy or the web server. I w...
Cookshop asked 13/1, 2011 at 10:6

9

When I am creating a Maven project I am getting this error in pom.xml Could not initialize class org.apache.maven.plugin.war.util.WebappStructureSerializer -Maven Configuration Problem web.xml is ...
Czarist asked 15/7, 2021 at 15:55

3

Solved

I want to build a Register and login module for my application and ran into the error in the title. My login.html <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymel...
Gusella asked 26/2, 2023 at 17:53

3

Solved

I read here that one should not save the file in the server anyway as it is not portable, transactional and requires external parameters. However, given that I need a tmp solution for tomcat (7) an...
Nourishment asked 6/9, 2013 at 18:49

4

Solved

I am trying to solve an issue with my Jetty servlet running over HTTPS. It is showing this error page in the browser: What I did: I created my Keystore and Truststore as is described here: How to...
Averett asked 12/11, 2021 at 15:20

3

Solved

I have created a fresh new Java EE 6 Enterprise-Application in Netbeans 7.2. So I have three Projects: EAR EJB WAR In the EJB-Project, I have created a simple Bean: package de.aidaorga.test; ...
Bacchae asked 28/8, 2012 at 22:22

6

Solved

Clearly I'm not using this test fixture right. My servlet works just fine in tomcat, but when I try to use this mock, the multi-part boundary is not found. "the request was rejected because no mult...
Inerrant asked 25/3, 2014 at 17:26

8

Solved

The Method request.getRequestURI() returns URI with context path. For example, if the base URL of an application is http://localhost:8080/myapp/ (i.e. the context path is myapp), and I call reque...
Vessel asked 25/11, 2010 at 14:26

11

I am facing an issue during deployment of a service in Tomcat 8. Getting following error : Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/...
Peavy asked 22/1, 2016 at 15:26

14

Solved

I'm writing a Spring MVC application deployed on Tomcat. See the following minimal, complete, and verifiable example public class Application extends AbstractAnnotationConfigDispatcherServletInitia...
Kilowatthour asked 10/1, 2017 at 19:53

5

Solved

I am trying to print the IP address of the logged-in user in my web application. If a user connects from another PC (within the same network, as the web application is running in my pc) using the I...
Enate asked 31/7, 2013 at 7:35

6

Solved

When I use the follow code in eclipse Dynamic Web Project inside servlet , like this : @WebServlet("/CreateCustomerServlet") public class CreateCustomerServlet extends HttpServlet { private...
Nomination asked 25/7, 2012 at 14:48

5

Solved

Simple question I think, but I just can't seem to find an answer. I am writing a cookie in a Java Servlet with the Cookie class which is sent to the browser in the response headers like the follow...
Recitativo asked 6/1, 2011 at 21:38

7

Solved

I am using Spring Boot 1.4.1 which includes spring-web-4.3.3. I have a class annotated with @ControllerAdvice and methods annotated with @ExceptionHandler to handle exceptions thrown by the service...
Amati asked 19/4, 2017 at 17:25

2

Solved

I am trying to test my database project with unit test case with Junit and Mockito. But when i do it i am getting an error.. posting my code and stack trace. I am entirely new to testing . Kindly h...
Autoerotism asked 27/1, 2020 at 8:8

6

Solved

I want to add logging to my Servlet, so I've created Filter which should display request and go to the Servlet. But unfortunately I've encoutered exception: java.lang.IllegalStateException: getRea...
Gwyngwyneth asked 6/9, 2011 at 10:45

8

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 ...
Raceme asked 10/10, 2009 at 18:57

5

Solved

I want to use the @WebServlet annotation in a Java EE webapp which runs on Tomcat 8. I have read that I need to declare Servlet Version 3.1 in my web.xml and that my Servlet needs to extend HttpS...
Staple asked 28/9, 2014 at 21:35

5

Solved

Forward() : This can be done in two ways by Request & ServeletContext. Forwarding a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. Forward is don...
Unitarian asked 24/2, 2012 at 15:3

© 2022 - 2025 — McMap. All rights reserved.