'web'에 해당되는 글 114건

  1. 2005.02.08 Tomcat 4.1.12 버전에서 서블릿 접근
  2. 2005.02.04 web.xml 설명.
  3. 2005.02.04 server.xml
  4. 2005.02.04 web.xml

 
Tomcat 4.1.12 버전에서 서블릿 접근이 안되는 경우

원인

/conf/web.xml

파일에서

invoker 서블릿의 매핑이 보안문제로 막혀있습니다.

    <!-- The mapping for the invoker servlet -->
<!--
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
-->

examples context 가 되는 이유

/webapps/examples/WEB-INF/web.xml

파일에서 invoker 서블릿을 다시 매핑합니다.

...

    <!-- Define filter mappings for the defined filters -->
    <filter-mapping>
        <filter-name>Servlet Mapped Filter</filter-name>
 <servlet-name>invoker</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>Path Mapped Filter</filter-name>
 <url-pattern>/servlet/*</url-pattern>
    </filter-mapping>

...중략...


    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>

...

 

 

해결법

/conf/web.xml 에서

invoker mapping 을 주석을 풀어줍니다.

    <!-- The mapping for the invoker servlet -->
    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>

dtd 에 의거해서

security-constraint 엘리먼트를 /conf/web.xml 파일의 welcome-file-list 엘리먼트 아래쪽 <web-app> 에 중첩되게 복사합니다.

다음과 같을 것입니다.

...

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <security-constraint>
      <display-name>Default Servlet</display-name>
      <!-- Disable direct alls on the Default Servlet -->
      <web-resource-collection>
        <web-resource-name>Disallowed Location</web-resource-name>
    
    <url-pattern>/servlet/org.apache.catalina.servlets.DefaultServlet/*</url-pattern>
        <http-method>DELETE</http-method>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
        <http-method>PUT</http-method>
      </web-resource-collection>
      <auth-constraint>
        <role-name></role-name>
      </auth-constraint>
    </security-constraint>
   

</web-app>

그후에 톰캣을 재시동하고 테스트해보면 됩니다.

/conf/web.xml 파일 첨부합니다.


 

'web' 카테고리의 다른 글

[펌] Axis Webservice 설치및 테스트  (0) 2005.09.03
[펌] web.xml 사용법  (0) 2005.07.23
web.xml 설명.  (0) 2005.02.04
server.xml  (0) 2005.02.04
web.xml  (0) 2005.02.04
Posted by '김용환'
,

web.xml 설명.

web 2005. 2. 4. 07:15

web.xml Deployment Descriptor Elements

 

This following sections describe the deployment descriptor elements defined in the web.xml file. The root element for web.xml is <web-app>. The following elements are defined within the <web-app> element:

 


icon Element

The icon element specifies the location within the Web Application for a small and large image used to represent the Web Application in a GUI tool. (The servlet element also has an element called the icon element, used to supply an icon to represent a servlet in a GUI tool.)

This element is not currently used by WebLogic Server.

The following table describes the elements you can define within an icon element.

Element

Required/
Optional

Description

<small-icon>

Optional

Location for a small (16x16 pixel) .gif or .jpg image used to represent the Web Application in a GUI tool. Currently, this is not used by WebLogic Server.

<large-icon>

Optional

Location for a large (32x32 pixel) .gif or .jpg image used to represent the Web Application in a GUI tool. Currently, this element is not used by WebLogic Server.

 


display-name Element

The optional display-name element specifies the Web Application display name, a short name that can be displayed by GUI tools.

Element

Required/
Optional

Description

<display-name>

Optional

Currently, this element is not used by WebLogic Server.

 


description Element

The optional description element provides descriptive text about the Web Application.

Element

Required/
Optional

Description

<description>

Optional

Currently, this element is not used by WebLogic Server.

 


distributable Element

The distributable element is not used by WebLogic Server.

Element

Required/
Optional

Description

<distributable>

Optional

Currently, this element is not used by WebLogic Server.

 


context-param Element

The optional context-param element declares a Web Application's servlet context initialization parameters. You set each context-param within a single context-param element, using <param-name> and <param-value> elements. You can access these parameters in your code using the javax.servlet.ServletContext.getInitParameter() and javax.servlet.ServletContext.getInitParameterNames() methods.

The following table describes the elements you can define within a context-param element.

Element

Required/
Optional

Description

<param-name>

Required

The name of a parameter.

<param-value>

Required

The value of a parameter.

<description>

Optional

A text description of a parameter.

 


filter Element

The filter element defines a filter class and its initialization parameters. For more information on filters, see Configuring Filters.

The following table describes the elements you can define within a servlet element.

Element

Required/
Optional

Description

<icon>

Optional

Specifies the location within the Web Application for a small and large image used to represent the filter in a GUI tool. Contains a small-icon and large-icon element.

Currently, this element is not used by WebLogic Server.

<filter-name>

Required

Defines the name of the filter, used to reference the filter definition elsewhere in the deployment descriptor.

<display-name>

Optional

A short name intended to be displayed by GUI tools.

<description>

Optional

A text description of the filter.

<filter-class>

Required

The fully-qualified class name of the filter.

<init-param>

Optional

Contains a name/value pair as an initialization parameter of the filter.

Use a separate set of <init-param> tags for each parameter.

 


filter-mapping Element

The following table describes the elements you can define within a filter-mapping element.

Element

Required/
Optional

Description

<filter-name>

Required

The name of the filter to which you are mapping a URL pattern or servlet. This name corresponds to the name assigned in the <filter> element with the <filter-name> element.

<url-pattern>

Required - or map by <servlet>

Describes a pattern used to resolve URLs. The portion of the URL after the http://host:port + ContextPath is compared to the <url-pattern> by WebLogic Server. If the patterns match, the filter mapped in this element is called.

Example patterns:

/soda/grape/*
/foo/*
/contents
*.foo

The URL must follow the rules specified in Section 10 of the Servlet 2.2 Specification.

<servlet>

Required - or map by <url-pattern>

The name of a servlet which, if called, causes this filter to execute.

 


listener Element

Define an application listener using the listener element.

Element

Required/
Optional

Description

<listener-class>

Optional

Name of the class that responds to a Web Application event.

For more information, see Configuring an Event Listener.

 


servlet Element

The servlet element contains the declarative data of a servlet.

If a jsp-file is specified and the <load-on-startup> element is present, then the JSP is precompiled and loaded when WebLogic Server starts.

The following table describes the elements you can define within a servlet element.

Element

Required/
Optional

Description

<icon>

Optional

Location within the Web Application for a small and large image used to represent the servlet in a GUI tool. Contains a small-icon and large-icon element.

Currently, this element is not used by WebLogic Server.

<servlet-name>

Required

Defines the canonical name of the servlet, used to reference the servlet definition elsewhere in the deployment descriptor.

<display-name>

Optional

A short name intended to be displayed by GUI tools.

<description>

Optional

A text description of the servlet.

<servlet-class>

Required (or use <jsp-
file>)

The fully-qualified class name of the servlet.

Use only one of either the <servlet-class> tags or <jsp-file> tags in your servlet body.

<jsp-file>

Required (or use <servlet-
class>)

The full path to a JSP file within the Web Application, relative to the Web Application root directory.

Use only one of either the <servlet-class> tags or <jsp-file> tags in your servlet body.

<init-param>

Optional

Contains a name/value pair as an initialization parameter of the servlet.

Use a separate set of <init-param> tags for each parameter.

<load-on-startup>

Require

WebLogic Server initializes this servlet when WebLogic Server starts up. The content of this element must be a positive integer indicating the order in which the servlet should be loaded. Lower integers are loaded before higher integers. If no value is specified, or if the value specified is not a positive integer, WebLogic Server can load the servlet in any order in the startup sequence.

<security-role-
ref>

Optional

Used to link a security role name defined by <security-role> to an alternative role name that is hard coded in the servlet logic. This extra layer of abstraction allows the servlet to be configured at deployment without changing servlet code.

icon Element

This is an element within the servlet Element.

The icon element specifies the location within the Web Application for small and large images used to represent the servlet in a GUI tool.

The following table describes the elements you can define within an icon element.

Element

Required/
Optional

Description

<small-icon>

Optional

Specifies the location within the Web Application for a small (16x16 pixel) .gif or .jpg image used to represent the servlet in a GUI tool.

Currently, this element is not used by WebLogic Server.

<large-icon>

Optional

Specifies the location within the Web Application for a small (32x32 pixel) .gif or .jpg image used to represent the servlet in a GUI tool.

Currently, this element is not used by WebLogic Server.

init-param Element

This is an element within the servlet Element.

The optional init-param element contains a name/value pair as an initialization parameter of the servlet. Use a separate set of init-param tags for each parameter.

You can access these parameters with the javax.servlet.ServletConfig.getInitParameter() method.

The following table describes the elements you can define within a init-param element.

Element

Required/
Optional

Description

<param-name>

Required

Defines the name of this parameter.

<param-value>

Required

Defines a String value for this parameter.

<description>

Optional

Text description of the initialization parameter.

WebLogic Server recognizes the special initialization parameter, wl-dispatch-policy, to assign a servlet or JSP to an available execute queue. For example, the following example assigns a servlet to use the execute threads available in an execute queue named CriticalWebApp:

<servlet>
   ...
   <init-param>
      <param-name>wl-dispatch-policy</param-name>
      <param-value>CriticalWebApp</param-value>
   </init-param>
</servlet>

If the CriticalWebApp queue is not available, the servlet will use execute threads available in the default WebLogic Server execute queue. See Setting Thread Count for more information about configuring execute threads in WebLogic Server. See Using Execute Queues to Control Thread Usage for more information about creating and using queues.

security-role-ref Element

This is an element within the servlet Element.

The security-role-ref element links a security role name defined by <security-role> to an alternative role name that is hard-coded in the servlet logic. This extra layer of abstraction allows the servlet to be configured at deployment without changing servlet code.

The following table describes the elements you can define within a security-role-ref element.

Element

Required/
Optional

Description

<description>

Optional

Text description of the role.

<role-name>

Required

Defines the name of the security role or principal that is used in the servlet code.

<role-link>

Required

Defines the name of the security role that is defined in a <security-role> element later in the deployment descriptor.

 


servlet-mapping Element

The servlet-mapping element defines a mapping between a servlet and a URL pattern.

The following table describes the elements you can define within a servlet-mapping element.

Element

Required/
Optional

Description

<servlet-name>

Required

The name of the servlet to which you are mapping a URL pattern. This name corresponds to the name you assigned a servlet in a <servlet> declaration tag.

<url-pattern>

Required

Describes a pattern used to resolve URLs. The portion of the URL after the http://host:port + WebAppName is compared to the <url-pattern> by WebLogic Server. If the patterns match, the servlet mapped in this element will be called.

Example patterns:

/soda/grape/*
/foo/*
/contents
*.foo

The URL must follow the rules specified in Section 10 of the Servlet 2.2 Specification.

For additional examples of servlet mapping, see Servlet Mapping.

 


session-config Element

The session-config element defines the session parameters for this Web Application.

The following table describes the element you can define within a session-config element.

Element

Required/
Optional

Description

<session-timeout>

Optional

The number of minutes after which sessions in this Web Application expire. The value set in this element overrides the value set in the TimeoutSecs parameter of the <session-descriptor> element in the WebLogic-specific deployment descriptor weblogic.xml, unless one of the special values listed here is entered.

Default value: -2

Maximum value: Integer.MAX_VALUE ÷ 60

Special values:

  • -2 = Use the value set by TimeoutSecs in <session-descriptor> element of weblogic.xml

  • -1 = Sessions do not timeout. The value set in <session-descriptor> element of weblogic.xml is ignored.

For more information, see session-descriptor Element.

 


mime-mapping Element

The mime-mapping element defines a mapping between an extension and a mime type.

The following table describes the elements you can define within a mime-mapping element.

Element

Required/
Optional

Description

<extension>

Required

A string describing an extension, for example: txt.

<mime-type>

Required

A string describing the defined mime type, for example: text/plain. The following default mime types are provided with WebLogic Server (you can override these):

setIfNone(mimeTypesMap, "html", "text/html");

setIfNone(mimeTypesMap, "htm", "text/html");

setIfNone(mimeTypesMap, "gif", "image/gif");

setIfNone(mimeTypesMap, "jpeg", "image/jpeg");

setIfNone(mimeTypesMap, "jpg", "image/jpeg");

setIfNone(mimeTypesMap, "pdf", "application/pdf");

setIfNone(mimeTypesMap, "zip", "application/zip");

setIfNone(mimeTypesMap, "class", "application/x-java-vm");

setIfNone(mimeTypesMap, "jar", "application/x-java-archive");

setIfNone(mimeTypesMap, "ser",

"application/x-java-serialized-object"); setIfNone(mimeTypesMap,

"exe", "application/octet-stream"); setIfNone(mimeTypesMap, "txt",

"text/plain"); setIfNone(mimeTypesMap, "java", "text/plain"); // This

is for JavaWebStart out of the box work setIfNone(mimeTypesMap,

"jnlp", "application/x-java-jnlp-file");

 


welcome-file-list Element

The optional welcome-file-list element contains an ordered list of welcome-file elements.

When the URL request is a directory name, WebLogic Server serves the first file specified in this element. If that file is not found, the server then tries the next file in the list.

For more information, see Configuring Welcome Pages and How WebLogic Server Resolves HTTP Requests.

The following table describes the element you can define within a welcome-file-list element.

Element

Required/
Optional

Description

<welcome-file>

Optional

File name to use as a default welcome file, such as index.html

 


error-page Element

The optional error-page element specifies a mapping between an error code or exception type to the path of a resource in the Web Application.

When an error occurs—while WebLogic Server is responding to an HTTP request, or as a result of a Java exception—WebLogic Server returns an HTML page that displays either the HTTP error code or a page containing the Java error message. You can define your own HTML page to be displayed in place of these default error pages or in response to a Java exception.

For more information, see Customizing HTTP Error Responses and How WebLogic Server Resolves HTTP Requests.

The following table describes the elements you can define within an error-page element.

Note: Define either an <error-code> or an <exception-type> but not both.

Element

Required/
Optional

Description

<error-code>

Optional

A valid HTTP error code, for example, 404.

<exception-type>

Optional

A fully-qualified class name of a Java exception type, for example, java.lang.string

<location>

Required

The location of the resource to display in response to the error. For example, /myErrorPg.html.

 


taglib Element

The optional taglib element describes a JSP tag library.

This element associates the location of a JSP Tag Library Descriptor (TLD) with a URI pattern. Although you can specify a TLD in your JSP that is relative to the WEB-INF directory, you can also use the <taglib> tag to configure the TLD when deploying your Web Application. Use a separate element for each TLD.

The following table describes the elements you can define within a taglib element.

Element

Required/
Optional

Description

<taglib-location>

Required

Gives the file name of the tag library descriptor relative to the root of the Web Application. It is a good idea to store the tag library descriptor file under the WEB-INF directory so it is not publicly available over an HTTP request.

<taglib-uri>

Required

Describes a URI, relative to the location of the web.xml document, identifying a Tag Library used in the Web Application.

If the URI matches the URI string used in the taglib directive on the JSP page, this taglib is used.

 


resource-ref Element

The optional resource-ref element defines a reference lookup name to an external resource. This allows the servlet code to look up a resource by a "virtual" name that is mapped to the actual location at deployment time.

Use a separate <resource-ref> element to define each external resource name. The external resource name is mapped to the actual location name of the resource at deployment time in the WebLogic-specific deployment descriptor weblogic.xml.

The following table describes the elements you can define within a resource-ref element.

Element

Required/
Optional

Description

<description>

Optional

A text description.

<res-ref-name>

Required

The name of the resource used in the JNDI tree. Servlets in the Web Application use this name to look up a reference to the resource.

<res-type>

Required

The Java type of the resource that corresponds to the reference name. Use the full package name of the Java type.

<res-auth>

Required

Used to control the resource sign on for security.

If set to APPLICATION, indicates that the application component code performs resource sign on programmatically. If set to CONTAINER WebLogic Server uses the security context established with the login-config element. See login-config Element.

<res-sharing-scope>

Optional

Specifies whether connections obtained through the given resource manager connection factory reference can be shared.

Valid values:

  • Shareable

  • Unshareable

 


security-constraint Element

The security-constraint element defines the access privileges to a collection of resources defined by the <web-resource-collection> element.

For more information, see Configuring Security in Web Applications.

The following table describes the elements you can define within a security-constraint element.

Element

Required/
Optional

Description

<web-resource-
collection>

Required

Defines the components of the Web Application to which this security constraint is applied.

<auth-constraint>

Optional

Defines which groups or principals have access to the collection of web resources defined in this security constraint. See also auth-constraint Element.

<user-data-
constraint>

Optional

Defines how the client should communicate with the server.

See also user-data-constraint Element

web-resource-collection Element

Each <security-constraint> element must have one or more <web-resource-collection> elements. These define the area of the Web Application to which this security constraint is applied.

This is an element within the security-constraint Element.

The following table describes the elements you can define within a web-resource-collection element.

Element

Required/
Optional

Description

<web-resource-
name>

Required

The name of this Web resource collection.

<description>

Optional

A text description of this security constraint.

<url-pattern>

Optional

Use one or more of the <url-pattern> elements to declare to which URL patterns this security constraint applies. If you do not use at least one of these elements, this <web-resource-collection> is ignored by WebLogic Server.

<http-method>

Optional

Use one or more of the <http-method> elements to declare which HTTP methods (usually, GET or POST) are subject to the authorization constraint. If you omit the <http-method> element, the default behavior is to apply the security constraint to all HTTP methods.

auth-constraint Element

This is an element within the security-constraint Element.

The optional auth-constraint element defines which groups or principals have access to the collection of Web resources defined in this security constraint.

The following table describes the elements you can define within an auth-constraint element.

Element

Required/
Optional

Description

<description>

Optional

A text description of this security constraint.

<role-name>

Optional

Defines which security roles can access resources defined in this security-constraint. Security role names are mapped to principals using the security-role-ref Element. See security-role-ref Element.

user-data-constraint Element

This is an element within the security-constraint Element.

The user-data-constraint element defines how the client should communicate with the server.

The following table describes the elements you may define within a user-data-constraint element.

Element

Required/
Optional

Description

<description>

Optional

A text description.

<transport-
guarantee>

Required

Specifies that the communication between client and server.

WebLogic Server establishes a Secure Sockets Layer (SSL) connection when the user is authenticated using the INTEGRAL or CONFIDENTIAL transport guarantee.

Range of values:

  • NONE—The application does not require any transport guarantees.

  • INTEGRAL—The application requires that the data be sent between the client and server in such a way that it cannot be changed in transit.

  • CONFIDENTIAL—The application requires that data be transmitted so as to prevent other entities from observing the contents of the transmission.

 


login-config Element

Use the optional login-config element to configure how the user is authenticated; the realm name that should be used for this application; and the attributes that are needed by the form login mechanism.

If this element is present, the user must be authenticated in order to access any resource that is constrained by a <security-constraint> defined in the Web Application. Once authenticated, the user can be authorized to access other resources with access privileges.

The following table describes the elements you can define within a login-config element.

Element

Required/
Optional

Description

<auth-method>

Optional

Specifies the method used to authenticate the user. Possible values:

BASIC - uses browser authentication
FORM - uses a user-written HTML form
CLIENT-CERT

<realm-name>

Optional

The name of the realm that is referenced to authenticate the user credentials. If omitted, the realm defined with the Auth Realm Name field on the Web Application—> Configuration—>Other tab of the Administration Console is used by default. For more information, see Specifying a Security Realm.

Note: The <realm-name> element does not refer to security realms within WebLogic Server. This element defines the realm name to use in HTTP Basic authorization.

Note: The system security realm is a collection of security information that is checked when certain operations are performed in the server. The servlet security realm is a different collection of security information that is checked when a page is accessed and basic authentication is used.

<form-login-
config>

Optional

Use this element if you configure the <auth-method> to FORM. See form-login-config Element.

form-login-config Element

This is an element within the login-config Element.

Use the <form-login-config> element if you configure the <auth-method> to FORM.

.

Element

Required/
Optional

Description

<form-login-page>

Required

The URI of a Web resource relative to the document root, used to authenticate the user. This can be an HTML page, JSP, or HTTP servlet, and must return an HTML page containing a FORM that conforms to a specific naming convention. For more information, see Setting Up Authentication for Web Applications.

<form-error-page>

Required

The URI of a Web resource relative to the document root, sent to the user in response to a failed authentication login.

 


security-role Element

The following table describes the elements you can define within a security-role element.

Element

Required/
Optional

Description

<description>

Optional

A text description of this security role.

<role-name>

Required

The role name. The name you use here must have a corresponding entry in the WebLogic-specific deployment descriptor, weblogic.xml, which maps roles to principals in the security realm. For more information, see security-role-assignment Element.

 


env-entry Element

The optional env-entry element declares an environment entry for an application. Use a separate element for each environment entry.

The following table describes the elements you can define within an env-entry element.

Element

Required/
Optional

Description

<description>

Optional

A textual description.

<env-entry-name>

Required

The name of the environment entry.

<env-entry-value>

Required

The value of the environment entry.

<env-entry-type>

Required

The type of the environment entry.

Can be set to one of the following Java types:

java.lang.Boolean

java.lang.String

java.lang.Integer

java.lang.Double

java.lang.Float

 


ejb-ref Element

The optional ejb-ref element defines a reference to an EJB resource. This reference is mapped to the actual location of the EJB at deployment time by defining the mapping in the WebLogic-specific deployment descriptor file, weblogic.xml. Use a separate <ejb-ref> element to define each reference EJB name.

The following table describes the elements you can define within an ejb-ref element.

Element

Required/
Optional

Description

<description>

Optional

A text description of the reference.

<ejb-ref-name>

Required

The name of the EJB used in the Web Application. This name is mapped to the JNDI tree in the WebLogic-specific deployment descriptor weblogic.xml. For more information, see ejb-reference-description Element.

<ejb-ref-type>

Required

The expected Java class type of the referenced EJB.

<home>

Required

The fully qualified class name of the EJB home interface.

<remote>

Required

The fully qualified class name of the EJB remote interface.

<ejb-link>

Optional

The <ejb-name> of an EJB in an encompassing J2EE application package.

<run-as>

Optional

A security role whose security context is applied to the referenced EJB. Must be a security role defined with the <security-role> element.

 

'web' 카테고리의 다른 글

[펌] Axis Webservice 설치및 테스트  (0) 2005.09.03
[펌] web.xml 사용법  (0) 2005.07.23
Tomcat 4.1.12 버전에서 서블릿 접근  (0) 2005.02.08
server.xml  (0) 2005.02.04
web.xml  (0) 2005.02.04
Posted by '김용환'
,

server.xml

web 2005. 2. 4. 06:43

<!--
설정 엘리먼트에 대한 설명은 아래과 같은 주요 카테고리로 분류됩니다:

최상위 엘리먼트(Top Level Elements) :: <Server>는 전체 설정 파일의 최상위 엘리먼트이며,
<Service>는 하나의 Engine과 결합된 Connector들의 모임을 나타냅니다.
-- Server, Service

커넥터(Connectors) :: 어떤 특정 Service에 요청을 보내는(그리고 응답을 받는)
외부 클라이언트들과의 연결점(interface)을 나타냅니다.
-- JTC Connectors, Coyote HTTP/1.1, Coyote JK 2, HTTP/1.1, JK, Webapp

컨테이너(Containers) :: 수신된 요청을 처리하고 그에 따른 응답을 생성하는 기능을 하는
컴포넌트들을 나타냅니다. 하나의 Engine은 하나의 Service에 대한 모든 요청을 다루며,
하나의 Host는 특정 가상호스트에 대한 모든 요청을 다룹니다. 그리고 하나의 Context는
특정 웹어플리케이션에 대한 모든 요청을 다룹니다.
-- Context, Engine, Host

내부 컴포넌트(Nested Components) :: Container에 속하는 어떤 엘리먼트 안에 중첩되어야
하는 엘리먼트입니다. 어떤 엘리먼트는 모든 Container 엘리먼트 안에 중첩될 수도 있고,
어떤 것은 Context 안에만 중첩가능합니다.
-- Default Context, Global Resources, Loader, Logger, Manager,Realm, Resources, Valve

-->

 

<!-- Example Server Configuration File -->
<!-- Note: 컴포넌트들은 각각의 부모-자식 관계에 따라 중첩(nested) 되었음 -->

<!-- "Server" 는 전체 JVM 을 나타내는 싱글톤 요소입니다. 이것은 하나 이상의
     "Service" 인스턴스를 갖고 있습니다. 서버는 지정된 포트를 통해 shutdown
     명령을 받습니다.

     Note: "Server" 는 스스로가 "Container" 가 아니기 때문에, "Valves" 또는
     "Loggers" 같은 서브 컴포넌트를 "Server" 와 같은 레벨에서 정의하면 안됩
     니다.
 -->

<Server port="8005" shutdown="SHUTDOWN" debug="0">


  <!-- "Service" 는 한 개의 "Container" 를 공유하는 하나 이상의 "Connectors"
       의 집합체입니다. (이 컨테이너 안에서 웹어플리케이션이 돌아갑니다). 보통
       은, 이 컨테이너가 "Engine" 입니다만, 요구되지는 않습니다. 

       Note:  "Service" 는 스스로가 "Container" 가 아니기 때문에, "Valves"
       또는 "Loggers" 같은 서브 컴포넌트를 "Server" 와 같은 레벨에서 정의하면
       안됩니다.
   -->


   <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>

 <!--
  GlobalNamingResources 엘리먼트는 JNDI의 전역자원을 나타내며,
  이 자원들은 Server 안에서 정의됩니다.

  웹애플리케이션에서 환경항목자원(environment entry resources)으로 사용할 수
  있도록 항목의 이름-값 들을 설정할 수 있습니다. 이 설정은 <Environment> 항목을
  이 엘리먼트 내에 중첩시키면 됩니다.
  
  예를 들어 아래와 같이 환경항목을 생성할 수 있습니다:
  
   <GlobalNamingResources ...>
    ...
    <Environment name="maxExemptions" value="10"
     type="java.lang.Integer" override="false"/>
    ...
  </GlobalNamingResources>

  이 설정은 웹애플리케이션 배치 디스크립터(/WEB-INF/web.xml)에서
  다음의 엘리먼트를 포함시킨 것과 동일합니다:
    
   <env-entry>
    <env-entry-name>maxExemptions</param-name>
    <env-entry-value>10</env-entry-value>
    <env-entry-type>java.lang.Integer</env-entry-type>
  </env-entry>

  그러나 이 값을 커스터마이즈하기 위해 배치 디스크립터를 변경할 필요는 없습니다.


  <Environment> 엘리먼트 속성값 --
  
  description :: (선택사항)이 환경항목에 대한 사람이 읽기 쉬운 간단한 설명
  
  name :: (반드시 설정) 생성할 환경항목의 이름.
  java:comp/env 컨텍스트에 대한 상대적인 이름입니다.
  
  override :: 웹애플리케이션 배치 디스크립터에서 <env-entry>으로 같은 이름의
  환경항목을 지정하는 경우, 여기에서 지정한 값을 덮어쓰기(override) 하지 않도록
  하고 싶으면 false로 지정합니다. 이 값을 지정하지 않으면 덮어쓰기가 허용됩니다.
  
  type :: (반드시 설정) 이 환경항목에 대해 웹애플리케이션이 예상하는 완전한(fully qualified) Java 클래스명.
  반드시 웹애플리케이션 배치 디스크립터의 <env-entry-type>의 규칙에 맞는 값이어야 합니다.
  그 규칙에 맞는 값 들은: java.lang.Boolean, java.lang.Byte, java.lang.Character,
  java.lang.Double, java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short,
  또는 java.lang.String 입니다.
  
  value :: (반드시 설정) 웹애플리케이션이 JNDI 컨텍스트로부터 요청해서 반환받을 환경항목의 값.
  이 값은 반드시 위의 type에 정의된 Java type으로 변환 가능해야 합니다.
  
  
  Resource Definitions
  웹애플리케이션 배치 디스크립터의 <resource-ref>와 <resource-env-ref> 엘리먼트의
  JNDI 탐색(lookup)에 대해 반환될 자원의 특성도 선언 가능합니다.
  그리고 어떤 자원에 대해서 객체팩토리를 사용하도록(Tomcat이 아직 모르는 경우),
  그리고 그 객체팩토리를 설정하는데 사용할 프로퍼티를 설정하려면, 반드시 그 자원과 같은 이름으로
  자원 파라미터(Resource Parameters)를 추가로 정의해야 합니다.

  예를 들어 다음과 같이 자원정의가 가능합니다:
  
   <GlobalNamingResources ...>
    ...
    <Resource name="jdbc/EmployeeDB" auth="Container"
     type="javax.sql.DataSource"
    description="Employees Database for HR Applications"/>
    ...
  </GlobalNamingResources>

  이 설정은 웹애플리케이션 배치 디스크립터(/WEB-INF/web.xml)에
  다음의 엘리먼트를 포함시킨 것과 동일합니다:
    
   <resource-ref>
    <description>Employees Database for HR Applications</description>
    <res-ref-name>jdbc/EmployeeDB</res-ref-name>
    <res-ref-type>javax.sql.DataSource</res-ref-type>
    <res-auth>Container</res-auth>
  </resource-ref>

   그러나 이 값을 커스터마이즈하기 위해 배치 디스크립터를 변경할 필요는 없습니다.


  <Resource> 엘리먼트 속성값 ---

  auth :: 해당 자원관리자에 인증(sign on)할 때 웹애플리케이션 프로그램의 코드상에서 직접 인증할지,
  또는 애플리케이션의 작동(behalf)에 따라 컨테이너가 직접 인증할지를 지정합니다.
  이 속성의 값은 반드시 Application 또는 Container 중 하나여야 합니다.
  이 속성은, 웹애플리케이션이 웹애플리케이션 배치 디스크립터에서 <resource-ref> 엘리먼트를
  사용하는 경우에는 반드시 필요합니다. 그러나 <resource-env-ref>를 대신 사용하는 경우에는 선택사항입니다.
  
  description :: (선택사항)이 자원에 대한 사람이 읽기 쉬운 간단한 설명
  
  name :: (반드시설정) 생성할 자원의 이름. java:comp/env 컨텍스트에 대한 상대적인 이름입니다.
  
  scope :: 이 자원관리자를 통해 얻어진 연결(connection)의 공유를 허가할 것인지 지정합니다.
  이 속성의 값은 반드시 Shareable 또는 Unshareable 중 하나여야 합니다.
  지정하지 않으면 연결은 공유가능(shareable)이 됩니다.
  
  type :: (반드시설정) 웹애플리케이션이 이 자원에 대해 탐색을 실행할 때 받고자 하는
  Java 타입을 나타내는 완전한 Java 클래스명.
  
  
  Resource Parameters
  이 엘리먼트는 웹애플리케이션에서 해당 자원의 이름에 대해 JNDI 탐색을 수행할 때,
  객체를 반환하는데 사용할 자원관리자(또는 객체팩토리)를 설정하는 역할을 합니다.
  $CATALINA_HOME/conf/server.xml의 <Context>나 <DefaultContext> 엘리먼트 내의
  <Resource> 엘리먼트로 지정된 모든 자원 이름, 그리고/또는 웹애플리케이션 배치 디스크립터에서
  <resource-ref> 나 <resource-env-ref> 엘리먼트에서 선언된 모든 자원 이름에 대해서는 반드시
  자원 파라미터(resource parameters)를 정의해야 그 자원에 성공적으로 액세스할 수 있습니다.

  자원 파라미터는 이름으로 정의되며, 정확하게 어떤 파라미터 이름들의 집합을 지원하는가는 당신이
  사용하고 있는 자원관리자(또는 객체팩토리)에 따라 달라집니다.
  즉 해당 팩토리 클래스의 JavaBeans 프로퍼티 중 설정가능한(settable) 프로퍼티의 이름과 일치해야 합니다.
  JNDI 구현체는 지정한 팩토리 클래스의 인스턴스에 대해 JavaBeans의 모든 해당 속성의
  설정메소드(setter)를 호출함으로써 모든 설정을 마친 다음에야,
  이 팩토리 인스턴스를 JNDI lookup() 호출을 통해 사용가능하도록 할 것입니다.

  예로 JDBC 데이터 소스에 대한 자원 파라미터 설정은 아래와 같이 됩니다:
   
   <GlobalNamingResources ...>
    ...
    <ResourceParams name="jdbc/EmployeeDB">
   <parameter>
     <name>driverClassName</name>
     <value>org.hsql.jdbcDriver</value>
   </parameter>
   <parameter>
     <name>driverName</name>
     </value>jdbc:HypersonicSQL:database</value>
   </parameter>
   <parameter>
     <name>user</name>
     <value>dbusername</value>
   </parameter>
   <parameter>
     <name>password</name>
     <value>dbpassword</value>
   </parameter>
    </ResourceParams>
    ...
  </GlobalNamingResources>


  만약 특정 자원 타입에 대해 팩토리 클래스의 Java 클래스명을 지정할 필요가 있다면,
  <ResourceParams> 엘리먼트 내의 <parameter> 항목에 factory라는 이름을 사용하면 됩니다.


  <ResourceParams> 엘리먼트가 가질 수 있는 속성은 다음과 같습니다:

  name :: (반드시 설정) 설정할 자원의 이름이며, java:comp/env 컨텍스트에 대한 상대적인 이름이 됩니다.
  이 이름은 $CATALINA_HOME/conf/server.xml 내에 <Resource> 엘리먼트로 정의된 자원,
  그리고/또는 웹애플리케이션 배치 디스크립터 내에 <resource-ref> 또는 <resource-env-ref>로
  참조되는 자원의 이름과 반드시 일치해야 합니다.
  
 -->

  <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>

  </GlobalNamingResources>

  <!-- Tomcat Stand-Alone Service 로 설정하기 -->
  <Service name="Tomcat-Standalone">

    <!-- "Connector" 는 요청을 받아서, 응답이 반환되는 종점(endpoint)을 나타냅니
         다. 각 커넥터는 처리를 담당하는 관련된 "Container"(보통 "엔진")로 요청을
         전달해줍니다.

         기본값으로, 8080포트에 non-SSL HTTP/1.1 커넥터가 설정되어있습니다.
         SSL HTTP/1.1 커넥터 역시 사용하려면 아래에 있는 지시를 따라서 하고, 두번
         째 커넥터 엔트리의 주석표시를 지워주시면 됩니다. SSL 지원은 다음 단계를
         거쳐야 합니다:
         * JSSE 1.0.2 또는 이후 버전을 다운받아서 설치하고, JAR 파일들을
           "$JAVA_HOME/jre/lib/ext" 디렉토리에 복사해 놓습니다.
         * "$JAVA_HOME/jre/lib/security/java.security" 를 편집하고
           security.provider.2=com.sun.net.ssl.internal.ssl.Provider 를 추가합
           니다.
         * 실행: keytool -genkey -alias tomcat -keyalg RSA
           패스워드 값"changeit" 으로 실행합니다.

         기본적으로, DNS lookups 는 웹어플리케이션이 request.getRemoteHost() 를
         부를 때 동적하도록 되어있습니다. 이것은 성능에 영향을 줄 수 있기 때문에,
         "enableLookups" 속성을 "false" 로 바꿔주면 이 기능을 사용하지 않을 수
         있습니다.  DNS lookups 가 사용하지 않게 되면 request.getRemoteHost() 는
         remote client 의 IP 주소의 String 버전을 반환할 것입니다.
    -->

    <!-- 8080 포트에 non-SSL HTTP/1.1 Connector 설정하기 -->
    <Connector className="org.apache.catalina.connector.http.HttpConnector"
               port="80" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="60000"/>
    <!-- Note : 커넥션 타임아웃을 사용하지 않으려면, connectionTimeout 값을 -1로
      수정해 주세요.-->

    <!-- 8443 포트에 SSL HTTP/1.1 Connector 설정하기 -->
    <!--
    <Connector className="org.apache.catalina.connector.http.HttpConnector"
               port="8443" minProcessors="5" maxProcessors="75"
               enableLookups="true"
        acceptCount="10" debug="0" scheme="https" secure="true">
      <Factory className="org.apache.catalina.net.SSLServerSocketFactory"
               clientAuth="false" protocol="TLS"/>
    </Connector>
    -->

    <!-- 8081 포트에 Proxied HTTP/1.1 Connector 설정하기 -->
    <!-- 사용법에 대한 자세한 내용은 proxy 문서를 보십시오. -->
    <!--
    <Connector className="org.apache.catalina.connector.http.HttpConnector"
               port="8081" minProcessors="5" maxProcessors="75"
               enableLookups="true"
               acceptCount="10" debug="0" connectionTimeout="60000"
               proxyPort="80"/>
    -->

    <!-- 8082 포트에 non-SSL HTTP/1.0 Test Connector 설정하기 -->
    <!--
    <Connector className="org.apache.catalina.connector.http10.HttpConnector"
               port="8082" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0"/>
    -->

    <!-- Engine 은 (Catalina 에서) 모든 요청을 처리하는 입력지점을 나타냅니다.
         Tomcat stand alone 용으로 구현된 Engine 은 요청에 포함된 HTTP 헤더를 분
         석하고, 적당한 Host (가상 호스트) 로 전달하는 역할을 합니다. -->

    <!-- 속성값
  defaultHost :: 디폴트 호스트명. 설정 파일에서는 정의되지 않았지만 이 서버 상에 있는 호스트명 중에서
  요청을 처리할 Host를 식별합니다. 이 이름은 반드시 바로 안에 중첩된 Host 엘리먼트 중
  하나의 name 속성과 일치해야 합니다.
  ※ 반드시 설정

  name :: 이 Engine의 논리적인 이름이며, 로그와 에러메시지에서 사용됩니다.
  ※ 반드시 설정

  className :: 사용할 구현체의 Java 클래스명.
  이 클래스는 반드시 org.apache.catalina.Engine를 구현해야 합니다.
  지정하지 않으면 표준값(아래에 정의됨)이 사용됩니다.
  
  jvmRoute :: 로드밸런싱 시나리오에서 세션유지를 위해서 반드시 사용해야 할 식별자.
  이 식별자는 클러스터에 참가하는 모든 Tomcat 4 서버에 대해 반드시 유일해야 합니다.
  생성되는 세션 식별자에는 이 식별자가 추가되어, 가장 앞단의 프록시가 특정 세션을
  항상 같은 Tomcat 4 인스턴스로 포워드 할 수 있게 합니다.
  
  debug :: 이 Engine이 해당 Logger 에 디버깅 로그를 출력하는 상세수준을 의미합니다.
  숫자가 높을 수록 더 자세한 출력을 생성합니다. 지정하지 않는 경우 디버깅 상세수준의 디폴트 값은 0 입니다.

 -->

    <!-- 컨테이너 구조에서 top level 컨테이너 설정하기 -->
    <Engine name="Standalone" defaultHost="localhost" debug="0">

      <!-- 요청 dumper 밸브는 Tomcat 의 인스턴스의 모든 요청을 받는 동안 들어온
           요청 헤더와 쿠키, 보내질 응답 헤더와 쿠키에 대해 유용한 디버깅 정보를
           덤프합니다. 만일 특정한 가상호스트, 또는 특정한 어플리케이션에 들어온
           요청에만 만 관심을 갖고자 한다면, 이 요소를 해당하는 <Host> 나 <Context>
           엔트리 아래에 위치시켜주십시오.

           모든 서블릿 2.3 컨테이너에 유동적인 유사한 동작구조를 위해서, 예제
           어플리케이션에 있는 "RequestDumperFilter" 필터를 확인하십시오.
           (소스는 "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters"
           위치에 있을 것입니다.)

           기본적으로 Request dumping 기능은 사용하지 않는 것으로 되어있습니다.
           다음의 요소에서 주석을 빼면 사용할 수 있습니다. -->
      <!--
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      -->

      <!-- 하위수준에서 지정되지 않았다면 사용되는 Global Logger -->
   <!--
    이 Engine에 대한 모든 로그 메시지를 받아서 처리할 로거(logger)를 설정합니다.
    이 로거는 이 Engine 외에도 이 Engine이 정의된 Service의 Connectors로부터의
    로그도 처리합니다. 또 이 로거는 하위에서 Logger 설정을 따로 하지 않는 경우,
    하위의 Host와 Context에서의 로그도 처리합니다.
  -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>

      <!-- 이 Realm 이 여기에 있기 때문에, 인스턴스는 전체적으로 공유됩니다. -->
   <!--
   영역(realm)을 설정하여, 사용자와 사용자의 역할을 저장할 데이터베이스를
   이 Engine에 포함된 모든 Host와 Context 에서 공유할 수 있도록 합니다.
   하위에서 Realm 설정이 정의되면 여기의 설정은 무시됩니다.
   -->
      <Realm className="org.apache.catalina.realm.MemoryRealm" />

      <!-- 데이터베이스에 저장되고 JDBC 를 통해서 접근하는 Realm 을 사용하려면
           위 Realm 을 다음의 Realm 중 하나와 대치하십시오. -->

      <!--
      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
             driverName="org.gjt.mm.mysql.Driver"
          connectionURL="jdbc:mysql://localhost/authority?user=test;password=test"
              userTable="users" userNameCol="user_name" userCredCol="user_pass"
          userRoleTable="user_roles" roleNameCol="role_name" />
      -->

      <!--
      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
             driverName="oracle.jdbc.driver.OracleDriver"
          connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL?user=scott;password=tiger"
              userTable="users" userNameCol="user_name" userCredCol="user_pass"
          userRoleTable="user_roles" roleNameCol="role_name" />
      -->

      <!--
      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
             driverName="sun.jdbc.odbc.JdbcOdbcDriver"
          connectionURL="jdbc:odbc:CATALINA"
              userTable="users" userNameCol="user_name" userCredCol="user_pass"
          userRoleTable="user_roles" roleNameCol="role_name" />
      -->
  
   <!--
   웹서버를 운영할 때 일반적으로 생성되는 출력 파일중 하나가 액세스 로그(access log)입니다.
   이 로그는 서버가 처리하는 각 요청마다 표준 포맷에 따라 한 라인씩 출력합니다.
   Catalina에서는 Valve 구현을 통해, 웹서버들이 표준 포맷에 따라 생성하는 액세스 로그와 같은
   포맷의 로그를 생성할 수도 있고, 또는 다양한 커스텀 포맷으로 로그를 생성할 수 있도록 하고 있습니다.
   당신은 Catalina에 Engine, Host, 또는 Context가 처리하는 모든 요청에 대한 액세스 로그를 생성하도록
   지시할 수 있는데, 이는 다음과 같이 Valve 엘리먼트를 중첩시키면 됩니다:
 
  <Valve className="org.apache.catalina.valves.AccessLogValve"
         prefix="catalina_access_log." suffix=".txt"
         pattern="common"/>

   -->

      <!-- default virtual host 설정하기 -->
   <!-- 속성값
   appBase :: 이 가상호스트에 대한 어플케이션의 기준(Application Base) 디렉토리.
   이는 이 가상호스트에 배치될 웹어플리케이션 들을 가지고 있는 디렉토리의 패스명입니다.
   이 디렉토리의 절대경로명을 지정할 수도 있으며, 또는 $CATALINA_HOME 디렉토리에
   상대적인 경로명을 지정할 수도 있습니다.
   ※ 반드시 설정

   autoDeploy :: 이 플래그 값은 이 호스트의 웹어플리케이션 들은
   호스트 설정자(host configurator)에 의해 자동으로 배치(deploy)되어야 함을 나타냅니다.
   이 플래그의 디폴트값은 true 입니다. 

   className :: 사용할 구현체의 Java 클래스명.
   이 클래스는 반드시 org.apache.catalina.Host 인터페이스를 구현해야 합니다.
   지정하지 않으면 표준값(아래에 정의됨)이 사용될 것입니다.

   name :: 당신의 Domain Name Service 서버에 등록된 이 가상호스트의 네트워크 명칭.
   Engine에 포함된 Host 중 하나는 반드시 그 Engine의 defaultHost 세팅과 일치하는 이름을 가져야 합니다.
   ※ 반드시 설정

   debug :: 이 Host가 해당 로거에 디버깅 로그를 출력하는 상세수준을 의미합니다.
   숫자가 높을 수록 더 자세한 출력을 생성합니다. 지정하지 않으면, 디버깅 상세수준의 디폴트 값은 0 입니다

   deployXML :: Context XML 설정 파일을 사용하여 어플리케이션을 배치하는 기능을
   끄고 싶다면 false로 지정하십시오. 배치되는 어플리케이션 들은 Catalina의
   보안권한(security permissions)가 주어집니다. 만약 신뢰할 수 없는(untrusted)
   사용자가 웹어플리케이션에 접근가능한 상황이라면 보안상 false로 할 필요가 있습니다.
   디폴트 값은 true입니다.

   errorReportValveClass :: 이 Host가 사용할 오류보고밸브(error reporting valve)의
   Java 클래스명. 이 밸브의 임무는 에러보고를 출력하는 것입니다.
   이 속성을 설정하면 Tomcat이 생성하는 에러페이지의 외관(look)을 커스터마이즈 할 수
   있습니다. 이 클래스는 반드시 org.apache.catalina.Valve 인터페이스를 구현해야 합니다.
   아무것도 지정하지 않은 경우에는 org.apache.catalina.valves.ErrorReportValve가
   디폴트로 사용됩니다.

   liveDeploy :: Tomcat 운영 도중에 appBase 디렉토리에 새로운 웹어플리케이션을
   추가했을 경우, 이 플래그 값이 true이면 이 웹어플리케이션이 자동으로 배치됩니다.
   디폴트 값은 true입니다.

   unpackWARs :: 웹어플리케이션이 appBase 디렉토리에 웹어플리케이션 아카이브(WAR)
   파일로 존재할 때, WAR 파일을 해당 디스크 디렉토리 구조로 풀어서(unpack) 실행되길
   원하는 경우에는 true로 설정하십시오. false로 설정하면 WAR 파일형태로 직접 실행됩니다.

   workDir :: 이 Host에서 사용할 임시 디렉토리에 대한 경로명입니다.
   이 디렉토리는 관련 웹어플리케이션의 서블릿들이 임시로 읽기-쓰기 작업을 하는 용도로 사용합니다.
   웹어플리케이션의 서블릿들은 이름이 javax.servlet.context.tempdir인
   서블릿-컨텍스트 속성(타입은 java.io.File)을 통해 이 디렉토리를 볼 수 있으며,
   이 내용은 서블릿 스펙에 기술되어 있습니다. 지정하지 않은 경우에는 적절한 디렉토리가
   $CATALINA_HOME/work 아래에 제공됩니다.

   -->
      <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
  <!--
   많은 서버 환경에서 네트워크 관리자들은 서버의 IP 주소로 해독(resolve) 되는 하나 이상의
   네트워크 명칭(Domain Name Service (DNS) 서버에 있는)을 설정하곤 합니다.
   보통 이런 네트워크 명칭은 conf/server.xml 에서 별도로 Host 엘리먼트로 설정됩니다.
   이 각각의 Host 엘리먼트는 자신만의 웹어플리케이션 집합을 가지게 됩니다.
   그러나 일부 환경에서는 둘 이상의 네트워크 명칭을 같은 가상호스트로 해독되어야
   좋은 경우가 있습니다. 이런 경우는 대개 기업의 웹사이트에서 많이 발견됩니다.
   즉 사용자가 www.mycompany.com를 써도 company.com를 써도, 정확히 같은 컨텐츠와
   어플리케이션에 액세스되어야 되는 경우입니다.
   이러한 경우에는 하나 또는 그 이상의 Alias 엘리먼트를 Host 엘리먼트 내에 포함시키면 됩니다.
   예를 들면:

   <Alias>mycompany.com</Alias>
  -->

        <!-- 보통, 사용자는 각각의 웹 어플리케이션에 인증을 해줘야만 합니다.
             사용자가 security 제한에 걸려있는 보호된 자원 중에서 처음에 걸리는
             인증을 한번만 통과하고, 이 가상호스트 안의 "모든" 웹어플리케이션에
             통과된 인증으로 접근하게 하려면 아래 엔트리의 주석을 해제하십시오.
        -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn"
                   debug="0"/>
        -->

        <!-- Access log는 이 가상호스트에 접속하는 모든 요청을 처리합니다. 기본값은
             로그 파일은 $CATALINA_HOME 에 상대적인 "logs" 디렉토리에 생성됩니다.
             "directory" 속성을 이용해서 원하는 다른 디렉토리로 지정할 수 있습니다.
             ($CATALINA_HOME 에 대해) 상대적인 디렉토리나 또는 원하는 디렉토리의
             절대 경로를 써주면 됩니다.
        -->
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="localhost_access_log." suffix=".txt"
                 pattern="common"/>

        <!-- 이 가상 호스트에 관계된 모든 Context 에 의해 공유된 Logger. 기본값은
             (FileLogger 를 사용할 때), 로그 파일들은 $CATALINA_HOME 에 상대적인
             "logs" 디렉토리에 생성됩니다. "directory" 속성을 이용해서 원하는 다른
             디렉토리로 지정할 수 있습니다. ($CATALINA_HOME 에 대해) 상대적인 디렉
             토리나 또는 원하는 디렉토리의 절대 경로를 써주면 됩니다.
        -->
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
         timestamp="true"/>

        <!-- 각각의 웹 어플리케이션에 대한 프로퍼티 설정. 이것은 기본값과는 다른 프로
             퍼티를 설정하기 윈할 때나, 웹어플리케이션 document 루트 디렉토리가 가상
             호스트의 appBase 디렉토리와 다른 곳에 있을 경우에만 필요합니다.
        -->

 


        <!-- Tomcat Root Context -->
        <!--
          <Context path="" docBase="ROOT" debug="0"/>
        -->

        <!-- Tomcat Examples Context -->
  <!--
   Context 엘리먼트는 특정 가상호스트 내에서 실행되는 웹어플리케이션을 나타냅니다.
   각 웹어플리케이션은 웹어플리케이션 아카이브(Web Application Archive) (WAR) 파일 또는,
   패킹하지 않은 채로 그에 상응하는 내용을 담고 있는 디렉토리를 기준으로 하며,
   이러한 내용은 서블릿 스펙(버전 2.2 또는 그 이상)에 설명되어 있습니다.
   웹어플리케이션 아카이브에 관한 더 많은 정보를 원하시면 서블릿 스펙을 다운로드해서 참고하십시오.
   그리고 Tomcat 어플리케이션 개발자 가이드(Application Developer's Guide)를 검토하시기 바랍니다.

   각 HTTP 요청을 처리하는데 사용할 웹어플리케이션의 선택은, 각각 정의된 Context의 컨텍스트
   경로(context path)에 대해 요청 URI의 가능한 전치어(prefix) 중 가장 길게 매칭가능한 컨텍스트 경로를
   가진 컨텍스트를 선택함으로써 이루어집니다. 선택된 Context는 수신된 요청을 처리하기 위해 적절한
   서블릿을 선택합니다.
   서블릿 선택 작업은 웹어플리케이션 배치 디스크립터(web application deployment descriptor)
   파일(반드시 웹어플리케이션 디렉토리 하위의 /WEB-INF/web.xml에 위치함)에 정의된
   서블릿 매핑 정보에 따라서 이루어집니다.

   Context 엘리먼트는 횟수의 제한 없이 정의할 수 있으며, conf/server.xml의
   Host 엘리먼트 내에 중첩시키면 됩니다.  각각의 Context는 반드시 유일한 컨텍스트
   경로를 가져야 하며, 컨텍스트 경로는 path 속성으로 정의됩니다.
   또 컨텍스트 경로의 문자열 길이가 0인 Context를 추가로 지정해야 하는데,
   이렇게 정의한 Context는 이 가상 호스트에 대하여 default 웹어플리케이션이 되어,
   다른 어떤 Context의 컨텍스트 경로에도 매칭되지 않는 모든 요청을 처리하는데 사용됩니다.

   Context 엘리먼트를 Host 엘리먼트에 중첩시키는 방법 외에도, Host의 appBase로
   지정된 디렉토리 안에 이들을 각각의 파일(확장자는 ".xml")로 저장하는 방법이 있습니다.
   어플리케이션의 자동배치(Automatic Application Deployment)에서 더 자세한 정보를 볼 수 있습니다.

   명시적으로 Context 엘리먼트를 지정하는 방법 뿐만 아니라, 당신을 위해 자동으로
   Context 엘리먼트를 생성해 주는 몇가지 테크닉도 존재합니다.
   어플리케이션의 자동배치(Automatic Application Deployment)와
   사용자 웹어플리케이션(User Web Applications)에서 더 많은 정보를 볼 수 있습니다.

   이하의 설명에서는 $CATALINA_HOME 변수명을 사용하여 당신이 Tomcat 4를 설치한
   디렉토리를 참조하며, 이 디렉토리가 대부분의 상대경로에 대한 기준 디렉토리(base directory)가 됩니다.
   그러나 만약 CATALINA_BASE 디렉토리를 설정하여 Tomcat 4를 여러개 설치했다면,
   이러한 디렉토리 변수 참조에 대해 $CATALINA_HOME 대신 $CATALINA_BASE 를
   사용해야 합니다.

  -->

  <!-- 속성값
   docBase :: 이 웹어플리케이션에 대한 Document Base (Context Root로도
   알려져 있습니다) 디렉토리, 또는 웹어플리케이션 아카이브 파일의 경로명(웹어플리케이션을
   WAR 파일로 직접 실행하는 경우)을 나타냅니다. 이 디렉토리나 WAR 파일에에 대한
   절대경로명을 지정할 수도 있고, 이 Context가 정의된 Host의 appBase 디렉토리에 대한
   상대경로명을 지정할 수도 있습니다.
   ※반드시 설정
   
   path :: 이 웹어플리케이션의 컨텍스트 경로(context path)를 나타내며, 각 요청
   URI의 시작부분이 컨텍스트 경로와 같을 때 해당 웹어플리케이션이 그 요청을 처리하게 됩니다.
   하나의 특정 Host 내의 컨텍스트 경로들은 모두 각각 유일해야 합니다.
   만약 컨텍스트 경로를 빈 스트링("")으로 지정하면, 이 Context는 이 Host에 대한
   디폴트 웹어플리케이션으로 정의된 것입니다.
   디폴트 웹어플리케이션은 다른 Context 들에 해당되지 않는 모든 요청을 처리할 것입니다.
   ※반드시 설정

   className :: 사용할 Java 구현체 클래스의 이름.
   이 클래스는 반드시 org.apache.catalina.Context 인터페이스를 구현해야 합니다.
   지정하지 않으면 표준값 (아래에 정의됩니다)이 사용됩니다.

   cookies :: true(디폴트)로 지정하면 클라이언트가 쿠키를 지원하는 경우
   세션확인의 통신수단(session identifier communication)으로 쿠키를 사용합니다.
   false로 지정하면 세션확인의 통신수단으로 쿠키 사용을 하지 않고,
   어플리케이션에 의한 URL 다시쓰기(URL rewriting)에만 의존한다는 의미입니다.

   crossContext :: true로 지정하면 이 어플리케이션에서 ServletContext.getContext()
   호출을 통해, 이 가상호스트에서 실행중인 다른 웹어플리케이션에 대한
   요청디스패쳐(request dispatcher)를 성공적으로 얻을 수 있습니다.
   보안상의 이유로 false(디폴트)로 지정하면 getContext()는 언제나 null을 반환하게 됩니다.

   override :: 이 Context가 정의된 Host의 DefaultContext에 정의된 각 설정내용을,
   이 Context 엘리먼트에서 재정의(override) 할 수 있도록 하려면 true로 지정합니다.
   디폴트로는 DefaultContext 엘리먼트의 설정이 사용되도록 되어 있습니다.
   
   privileged :: true로 설정하면 이 컨텍스트는 관리자서블릿(manager servlet) 같은
   컨테이너 서블릿을 사용할 수 있습니다.    

   reloadable :: true로 지정하면, Catalina는 /WEB-INF/classes/와 /WEB-INF/lib 안
   클래스 들의 변경여부를 감시하다가, 변경이 발견되면 웹어플리케이션을 자동으로 재적재(reload)합니다.
   이 기능은 개발중에는 매우 유용하지만 얼마간의 실행부하(runtime overhead)가 발생하므로,
   실제 운영할 용도로 어플리케이션을 배치(deploy)할 때는 사용하지 않도록 합니다.
   그러나 이미 배치가 끝난 어플리케이션이라도 Manager 웹어플리케이션을 이용하면 필요할 때
   재적재 하도록 할 수 있습니다.

   wrapperClass :: 이 Context로 관리할 서블릿 들에 대해 사용할 org.apache.catalina.Wrapper 구현체
   클래스의 Java 클래스명입니다. 지정하지 않으면 표준값이 사용됩니다.

   useNaming :: 이 웹어플리케이션에서 Java2 Enterprise Edition (J2EE) 플랫폼 규약에 맞는
   JNDI InitialContext를 사용가능하게 하도록 설정하려면 true(디폴트값)로 지정합니다.

  -->
        <Context path="/examples" docBase="examples" debug="0"
                 reloadable="true">

    <!--
    이 Context에 대한 모든 로그 메시지를 받아서 처리할 로거(logger)를 설정합니다.
    이 로거는 ServletContext.log() 호출을 통해 기록될 어플리케이션 로그 메시지도 처리합니다.

    Logger 엘리먼트는, Catalina 컨테이너(Engine, Host, 또는 Context)의 로깅, 디버깅,
    그리고 에러메시지(스택 트레이스 포함)의 목적지(destination)를 나타냅니다.
    또한 어떤 Engine이나 Host와 연결된 Logger 들은 명시적으로 재설정하지 않으면
    자동적으로 하위의 컨테이너로부터 설정을 물려 받습니다.

    웹서버같이 액세스로그를 만드는데 관심이 있다면(가령 히트수 분석 소프트웨어를 돌리려고),
    그 Engine, Host, 또는 Context의 액세스로그 밸브(Access Log Valve) 컴포넌트 설정이 필요할 것입니다.


    -- 속성값 --

    className :: (반드시 설정) 사용할 Java 구현체 클래스의 이름.
    이 클래스는 반드시 org.apache.catalina.Logger 인터페이스를 구현해야 합니다.
    지정하지 않으면 표준값(아래에 정의됩니다)이 사용됩니다.
 
    verbosity :: 이 로거에 대한 상세수준(verbosity level).
    지정한 값보다 높은 상세수준의 메시지는 조용히 무시됩니다.
    가능한 값은 0 (중요 메시지만), 1 (에러), 2 (경고), 3 (정보), 그리고 4 (디버그) 입니다.
    지정하지 않은 경우 1 (에러) 입니다.

    NOTE - 명시적 상세수준을 가진 메시지만 이 값과 비교하여 로그여부를 결정합니다.
    명시적 상세수준이 없는 메시지는 무조건 로그됩니다.
 
    
    대부분의 Catalina 컴포넌트와는 달리 Logger의 경우에는, 사용할 수 있는
    표준 구현체가 여러개입니다. 따라서 사용하고자 하는 구현체를 반드시
    className 속성을 사용해서 지정해야 합니다.

    
    File Logger (org.apache.catalina.logger.FileLogger)
    File Logger는 한 지정된 디렉토리 안의 파일에 로그되는 메시지를 기록합니다.
    로그파일의 실제 파일명은 설정된 prefix, YYYY-MM-DD 포맷의 현재 날짜,
    그리고 설정된 suffix로 이루어집니다. 각 날의 자정을 지난 이후에 어떤 메시지가 로그되면,
    이 메시지가 발생하자마자 현재의 로그파일은 닫혀지고 새 로그파일이 새 날짜로 생성되어 열립니다.
    따라서 이런 로그파일의 전환 때문에 Catalina를 재부팅시킬 필요는 없습니다.

    
    File Logger가 지원하는 속성은 다음과 같습니다:

    directory :: 이 로거가 생성할 로그파일이 위치할 디렉토리의 절대/상대경로명.
    상대경로로 지정되면 $CATALINA_HOME을 기준으로 해석합니다.
    directory 속성을 지정하지 않으면 디폴트 값은 "logs"($CATALINA_HOME에 상대적임) 입니다.
    
    prefix  :: 각 로그파일명의 시작부분에 붙여질 prefix. 지정하지 않으면 "catalina."이 됩니다.
    아무 prefix도 붙이지 않으려면 길이가 0인 문자열("")을 사용하면 됩니다.
    
    suffix :: 각 로그파일명의 끝부분에 붙여질 suffix. 지정하지 않으면 ".log"가 됩니다.
    아무 suffix도 붙이지 않으려면 길이가 0인 문자열("")을 사용하면 됩니다.
    
    timestamp :: 모든 로그메시지에 날짜와 시간을 붙이려면 true로 지정하십시오.
    false(디폴트)로 지정하면 날짜와 시간은 찍히지 않습니다.
    

    Standard Error Logger (org.apache.catalina.logger.SystemErrLogger)
    Standard Error Logger는, Catalina의 표준 에러출력스트림으로 정해진 스트림으로 로그되는
    모든 메시지를 기록합니다. Catalina의 디폴트 기동 스크립트에서는 표준 에러출력스트림을
    $CATALINA_HOME 아래의 logs/catalina.out 파일로 지정해 놓습니다.
    이 로거에서 지원하는 추가 속성은 없습니다.

    Standard Output Logger (org.apache.catalina.logger.SystemOutLogger)
    Standard Output Logger는, Catalina의 표준 출력스트림으로 정해진 스트림으로 로그되는
    모든 메시지를 기록합니다. Catalina의 디폴트 기동 스크립트에서는 표준 출력스트림을
    $CATALINA_HOME 아래의 logs/catalina.out 파일로 지정해 놓습니다.
    이 로거에서 지원하는 추가 속성은 없습니다.


    -->
          <Logger className="org.apache.catalina.logger.FileLogger"
                     prefix="localhost_examples_log." suffix=".txt"
           timestamp="true"/>
          <Ejb   name="ejb/EmplRecord" type="Entity"
                 home="com.wombat.empl.EmployeeRecordHome"
               remote="com.wombat.empl.EmployeeRecord"/>
          <!-- PersistentManager: 영속적인 세션을 테스트 하기위해서는 아래
               섹션의 주석을 지워주십시오.
                        
               saveOnRestart: true 값일 경우, Catalina 가 shutdown 될 때
                 모든 살아있는 세션들은 다른 세팅과는 상관없이, Store 에
                 저장될 것입니다. startup 할 때 Store 에 있는 모든 세션들
                 은 자동으로 로드됩니다. expiration 이 지난 세션들은 양쪽
                 의 경우에 무시됩니다.
               maxActiveSessions: 0 이상의 값일 경우, 너무 많은 살아 있는 세
                 션이 있다면 몇몇은 없어져버리는 결과가 있을 수 있습니다.
                 minIdleSwap 은 이것을 제한합니다. -1 은 무한 세션을 허가한
                 다는 뜻입니다. 0 은 사용 후 세션은 거의 모두 없어져 버립니다
                 - 사용자들에게 인지될 정도로 느리게 될 것입니다.
               minIdleSwap: 세션은 적어도 이기간 동안 idle 상태이어야 합니다.
                 (초 단위로) 없어지기 전에 말이죠.
               maxActiveSessions. 이것은 사이트가 아주 활발할 때 thrashing 을
                 피하게 합니다. -1 이나 0 은 minimum 이 없다는 뜻입니다 - 세션
                 은 어느때라도 소멸될 수 있습니다.
               maxIdleSwap: (초 단위로) 세션은 이 기간동안 idle 상태면 소멸됩
                 니다. minIdleSwap 이 보다 높다면, 그것으로 바꿔집니다.
                 이것은 정확하지 않습니다: 주기적으로 확인합니다.
                 -1 은 maxActiveSessions 값으로 인해 소멸되어야 해도, 세션은
                 소멸되지 않음을 의미합니다. 0 이상으로 세팅되면, startup 할 때
                 Store 에 있는 모든 세션은 로드될 것을 보장합니다.
               maxIdleBackup: (Store 에 저장되었지만, active 메모리에 남아있는)
                 세션은 백업될 것입니다. 이 기간동안 idle 상태고, startup 할 때
                 Store 에 있는 모든 세션들이 로드될 것입니다. -1 로 설정되었다면
                 세션은 백업되지 않을 것이고, 0 은 사용된 뒤에 잠깐 백업된다는
                 것을 의미합니다.

               Store 에 있는 세션을 지우려면, maxActiveSessions, maxIdleSwap,
               minIdleBackup 모두를 -1 로, saveOnRestart 는 false로 세팅한 후,
               Catalina 를 재시동합니다.
          -->
    <!--
          <Manager className="org.apache.catalina.session.PersistentManager"
              debug="0"
              saveOnRestart="true"
              maxActiveSessions="-1"
              minIdleSwap="-1"
              maxIdleSwap="-1"
              maxIdleBackup="-1">
                <Store className="org.apache.catalina.session.FileStore"/>
          </Manager>
    -->
          <Environment name="maxExemptions" type="java.lang.Integer"
                      value="15"/>
          <Parameter name="context.param.name" value="context.param.value"
                     override="false"/>
          <Resource name="jdbc/EmployeeAppDb" auth="SERVLET"
                    type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/TestDB">
            <parameter><name>user</name><value>sa</value></parameter>
            <parameter><name>password</name><value></value></parameter>
            <parameter><name>driverClassName</name>
              <value>org.hsql.jdbcDriver</value></parameter>
            <parameter><name>driverName</name>
              <value>jdbc:HypersonicSQL:database</value></parameter>
          </ResourceParams>
          <Resource name="mail/Session" auth="Container"
                    type="javax.mail.Session"/>
          <ResourceParams name="mail/session">
            <parameter>
              <name>mail.smtp.host</name>
              <value>localhost</value>
            </parameter>
          </ResourceParams>
        </Context>

      </Host>

   <Host name="webmail.starit.net">
          <Context path="" docBase="/usr/local/tomcat/webapps/webmail" debug="0" reloadable="true">

   
   <!-- 자원정의 (Resource Definitions)
    웹어플리케이션 배치 디스크립터의 <resource-ref>와 <resource-env-ref> 엘리먼트의
    JNDI 탐색(lookup)에 대해 반환될 자원의 특성도 선언 가능합니다.
    그리고 어떤 자원에 대해서 객체팩토리를 사용하고(Tomcat이 아직 모르는 경우)
    그 객체팩토리를 설정하는데 사용할 프로퍼티를 설정하려면, 반드시 그 자원과 같은
    이름으로 자원 파라미터(Resource Parameters)를 추가로 정의해야 합니다.
   -->

   <!--
    예를 들어 다음과 같이 자원정의가 가능합니다:
  
     <Context ...>
      ...
      <Resource name="jdbc/EmployeeDB" auth="Container"
       type="javax.sql.DataSource"
      description="Employees Database for HR Applications"/>
      ...
    </Context>

    이것은 웹어플리케이션 배치 디스크립터(/WEB-INF/web.xml)에
    다음의 엘리먼트를 포함시킨 것과 동일합니다:

        <resource-ref>
      <description>Employees Database for HR Applications</description>
      <res-ref-name>jdbc/EmployeeDB</res-ref-name>
      <res-ref-type>javax.sql.DataSource</res-ref-type>
      <res-auth>Container</res-auth>
    </resource-ref>
   -->

   <!-- 속성값
    name :: (반드시설정) 생성할 자원의 이름. java:comp/env 컨텍스트에 대한 상대적인 이름입니다.

    type :: (반드시설정) 웹어플리케이션이 이 자원에 대해 탐색(lookup)을 실행할 때 기대하는 완전한 Java 클래스명.

    auth :: 해당 자원관리자에 인증(sign on)할 때, 웹어플리케이션 프로그램의 코드상에서 직접 할지,
    또는 컨테이너가 직접 어플리케이션의 행위(behalf)에 따라 할지를 지정합니다.
    이 속성의 값은 반드시 Application 또는 Container 중 하나여야 합니다.
    이 속성은, 웹어플리케이션이 웹어플리케이션 배치 디스크립터에서 <resource-ref> 엘리먼트를
    사용하는 경우에는 반드시 필요합니다.
    그러나 <resource-env-ref>를 대신 사용하는 경우에는 선택사항입니다.
    
    description :: (선택사항)이 자원에 대한 사람이 읽기 쉬운 간단한 설명
    
    scope :: 이 자원관리자를 통해 얻어진 연결(connection)의 공유를 허가할 것인지 지정합니다.
    이 속성의 값은 반드시 Shareable 또는 Unshareable 중 하나여야 합니다.
    지정하지 않으면 연결은 공유가능(shareable)이 됩니다.

   -->
   <!-- JNDI setting for jdbc -->
    <Resource name="jdbc/webmail" auth="Container"
       type="javax.sql.DataSource">
   </Resource>

   <!--
    사용할 자원 factory implementation 의 자바 클래스명과 자원 factory 를
    설정하는 데 사용되는 JavaBeans 프로퍼티를 설정합니다.

    이 엘리먼트는 웹어플리케이션에서 해당 자원의 이름에 대해 JNDI 탐색을 수행할 때,
    객체를 반환하는데 사용할 자원관리자(또는 객체팩토리)를 설정하는 역할을 합니다.
    $CATALINA_HOME/conf/server.xml의 <Context>나 <DefaultContext> 엘리먼트 내의
    <Resource> 엘리먼트로 지정된 모든 자원 이름, 그리고/또는 웹어플리케이션
    배치 디스크립터에서 <resource-ref> 나 <resource-env-ref> 엘리먼트에서
    선언된 모든 자원 이름에 대해서는 반드시 자원 파라미터(resource parameters)를
    정의해야 그 자원에 성공적으로 액세스할 수 있습니다.

    자원 파라미터는 이름으로 정의되며, 정확하게 어떤 파라미터 이름들의 집합을 지원하는가는
    당신이 사용하고 있는 자원관리자(또는 객체팩토리)에 따라 달라집니다.
    즉 해당 팩토리 클래스의 JavaBeans 프로퍼티 중 설정가능한(settable) 프로퍼티의 이름과
    일치해야 합니다. JNDI 구현체는 지정한 팩토리 클래스의 인스턴스에 대해 JavaBeans의
    모든 해당 속성 설정메소드를 호출함으로써 모든 설정을 마친 다음에야,
    이 팩토리 인스턴스를 JNDI lookup() 호출을 통해 사용가능하도록 할 것입니다.

    만약 특정 자원 타입에 대해 팩토리 클래스의 Java 클래스명을 지정할 필요가 있다면,
    <ResourceParams> 엘리먼트 내의 <parameter> 항목에 factory라는 이름을 사용하면 됩니다.

   -->

   <!-- 속성값
    name :: 설정할 자원의 이름이며, java:comp/env 컨텍스트에 대한 상대적인 이름이 됩니다.
    이 이름은 $CATALINA_HOME/conf/server.xml 내에 <Resource> 엘리먼트로 정의된 자원,
    그리고/또는 웹어플리케이션 배치 디스크립터 내에 <resource-ref> 또는 <resource-env-ref>로
    참조되는 자원의 이름과 반드시 일치해야 합니다.
    ※ 반드시 설정
   -->
   <ResourceParams name="jdbc/webmail">
     <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
     </parameter>

   <!-- maximum nuber of DB connections in DB 0 for no limit -->
     <parameter>
    <name>maxActive</name>
    <value>100</value>
     </parameter>

   <!-- set 0 for no limit -->
     <parameter>
    <name>maxIdle</name>
    <value>30</value>
     </parameter>

     <parameter>
    <name>maxWait</name>
    <value>10000</value>
     </parameter>

     <parameter>
    <name>username</name>
    <value>staritadm</value>
     </parameter>

     <parameter>
    <name>password</name>
    <value>pe999</value>
     </parameter>

     <parameter>
    <name>driverClassName</name>
    <value>org.gjt.mm.mysql.Driver</value>
     </parameter>

     <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/webmail?autoReconnect=true</value>
     </parameter>
   </ResourceParams>

   <!--
    이 엘리먼트는 어떤 전역 JNDI 자원으로의 링크를 생성하는데 사용합니다.
    그 연결명에 대하여 JNDI 탐색을 실행하면 링크된 전역자원이 반환됩니다.
   -->

   <!-- 속성값
    name :: 생성할 자원링크의 이름이며, java:comp/env에 대한 상대적인 이름입니다.
    ※ 반드시 설정
    
    global :: 전역 JNDI 컨텍스트내의 링크된 전역자원의 이름.
    ※ 반드시 설정

    type ::  이 자원링크에 대해 탐색을 실행할 때 웹어플리케이션이 기대하는 완전한 Java 클래스명.
    ※ 반드시 설정

   -->
   <ResourceLink name="linkToGlobalResource" global="simpleValue" type="java.lang.Integer"/>

 

   <!-- 컨텍스트 파라미터 (Context Parameter)
    이 엘리먼트 안에 <Parameter> 엘리먼트 들을 중첩시키면, 웹어플리케이션에서
    서블릿-컨텍스트 초기화 파라미터(servlet context initialization parameters)로
    이용가능한 파라미터이름-값 들을 설정할 수 있습니다.
    
    예를 들어 다음과 같이 하면 초기화 파라미터를 생성할 수 있습니다:
    
    <Context ...>
      ...
      <Parameter name="companyName" value="My Company, Incorporated"
       override="false"/>
      ...
    </Context>

    
    이는 웹어플리케이션 배치 디스크립터(/WEB-INF/web.xml) 안에
    다음과 같은 엘리먼트를 포함시키는 것과 동일합니다:
      
     <context-param>
      <param-name>companyName</param-name>
      <param-value>My Company, Incorporated</param-value>
    </context-param>
    
    
    -- 속성값 --

    name :: (반드시 설정) 생성할 컨텍스트 초기화 파라미터의 이름.

    value :: (반드시 설정) 웹어플리케이션에서 ServletContext.getInitParameter()을
    호출할 때 반환할 파라미터 값.

    override :: 웹어플리케이션 배치 디스크립터에서 여기에서 지정한 초기화 파라미터와
    같은 이름의 <context-param>를 지정했을 때 그 파라미터 값의 덮어쓰기(override)를
    허용하지 않으려면 false로 설정합니다. 디폴트값은 true입니다.

    description :: 이 컨텍스트 초기화 파라미터에 대한 간략한 설명이며, 생략가능
   -->
   


   <!-- 환경항목(Environment Entries)
    
    웹어플리케이션에서 환경항목자원(environment entry resources)으로 사용할 수
    있도록 항목의 이름-값 들을 설정할 수 있습니다. 이 설정은 <Environment> 항목을
    이 엘리먼트 내에 중첩시키면 됩니다. 예를 들어 아래와 같이 환경항목을 생성할 수 있습니다:

        <Context ...>
      ...
      <Environment name="maxExemptions" value="10"
       type="java.lang.Integer" override="false"/>
      ...
    </Context>
     

    이는 웹어플리케이션 배치 디스크립터(/WEB-INF/web.xml)에서
    다음의 엘리먼트를 포함시킨 것과 동일합니다:
      
     <env-entry>
      <env-entry-name>maxExemptions</param-name>
      <env-entry-value>10</env-entry-value>
      <env-entry-type>java.lang.Integer</env-entry-type>
    </env-entry>

     
    그러나 이 값을 커스터마이즈하기 위해 배치 디스크립터를 변경할 필요는 없습니다.

    
    <Environment> 엘리먼트에서는 다음과 같은 속성들을 사용할 수 있습니다:
    
    description :: (선택사항)이 환경항목에 대한 사람이 읽기 쉬운 간단한 설명
    
    name :: (반드시 설정) 생성할 환경항목의 이름. java:comp/env 컨텍스트에 대한 상대적인 이름입니다.
    
    override :: 웹어플리케이션 배치 디스크립터에서 <env-entry>으로 같은 이름의
    환경항목을 지정하는 경우, 여기에서 지정한 값을 덮어쓰기(override) 하지 않도록
    하고 싶으면 false로 지정합니다. 이 값을 지정하지 않으면 덮어쓰기가 허용됩니다.
    
    type :: (반드시 설정) 이 환경항목에 대해 웹어플리케이션이 예상하는 완전한(fully qualified) Java 클래스명.
    반드시 웹어플리케이션 배치 디스크립터의 <env-entry-type>의 규칙에 맞는 값이어야 합니다.
    그 규칙에 맞는 값 들은: java.lang.Boolean,
            java.lang.Byte,
            java.lang.Character,
            java.lang.Double,
            java.lang.Float,
            java.lang.Integer,
            java.lang.Long,
            java.lang.Short,
            java.lang.String 입니다.
    
    value :: (반드시 설정) 웹어플리케이션이 JNDI 컨텍스트로부터 요청해서 반환 받을 환경항목의 값.
    이 값은 반드시 위의 type에 정의된 Java type으로 변환 가능해야 합니다.
    
   -->
   </Context>
 </Host>

    </Engine>

  </Service>

  <!-- MOD_WEBAPP 커넥터는 apache 1.3 과 서블릿 컨테이너로 Tomcat 4.0 을 연결하는
       데 쓰입니다. WebApp 모듈 배포판에 포함된 어떻게 만드는지에 대해 설명하는
       README.txt 파일을 읽어보십시오. (또는 "jakarta-tomcat-connectors/webapp"
       CVS repository 를 확인해 보십시오.)

       Apache 쪽에서 설정하려면, 먼저 "httpd.conf" 에 설정되어진 "ServerName" 과
       "Port" 지시자를 확인해야 합니다. 그리고, "httpd.conf" 파일 아래에 다음과
       같은 줄을 넣어줍니다:

         LoadModule webapp_module libexec/mod_webapp.so
         WebAppConnection warpConnection warp localhost:8008
         WebAppDeploy examples warpConnection /examples/

       이 후에 (필요하다면 Tomcat 을 재시동한 후) Apache 를 재시작하면 연결이 됩니
       다. Apache 를 통해서 "WebAppDeploy" 지시자에 있는 모든 어플리케이션들이 실
       행하는 것을 보실 수 있습니다.
  -->

  <!-- Apache-Connector Service 설정하기 -->
  <Service name="Tomcat-Apache">

    <Connector className="org.apache.catalina.connector.warp.WarpConnector"
     port="8008" minProcessors="5" maxProcessors="75"
     enableLookups="true"
     acceptCount="10" debug="0"/>

    <!-- "localhost" 를 Apache "ServerName" 에 설정된 값으로 대치해주십시오 -->
    <Engine className="org.apache.catalina.connector.warp.WarpEngine"
     name="Apache" debug="0" appBase="webapps">

      <!-- 하위 레벨에서 설정되지 않았다면 Global logger -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="apache_log." suffix=".txt"
              timestamp="true"/>

      <!-- 이 Realm 이 여기 있기 때문에, 전체적으로 이 Realm 이 공유됩니다. -->
      <Realm className="org.apache.catalina.realm.MemoryRealm" />

    </Engine>

  </Service>

</Server>

 

<!-- Context 컴포넌트내에서만 정의가 가능한 Loader

Loader 엘리먼트는 웹애플리케이션에 필요한 Java 클래스와 자원을 적재하는데 사용할
웹애플리케이션 클래스로더를 나타냅니다. 이 클래스로더는 반드시 서블릿 스펙의 요구사항을
반드시 따라야 하며, 아래와 같은 위치로부터 클래스들을 적재합니다:

웹애플리케이션 내 /WEB-INF/classes 디렉토리에서.
웹애플리케이션 내 /WEB-INF/lib 디렉토리의 JAR 파일들로부터.
모든 웹애플리케이션이 전역적으로 이용가능하도록 Catalina가 허용한 자원들로부터.

Loader 엘리먼트는 Context 컴포넌트 내에서만 정의가 가능하지만, 생략할 수도 있습니다.
만약 생략한다면, 디폴트 Loader 설정이 자동으로 생성되며, 대부분의 경우 이 Loader로 충분합니다.

Catalina에서 구현된 클래스로더 계층구조에 대해 더 깊이 알고 싶다면 FIXME - Reference를 참고하십시오.


-- 속성값 --

className :: 사용할 Java 구현체 클래스의 이름.
이 클래스는 반드시 org.apache.catalina.Loader 인터페이스를 구현해야 합니다.
지정하지 않으면 표준값(아래에 정의됩니다)이 사용됩니다.
 
delegate :: 이 클래스로더가 표준 Java2 위임모델을 따르게 하고 싶다면 true로 지정합니다.
즉 이렇게 지정하면, 클래스를 적재할 때 웹애플리케이션 내부를 검색하기 전에 먼저
부모 클래스로더에서 클래스를 찾으려 시도합니다. false(디폴트)로 지정하면 요청된 클래스나
자원을 찾을 때 부모 클래스로더에 묻기 전에 웹애플리케이션 내부를 먼저 검색합니다.
 
reloadable :: true로 지정하면, Catalina는 /WEB-INF/classes/와 /WEB-INF/lib 안
클래스 들의 변경여부를 감시하다가, 변경이 발견되면 웹애플리케이션을 자동으로 재적재합니다.
이 기능은 개발중에는 매우 유용하지만 상당한 실행부하가 발생하므로, 실제 운영할 용도로
애플리케이션을 배치(deploy)할 때는 사용하지 않도록 합니다.
그러나 이미 배치가 끝난 애플리케이션이라도 Manager 웹애플리케이션을 이용하면
필요할 때 재적재 하도록 할 수 있습니다.

NOTE - 이 프로퍼티에 대한 값은 이 Loader 엘리먼트가 정의된 Context 컴포넌트에
설정된 reloadable 속성값을 물려받습니다만,
Loader에 이 reloadable을 정의하면 Context의 값은 무시됩니다.
 
 
Standard Implementation
Loader의 표준구현체 클래스는 org.apache.catalina.loader.WebappLoader 입니다.
이 클래스는 위에 나열한 공통속성 외에도 다음과 같은 추가적인 속성을 제공합니다:

checkInterval :: 클래스와 자원의 변경을 확인할 시간간격을 초단위로 나타냅니다.
이 값은 reloadable이 true인 경우에만 의미를 갖습니다. 지정하지 않으면 15초로 설정됩니다.
 
debug :: 이 Engine이 해당 Logger에 디버깅 로그를 출력하는 상세수준을 의미합니다.
숫자가 높을 수록 더 자세한 출력을 생성합니다. 지정하지 않으면 0으로 설정됩니다.
 
loaderClass :: 사용할 java.lang.ClassLoader 구현체 클래스의 Java 클래스명입니다.
지정하지 않으면 org.apache.catalina.loader.WebappClassLoader로 설정됩니다.
 
workDir :: 이 Context에서 사용할 임시 디렉토리에 대한 경로명입니다.
이 디렉토리는 관련 웹어플리케이션의 서블릿들이 임시로 읽기-쓰기 작업을 하는 용도로 사용합니다.
웹어플리케이션의 서블릿 들은 이름이 javax.servlet.context.tempdir인 서블릿-컨텍스트
속성(타입은 java.io.File)을 통해 이 디렉토리를 볼 수 있으며, 이 내용은 서블릿 스펙에
기술되어 있습니다. 지정하지 않은 경우에는 적절한 디렉토리가
$CATALINA_HOME/work 아래에 제공됩니다.

-->

'web' 카테고리의 다른 글

[펌] Axis Webservice 설치및 테스트  (0) 2005.09.03
[펌] web.xml 사용법  (0) 2005.07.23
Tomcat 4.1.12 버전에서 서블릿 접근  (0) 2005.02.08
web.xml 설명.  (0) 2005.02.04
web.xml  (0) 2005.02.04
Posted by '김용환'
,

web.xml

web 2005. 2. 4. 06:41

web.xml이란


Deployment Descriptor로 각 어플리케이션의 환경을 설정하는 부분을 담당한다. WAR 파일이 패키지 될 때 같이 포함되며 root directory 밑에 /WEB-INF 디렉토리에 위치한다.

by kkaok
2003-05-12

 

web.xml 의 구조

xml 정의와 schema 선언

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd>
위 스키마는 sun 사에서 미리 정의된것이다.

 

웹 어플리케이션의 환경 설정

<web-app>
    <servlet>
      <servlet-name>사용되는 클래스명</servlet-name>
      <servlet-class>클래스 경로</servlet-class>
    </servlet>
    <mime-mapping>
      <extension>txt</extension>
      <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
      <welcome-file>기본 파일 경로</welcome-file>
      <welcome-file>두번째 시작하는 파일 경로</welcome-file>
    </welcome-file-list>
    <taglib>
      <taglib-uri>태그라이브러리</taglib-uri>
      <taglib-location>경로</taglib-location>
    </taglib>
</web-app>

 

web.xml은 xml파일이다. 따라서 xml 작성과 동일한 규칙이 적용된다.
환경설정은 <web-app>으로 시작하고 </web-app>로 끝난다. 그외 삽입되는 요소로는 다음과 같다.

.ServletContext Init Parameters
.Session Configuration
.Servlet/JSP Definitions
.Servlet/JSP Mappings
.Mime Type Mappings
.Welcom File list
.Error Pages

 

web.xml의 elements의 순서
각 element의 순서는 아래 순서에 따른다.

<icon?>,
<display-name?>,
<description?>,
<distributable?>,
<context-param*>,
<filter*>,
<filter-mapping*>,
<listener*>,
<servlet*>,
<servlet-mapping*>,
<session-config?>,
<mime-mapping*>,
<welcome-file-list?>,
<error-page*>,
<taglib*>,
<resource-env-ref*>,
<resource-ref*>,
<security-constraint*>,
<login-config?>,
<security-role*>,
<env-entry*>,
<ejb-ref*>,
<ejb-local-ref*>


자주 쓰이는 elements 예제

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd>

<web-app>
    <display-name>어플리케이션 이름</display-name>
    <description>어플리케이션 설명</desccription>
    <!-- 서블릿 매핑 : 보안과 주소를 간략화 하기 위해 사용
        http://localhost/servlet/KCount 이렇게 사용가능  -->
    <servlet>
      <servlet-name>KCount</servlet-name>
      <servlet-class>kr.pe.kkaok.mycount.KCount</servlet-class>
    </servlet>
    <!-- load-on-startup 옵션은 서버 구동시 자동으로 시작 되도록 하는 것이다. -->
    <servlet>
      <servlet-name>PoolManager</servlet-name>
      <servlet-class>kr.pe.kkaok.jdbc.PoolManager</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- 서블릿 매핑 : 위에서 servlet 부분을 삭제한다.
        http://localhost/KCount 이렇게 사용가능  -->
    <servlet-mapping>
      <servlet-name>KCount</servlet-name>
      <url-pattern>/KCount</url-pattern>
    </servlet-mapping>
    <!-- /servlet/* 과 동일한 패턴의 요청이 들어오면 servlet으로 처리 -->
    <servlet-mapping>
      <servlet-name>invoker</servlet-name>
      <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    <!-- 세션 기간 설정 -->
    <session-config>
      <session-timeout>
        30
      </session-timeout>
    </session-config>
    <!-- mime 매핑 -->
    <mime-mapping>
      <extension>txt</extension>
      <mime-type>text/plain</mime-type>
    </mime-mapping>
    <!-- 시작페이지 설정 -->
    <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <!-- 존재하지 않는 페이지, 404에러시 처리 페이지 설정 -->
    <error-page>
      <error-code>404</error-code>
      <location>/error.jsp</location>
    </error-page>
    <!-- 태그 라이브러리 설정 -->
    <taglib>
      <taglib-uri>taglibs</taglib-uri>
      <taglib-location>/WEB-INF/taglibs-cache.tld</taglib-location>
    </taglib>
    <!-- resource 설정 -->
 <resource-ref>
      <res-ref-name>jdbc/jack1972</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>
</web-app>

 

* 만약 톰캣 4에서 servelt에 접근이 안되는 경우
아래는 okjsp.pe.kr 운영자 kenu님의 처리 방법이다.

invoker 서블릿의 매핑이 보안문제로 막혀있어서 발생하는 문제로 $CATALINA_HOME/conf/web.xml를 열고 해당 부분의 주석을 제거한다.

<!-- The mapping for the invoker servlet -->
<servlet-mapping>
  <servlet-name>invoker</servlet-name>
  <url-pattern>/servlet/*</url-pattern>
</servlet-mapping>

security-constraint 엘리먼트를 $CATALINA_HOME/conf/web.xml 파일의 welcome-file-list 엘리먼트 아래쪽 <web-app> 에 중첩되게 복사합니다.

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
 
<security-constraint>
  <display-name>Default Servlet</display-name>
  <!-- Disable direct alls on the Default Servlet -->
  <web-resource-collection>
    <web-resource-name>Disallowed Location</web-resource-name>
    <url-pattern>/servlet/org.apache.catalina.servlets.DefaultServlet/*</url-pattern>
    <http-method>DELETE</http-method>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    <http-method>PUT</http-method>
  </web-resource-collection>
  <auth-constraint>  
    <role-name></role-name>
  </auth-constraint>
</security-constraint>

                        
톰캣을 재시동하고 테스트해보면 정상적으로 작동하는걸 확인할 수 있다.

                         

 

http://www.kkaok.pe.kr

'web' 카테고리의 다른 글

[펌] Axis Webservice 설치및 테스트  (0) 2005.09.03
[펌] web.xml 사용법  (0) 2005.07.23
Tomcat 4.1.12 버전에서 서블릿 접근  (0) 2005.02.08
web.xml 설명.  (0) 2005.02.04
server.xml  (0) 2005.02.04
Posted by '김용환'
,