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
0
votes
1 answer

jetty static web content

I have tried a million different ways the last week to get jetty presenting a simple static html file. But it keeps giving me a 404 result. The setup is: Jetty is installed in: /usr/lib/jetty-home-11.0.2 The Jetty base dir:…
Edwin
  • 294
  • 2
  • 13
0
votes
1 answer

How to define log4j2 config correctly in web,xml

Trying to use log4j2 within my Jersey3 application (running in a tomcat). I want to load the config through my web.xml as the following: web.xml
Remo
  • 1,112
  • 2
  • 12
  • 25
0
votes
1 answer

Java tutorial Reading and writing to URLConnection

I'm following the java tutorial Reading and Writing to a URL and I'm stuck. https://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html There are two block's of code. One for the servlet and one for the client. The Servlet. import…
Edwin
  • 294
  • 2
  • 13
0
votes
0 answers

Blocking some HTTP methods in web.xml

I am running two war files in single tomcat. example app1 and app2. Now I want to block some of the HTTP methods for app2 alone without touching the tomcat own web.xml. So I have created a web.xml for app2 and place it under WEB_INF.
0
votes
0 answers

how to redirect an application to error page when accessing without context root

I am working on Jboss EAP 7 application server. My java application is configured with a context root of '/myapps' in jboss-web.xml file. My issue here is when I access the application without context-root (till port number) I need to redirect the…
ATK
  • 115
  • 1
  • 3
  • 13
0
votes
1 answer

Handle error 503 in application web.xml?

i tried to handle the error code 503 in my application web.xml as follows: 503 /serviceNotAvailable but it's not working i don't know why, please advise. i am using…
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498
0
votes
0 answers

Tomcat SSL on port 8080

I have applied SSL on tomcat on port 443 but my manager asked me to apply it on port 8080 due to some constraints. When I changed the port in connector to 8080 from 443, the server keeps on redirecting my request from https://domain_name:8080 to…
0
votes
1 answer

Unchecked Exception not being caught by Web.xml error-page

I have an unchecked exception that is not being handled by the specified web.xml error page. My directory setup is as follows: /index.jsp /error.jsp /WEB-INF/web.xml /other pages & directories here I have the following specified in web.xml: …
oberger
  • 1,217
  • 2
  • 16
  • 31
0
votes
1 answer

How to tell web.xml that it should not handle .htc files and so leave them to the web server?

How to tell web.xml that it should not handle .htc files and so leave them to the web server? How can I do that ? I am using Vaadin and it's servlet gets all requests, but I really need to serve a .htc file to fix IE(Dawn you Microsoft) corners and…
Cristiano Fontes
  • 4,920
  • 6
  • 43
  • 76
0
votes
2 answers

Structure of Java web app

What is the general application structure of a web app like the folder structure WEB-INF, source files,web.xml ? Also a brief explanation of these files would be helpful? Also specificall are there multiple WEB-INF folders in an app and if yes, why?
copenndthagen
  • 49,230
  • 102
  • 290
  • 442
0
votes
1 answer

Message: Unexpected element '{urn:jboss:domain:keycloak:1.1}subsystem'

I am trying to use keycloak in my app. Im running keycloak on docker and using wildfly 20 as application server. I use this scrypt to start keycloak. version: '3' services: keycloak: image: quay.io/keycloak/keycloak:10.0.1 …
SiekMi
  • 13
  • 4
0
votes
0 answers

getNamedDispatcher on Appengine Java

Due to some unavoidable issues, I am attempting to forward request on Appengine Java from one servlet to another. However, the "standard" config doesn't seem to work. I have: web.xml MyServlet
Tad
  • 4,668
  • 34
  • 35
0
votes
1 answer

log4j2 + composite configuration + web.xml

I have a web app and it has some dependent jars (one of them is a rest client). My scenario is this. I have a log4j2-cswc.xml defined in the rest client dependent jar and is supposed to write the logs to a separate rolling file. In the web app, I…
Uresh K
  • 1,136
  • 11
  • 16
0
votes
1 answer

REST URL mapping with parameter in web.xml

What url-pattern should we be putting in web.xml for making my servlet listen on this path, /{name}/servlet? Here, name is a variable so I should be able to listen on http:8080//testproject/xyz/servlet or http:8080//testproject/abc/servlet. Here…
rm21
  • 160
  • 1
  • 1
  • 7
0
votes
1 answer

Zalando logbook with log4j2

I am trying to introduce Lombook to my project but logging doesn't work. According to documentation servlet filter adding is enough for start working with default setups. I has added servlet to web.xml but logging doesn't work.