1

Всем привет.

  1. Хотел узнать для чего нужен такой элемент metadata-complete в web xml или web fragments?

Нашол обьяснение для такого web xml.. Непонятна выделенная строка.

The web.xml element metadata-complete with a value of true will ignore any other configuration details such as annotations or web fragments. If the value of this is true or this element is omitted, it will get the configuration details from web fragments and annotations. However, if any of the web fragment has a value of false for element metadata-complete, the web fragment and its annotations will be ignored.

Сначало вроде всё понятно.

Если такой элемент присваивает значение True для web xml то все другие конфигурации как аннотации и веб фрагменты будут проигнорированны..

Потом пишется - Если такое значение true или такой элемент опушен, web xml достанет конфигурационные детали от web fragments и annotations.

Материал взят из Syntax and rules for defining web fragments.

Непонятно что именно происходит при присваивании значения true для metadata-complete ?

=========================================================================

  1. Абсолютно непонятно идея про кофнигурации от множество дескрипторов.

    6,7 по верхней ссылке "Syntax and rules"!

Что значит конфигурации от дескрипторов будут обьеденены ?

Configurations from multiple descriptors will be merged (web.xml or fragments).

If the element can take multiple values, the value will be a union

Если элемент принимает множество значений, они обьединятся ?? Как это понимать?

and if there is a conflict between a web fragment and web.xml, web.xml will take precedence. However, if there is a conflict between two fragments, error is raised.

*Elements like welcome-file-list and 
locale-encoding-mapping-list will have their values merged.*

**Непонятна это строка - значения будут слиты, всмысле ??** 

For filters and servlets, the value declared in the DD/fragment will only override the value of any duplicate named parameters, and rest will be merged. О каких значениях идёт речь ?? Для фильтров и сервлетов задаются значения ?

The url-pattern and DispatcherType, annotation value is strictly overridden by DD/fragment without any merge.

Elements like session-config, jsp-config and login-config may only appear at most once across web.xml and all web fragments.

and may only be declared once for the given or extension respectively or an error will be raised.

Если кто сможет дать ссылку на ресурс обьясняющий ту же тему буду рад..

1 ответ 1

1
  1. Для чего нужен metadata-complete

The web application deployment descriptor contains a metadata-complete attribute on the web-app element. The metadata-complete attribute defines whether the web.xml descriptor is complete, or whether other sources of metadata used by the deployment process should be considered. Metadata may come from the web.xml file, web-fragment.xml files, annotations on class files in WEB-INF/classes, and annotations on classes in jar files in the WEB-INF/lib directory. If metadata-complete is set to "true", the deployment tool only examines the web.xml file and must ignore annotations such as @WebServlet, @WebFilter, and @WebListener present in the class files of the application, and must also ignore any web-fragment.xml descriptor packaged in a jar file in WEB-INF/lib. If the metadata-complete attribute is not specified or is set to "false", the deployment tool must examine the class files and web-fragment.xml files for metadata,as previously specified.

The web-fragment.xml also contains the metadata-complete attribute on the web- fragment element. The attribute defines whether the web-fragment.xml descriptor is complete for the given fragment, or whet her it should scan for annotations in the classes in the associated jar file. If metadata-complete is set to “true” the deployment tool only examines the web-fragment.xml and must ignore annotations such as @WebServlet , @WebFilter and @WebListener present in the class files of the fragment. If metadata-complete is not specified or is set to “false” the deployment tool must examine the class files for metadata.

Servlet 3.1 specification, п 5.5 Annotations and Resource Injection

  1. Непонятно идея про конфигурации от множество дескрипторов

For better pluggability and less configuration for developers, we introduce the notion of web module deployment descriptor fragments (web fragment). A web fragment is a part or all of the web.xml that can be specified and included in a library or framework jar's META-INF directory. A plain old jar file in the WEB- INF/lib directory with no web-fragment.xml is also considered a fragment. Any annotations specified in it will be processed according to the rules defined in 8.2.3. The container will pick up and use the configuration as per the rules defined below.

A web fragment is a logical partitioning of the web application in such a way that the frameworks being used within the web application can define all the artifacts without asking developers to edit or add information in the web.xml. It can include almost all the same elements that the web.xml descriptor uses.

Servlet 3.1 specification, п 8.2.1 Modularity of web.xml

Не стоит пытаться из букв вытянуть знания, которые не требуются вам на практике - запутаетесь окончательно. Лучше попробуйте написать учебный проект с использованием web fragments.

1
  • На данный момент я в рамках создания проекта. 25 июн 2016 в 5:09

Ваш ответ

Нажимая на кнопку «Отправить ответ», вы соглашаетесь с нашими условиями использования и подтверждаете, что прочитали и поняли наши политику конфиденциальности и нормы поведения.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.