AJP Client

Nio-based client for the Apache JServ 1.3 protocol (ajp13)

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

com.github.jrialland
Идентификатор

Идентификатор

ajpclient
Последняя версия

Последняя версия

1.11
Дата

Дата

Тип

Тип

bundle
Описание

Описание

AJP Client
Nio-based client for the Apache JServ 1.3 protocol (ajp13)
Ссылка на сайт

Ссылка на сайт

https://github.com/jrialland/ajp-client
Система контроля версий

Система контроля версий

http://github.com/jrialland/ajp-client

Скачать ajpclient

Зависимости

compile (5)

Идентификатор библиотеки Тип Версия
ch.qos.logback : logback-classic jar 1.2.3
io.netty : netty-all jar 4.1.45.Final
org.r358.poolnetty » common jar 0.1.0.Final
org.r358.poolnetty » pool jar 0.1.0.Final
org.slf4j : slf4j-api jar 1.7.30

provided (1)

Идентификатор библиотеки Тип Версия
javax.servlet : javax.servlet-api jar 3.1.0

test (7)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13
org.slf4j : jul-to-slf4j jar 1.7.30
org.slf4j : jcl-over-slf4j jar 1.7.30
org.springframework : spring-web jar 4.3.13.RELEASE
org.springframework : spring-test jar 4.3.13.RELEASE
org.apache.tomcat.embed : tomcat-embed-core jar 8.5.50
org.slf4j : log4j-over-slf4j jar 1.7.30

Модули Проекта

Данный проект не имеет модулей.

java client library for the Apache JServ Protocol 1.3

Java implementation of an AJP13 protocol client, allowing to send requests to a servlet container using this protocol.

It uses netty, and handles connection pooling.

Licensed under the Apache License, Version 2.0 (see LICENSE)

Build Status Maven Central Coverage Status Known Vulnerabilities

Commits Code statistics

Simple Usecases :

  • Making a cPing request (checks server availability)
	import com.github.jrialland.ajpclient.pool.Channels;
	import com.github.jrialland.ajpclient.CPing;

	...

	//get a tcp connection
	final Channel channel = Channels.connect("localhost", 8009);
	//will try a cping/cpong exchange on the opened tcp connection
	boolean success = new CPing(2, TimeUnit.SECONDS).execute(channel);
  //                                                .execute("localhost", 8009);	
  • Making a forward request (serves web content)
	import com.github.jrialland.ajpclient.pool.Channels;
	import com.github.jrialland.ajpclient.Forward;

	//send a forward request
	new Forward(ajpRequest, ajpResponse).execute("localhost", 8009);
	
  • Using a client sockets pool :

Socket pools handle the creation and destruction of multiple connections automatically.

	import com.github.jrialland.ajpclient.pool.Channels;
	import com.github.jrialland.ajpclient.Forward;
	
	Channels.getPool("localhost", 8009).execute(new Forward(ajpRequest, ajpResponse));
	

Will use a socket channel picked from a pool, allowing the reuse of sockets among request.

  • The library can be used directly in a servlet container in order to forward requests to another servlet container :
	import javax.servlet.http.HttpServletRequest;
	import javax.servlet.http.HttpServletResponse;
	import com.github.jrialland.ajpclient.servlet.AjpServletProxy;
	
	HttpServletRequest request = ...
	HttpServetResponse response = ...
	
	//forward an servlet request to another server
	AjpServletProxy.forHost("localhost", 8009).forward(request, response);

AJP header size limit

The protocol does not allow request headers to be greater that 8K, which is ok most of the time. to overcome this limit, at least with tomcat 5.5.21+ and Tomcat 6.0.1+

  1. add the packetSize attribute to the connector's declaration
    <Connector port="8009" protocol="AJP/1.3"
               packetSize="20000"
               redirectPort="8443" ></Connector>
  1. Change the limit in Apache Server configuration :
ProxyIOBufferSize 19000 
LimitRequestFieldsize 18000

Версии библиотеки

Версия
1.11
1.10
1.7
1.6
1.4