Questions tagged [web.xml]

The web.xml is the web deployment descriptor file of Java Servlet based web applications. It allows you to define, declare and configure the Servlet API based implementations in your web application, such as servlets, filters and listeners.

A deployment descriptor (DD) refers to a configuration file for an artifact that is deployed to some container/engine.

In the Java Platform, Enterprise Edition, a deployment descriptor describes how a component, module or application (such as a web application or enterprise application) should be deployed. It directs a deployment tool to deploy a module or application with specific container options, security settings and describes specific configuration requirements. XML is used for the syntax of these deployment descriptor files.

For web applications, the deployment descriptor must be called web.xml and must reside in the WEB-INF directory in the web application root.

Further Reading:

2074 questions
11
votes
3 answers

load spring bean into a servlet

There are many documentations out there on how to achieve this task but I still couldn't resolve my issue. I'm new to working with servlet so I probably missed something. I use red5 that uses tomcat 6 to create a servlet that uses a spring bean…
ufk
  • 30,912
  • 70
  • 235
  • 386
11
votes
1 answer

How to edit web.xml in Grails?

When you do a grails create-app, it doesn't look like a web.xml gets generated anywhere. According to the latest docs, it sounds like running grails install-templates will place web.xml to your src/templates/war directory. A few questions about…
smeeb
  • 27,777
  • 57
  • 250
  • 447
11
votes
5 answers

HOWTO handle 404 exceptions globally using Spring MVC configured using Java based Annotations

I am building a Spring 4 MVC app. And it is completely configured using Java Annotations. There is no web.xml. The app is configured by using instance of AbstractAnnotationConfigDispatcherServletInitializer and WebMvcConfigurerAdapter like…
Chantz
  • 5,883
  • 10
  • 56
  • 79
11
votes
3 answers

Grails : Error generating web.xml file

I have upgraded my Grails project from version 2.1.2 to 2.2.3. Before the upgrade, the project worked flawlessly. However, I am not able to run the project now. I get a strange error : | Compiling 143 source files..... | Error Error generating…
user2547287
  • 113
  • 1
  • 6
11
votes
1 answer

how to exclude a url in filtermapping

web.xml SessionCheckFilter filter.SessionCheckFilter SessionCheckFilter
galao
  • 1,281
  • 8
  • 26
  • 50
10
votes
3 answers

JBoss 7.0.1 running without jsessionid in the URL is not working

Because of some security reasons I deceided to disable session tracking by jsessionid in URL. Before I changed my web.xml to the one below, I had on the first time I visited the page a jsessionid in the url, after clicking the first link, it never…
Joergi
  • 1,527
  • 3
  • 39
  • 82
10
votes
2 answers

Authentication without Role in web.xml in JBoss AS 7

For a RESTful enterprise application I need all calls to be authenticated, but I cannot provide a common group/rolt that all users of the system have. I authenticate and authorize over LDAP (which should not make a difference for this issue). If I…
Frank
  • 423
  • 1
  • 7
  • 13
10
votes
1 answer

Having two different servlets mapped on the same URL pattern

I encountered a J2EE project written by others. When I come to the web.xml, there are two different servlets mapped on the same URL pattern. I wonder the purpose of this approach. How exactly does that work and what's the puspose? Here is the…
kaiwii ho
  • 1,367
  • 7
  • 21
  • 40
10
votes
2 answers

URL Pattern for servlet mapping in web.xml

I need a workaround with this URL mapping in web.xml to create URLs with a letter, followed by a "_" followed by any combination of alphanumeric characters. I want to map a servlet to something like this: /something_* Instead…
Fernando Briano
  • 7,699
  • 13
  • 58
  • 75
10
votes
1 answer

Handling multiple basepath in swagger

I am using swagger-ui to provide nice documentation for REST APIs to our clients. Internally we have two different environments jenkin builds the project to. E.g. swagger.json is accessible on both environment…
noor
  • 1,611
  • 16
  • 16
10
votes
3 answers

Spring boot convert web.xml listener

I'm trying to convert my project to Spring Boot project (executable jar file with Jetty embedded). All works with a standard example but I want migrate my old web.xml to Spring Boot. I migrated Servlet and Filters but I don't understand how migrate…
drenda
  • 5,846
  • 11
  • 68
  • 141
10
votes
1 answer

How to specify display name for web app configured without web.xml

How to specify display name for web application (war) configured programmatically in java with WebApplicationInitializer only. I have something like this public class WebAppInitializer implements WebApplicationInitializer { public void…
MariuszS
  • 30,646
  • 12
  • 114
  • 155
10
votes
1 answer

@MultipartConfig override in web.xml

So I have this servlet : @WebServlet(name = "StudentRegistrationUsn", urlPatterns = {"/university/student/registration"}) @MultipartConfig(maxFileSize = 10*1024*1024,maxRequestSize = 20*1024*1024,fileSizeThreshold = 5*1024*1024) public class…
kosta
  • 296
  • 2
  • 6
  • 15
10
votes
2 answers

Multiple URL pattern elements in web.xml

Is it OK to have multiple elements in the element in a J2EE web app version 2.4 compliant web.xml like this: SomeFilter *.htm
Ayusman
  • 8,509
  • 21
  • 79
  • 132
10
votes
2 answers

web.xml, using form and basic authentication simultaneously

I have setup FORM-authentication within web.xml (java-webcontainer) successfully. I did not find a way to sent the username/password within the get-request of the restful-uri from my client when using FORM-Authentication. So I have to use…
nimo23
  • 5,170
  • 10
  • 46
  • 75