You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
work/MiddlewareDecorator.java

18 lines
557 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package middleware;
/**
* 中间件装饰器抽象类
* 装饰器模式中的装饰器类实现了HttpRequestHandler接口并持有一个HttpRequestHandler引用
*/
public abstract class MiddlewareDecorator implements HttpRequestHandler {
protected HttpRequestHandler decoratedHandler;
public MiddlewareDecorator(HttpRequestHandler decoratedHandler) {
this.decoratedHandler = decoratedHandler;
}
@Override
public HttpResponse handle(HttpRequest request) {
return decoratedHandler.handle(request);
}
}