INTRODUCTION (v1.5)
Download
Download the archive file and extract.
Configuring httpd
Please make the following configuration files for the place where in CLASSPATH. (It makes it referring to tamacat-httpd/conf.)
- httpd.xml
- server.properties
- components.xml
- url-config.xml
- logback.xml
- log4j.properties (optional)
- mime-types.properties (option)
- application.properties (optional. for ThymeleafErrorPage/ThymeleafHttpHandler)
- velocity.properties (optional. for VelocityHttpHandler)
httpd.xml Required
default (use server.properties)
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<bean id="server" class="org.tamacat.httpd.core.UnifiedHttpEngine" />
</beans>
use another server.properties
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<bean id="server" class="org.tamacat.httpd.core.UnifiedHttpEngine">
<property name="propertiesName">
<value>server-test.properties</value>
</property>
</bean>
</beans>
use compression (use GzipResponseInterceptor)
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<bean id="gzip" class="org.tamacat.httpd.filter.GzipResponseInterceptor">
<property name="contentType">
<value>html,xml,css,javascript,json,woff,woff2,ico</value>
</property>
</bean>
<bean id="server" class="org.tamacat.httpd.core.UnifiedHttpEngine">
<property name="httpInterceptor">
<ref bean="gzip" />
</property>
</bean>
</beans>
TOP
server.properties Required
ServerName=tamacat-httpd
Port=80
### HTTPS configuration
https=false
https.keyStoreFile=test.keystore
https.keyPassword=nopassword
https.keyStoreType=JKS
https.protocol=TLSv1_2
https.support-protocols=TLSv1.2
https.clientAuth=false
### HttpEngine/ServerConfig
MaxServerThreads=50
ServerSocketTimeout=30000
ConnectionTimeout=5000
ServerSocketBufferSize=8192
### KeepAliveConnReuseStrategy
KeepAliveTimeout=0
KeepAliveRequests=0
### WorkerThread
WorkerThreadName=httpd
### ReverseProxyHandler
BackEndSocketTimeout=15000
BackEndConnectionTimeout=5000
BackEndSocketBufferSize=8192
### Configuration files
url-config.file=url-config.xml
components.file=components.xml
TOP
url-config.xml Required
<?xml version="1.0" encoding="UTF-8"?>
<service-config>
<service>
<url path="/" type="normal" handler="DefaultHandler" />
<url path="/examples/" type="reverse" handler="ReverseyHandler">
<reverse>http://localhost:8080/examples/</reverse>
</url>
</service>
</service-config>
name | value | description |
---|---|---|
type | normal, reverse, lb | "normal" is standard web server. "reverse" is Reverse proxy. "lb" is Load balancing with reverse proxy. |
handler | ex. ReverseHandler | The Bean id in components.xml. |
components | path_to/components.xml | Using another Components XML in classpath.(optional / default: components.xml) |
lb-method | RoundRobin or LeastConnection (default: RoundRobin) | The name of load balancing method for type="lb" |
components.xml Required
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<bean id="DefaultHandler" class="org.tamacat.httpd.handler.LocalFileHttpHandler" />
<bean id="ReverseHandler" class="org.tamacat.httpd.handler.ReverseProxyHttpHandler" />
</beans>
class | description | |
---|---|---|
org.tamacat.httpd.handler.LocalFileHttpHandler | returns local contents. | |
org.tamacat.httpd.handler.ThymeleafHttpHandler | returns local contents using Thymeleaf templates. | |
org.tamacat.httpd.handler.ReverseProxyHttpHandler | returns remote server contents.(Reverse Proxy) |