diff --git a/pom.xml b/pom.xml index 012921a..b5dc58f 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ pom - 1.6.0 + 1.6.1 2.2 UTF-8 diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/impl/HttpServletRequestImpl.java b/servlet-core/src/main/java/tech/smartboot/servlet/impl/HttpServletRequestImpl.java index 04f388f..eb8ed8d 100644 --- a/servlet-core/src/main/java/tech/smartboot/servlet/impl/HttpServletRequestImpl.java +++ b/servlet-core/src/main/java/tech/smartboot/servlet/impl/HttpServletRequestImpl.java @@ -67,6 +67,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.concurrent.CompletableFuture; /** @@ -894,7 +895,84 @@ public CompletableFuture getCompletableFuture() { @Override public PushBuilder newPushBuilder() { -// return new PushBuilderImpl(this); - throw new UnsupportedOperationException(); + org.smartboot.http.server.PushBuilder pushBuilder = request.newPushBuilder(); + return new PushBuilder() { + @Override + public PushBuilder method(String method) { + pushBuilder.method(method); + return this; + } + + @Override + public PushBuilder queryString(String queryString) { + pushBuilder.queryString(queryString); + return this; + } + + @Override + public PushBuilder sessionId(String sessionId) { + throw new IllegalStateException(); + } + + @Override + public PushBuilder setHeader(String name, String value) { + pushBuilder.setHeader(name, value); + return this; + } + + @Override + public PushBuilder addHeader(String name, String value) { + pushBuilder.addHeader(name, value); + return this; + } + + @Override + public PushBuilder removeHeader(String name) { + pushBuilder.removeHeader(name); + return this; + } + + @Override + public PushBuilder path(String path) { + pushBuilder.path(getContextPath() + "/" + path); + return this; + } + + @Override + public void push() { + pushBuilder.push(); + } + + @Override + public String getMethod() { + return pushBuilder.getMethod(); + } + + @Override + public String getQueryString() { + return pushBuilder.getQueryString(); + } + + @Override + public String getSessionId() { + return pushBuilder.getSessionId(); + } + + @Override + public Set getHeaderNames() { + return pushBuilder.getHeaderNames(); + } + + @Override + public String getHeader(String name) { + return pushBuilder.getHeader(name); + } + + @Override + public String getPath() { + return pushBuilder.getPath(); + } + }; +// throw new UnsupportedOperationException(); } } diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/websocket/WebsocketProviderImpl.java b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/websocket/WebsocketProviderImpl.java index eeae145..40794b0 100644 --- a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/websocket/WebsocketProviderImpl.java +++ b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/websocket/WebsocketProviderImpl.java @@ -40,7 +40,7 @@ public ServerContainer getWebSocketServerContainer() { @Override public void doHandle(WebSocketRequest request, WebSocketResponse response) { - Attachment attachment = ((WebSocketRequestImpl) request).getAttachment(); + Attachment attachment = request.getAttachment(); WebsocketSession session = (WebsocketSession) attachment.get(WebsocketProvider.WEBSOCKET_SESSION_ATTACH_KEY); try { switch (request.getFrameOpcode()) {