You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/09/17 02:15:34 UTC
[james-project] 02/05: JAMES-2884 Rename
AuthenticatedProtocolRequest to AuthenticatedRequest
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 09b14d5d21e0ecfd350a4664d03dd369f526b7f3
Author: cketti <ck...@cketti.de>
AuthorDate: Sun Sep 15 21:52:04 2019 +0200
JAMES-2884 Rename AuthenticatedProtocolRequest to AuthenticatedRequest
---
.../jmap/src/main/java/org/apache/james/jmap/JMAPServlet.java | 6 +++---
.../java/org/apache/james/jmap/methods/RequestHandler.java | 10 +++++-----
...enticatedProtocolRequest.java => AuthenticatedRequest.java} | 8 ++++----
.../java/org/apache/james/jmap/methods/RequestHandlerTest.java | 6 +++---
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPServlet.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPServlet.java
index d4a1df6..b660550 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPServlet.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPServlet.java
@@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.james.jmap.methods.RequestHandler;
-import org.apache.james.jmap.model.AuthenticatedProtocolRequest;
+import org.apache.james.jmap.model.AuthenticatedRequest;
import org.apache.james.jmap.model.InvocationRequest;
import org.apache.james.jmap.model.ProtocolResponse;
import org.apache.james.metrics.api.MetricFactory;
@@ -73,7 +73,7 @@ public class JMAPServlet extends HttpServlet {
List<Object[]> responses =
requestAsJsonStream(req)
.map(InvocationRequest::deserialize)
- .map(x -> AuthenticatedProtocolRequest.decorate(x, req))
+ .map(x -> AuthenticatedRequest.decorate(x, req))
.flatMap(this::handle)
.map(ProtocolResponse::asProtocolSpecification)
.collect(Collectors.toList());
@@ -100,7 +100,7 @@ public class JMAPServlet extends HttpServlet {
}
}
- private Stream<? extends ProtocolResponse> handle(AuthenticatedProtocolRequest request) {
+ private Stream<? extends ProtocolResponse> handle(AuthenticatedRequest request) {
try {
return requestHandler.handle(request);
} catch (IOException e) {
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/RequestHandler.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/RequestHandler.java
index 09a70aa..4ad67cd 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/RequestHandler.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/RequestHandler.java
@@ -32,7 +32,7 @@ import javax.inject.Inject;
import org.apache.james.core.User;
import org.apache.james.jmap.JmapFieldNotSupportedException;
-import org.apache.james.jmap.model.AuthenticatedProtocolRequest;
+import org.apache.james.jmap.model.AuthenticatedRequest;
import org.apache.james.jmap.model.ProtocolResponse;
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.util.MDCBuilder;
@@ -55,7 +55,7 @@ public class RequestHandler {
.collect(Collectors.toMap(Method::requestHandled, Function.identity()));
}
- public Stream<ProtocolResponse> handle(AuthenticatedProtocolRequest request) throws IOException {
+ public Stream<ProtocolResponse> handle(AuthenticatedRequest request) throws IOException {
Optional<MailboxSession> mailboxSession = Optional.ofNullable(request.getMailboxSession());
try (Closeable closeable =
MDCBuilder.create()
@@ -70,7 +70,7 @@ public class RequestHandler {
}
}
- private Function<Method, Stream<JmapResponse>> extractAndProcess(AuthenticatedProtocolRequest request) {
+ private Function<Method, Stream<JmapResponse>> extractAndProcess(AuthenticatedRequest request) {
MailboxSession mailboxSession = request.getMailboxSession();
return (Method method) -> {
try {
@@ -95,7 +95,7 @@ public class RequestHandler {
.build();
}
- private Stream<JmapResponse> errorNotImplemented(JmapFieldNotSupportedException error, AuthenticatedProtocolRequest request) {
+ private Stream<JmapResponse> errorNotImplemented(JmapFieldNotSupportedException error, AuthenticatedRequest request) {
return Stream.of(
JmapResponse.builder()
.clientId(request.getClientId())
@@ -103,7 +103,7 @@ public class RequestHandler {
.build());
}
- private Stream<JmapResponse> error(AuthenticatedProtocolRequest request, ErrorResponse error) {
+ private Stream<JmapResponse> error(AuthenticatedRequest request, ErrorResponse error) {
return Stream.of(
JmapResponse.builder()
.clientId(request.getClientId())
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/AuthenticatedProtocolRequest.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/AuthenticatedRequest.java
similarity index 82%
rename from server/protocols/jmap/src/main/java/org/apache/james/jmap/model/AuthenticatedProtocolRequest.java
rename to server/protocols/jmap/src/main/java/org/apache/james/jmap/model/AuthenticatedRequest.java
index 3bf0fc7..92f9605 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/AuthenticatedProtocolRequest.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/AuthenticatedRequest.java
@@ -23,15 +23,15 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.james.jmap.AuthenticationFilter;
import org.apache.james.mailbox.MailboxSession;
-public class AuthenticatedProtocolRequest extends InvocationRequest {
+public class AuthenticatedRequest extends InvocationRequest {
- public static AuthenticatedProtocolRequest decorate(InvocationRequest request, HttpServletRequest httpServletRequest) {
- return new AuthenticatedProtocolRequest(request, httpServletRequest);
+ public static AuthenticatedRequest decorate(InvocationRequest request, HttpServletRequest httpServletRequest) {
+ return new AuthenticatedRequest(request, httpServletRequest);
}
private final HttpServletRequest httpServletRequest;
- private AuthenticatedProtocolRequest(InvocationRequest request, HttpServletRequest httpServletRequest) {
+ private AuthenticatedRequest(InvocationRequest request, HttpServletRequest httpServletRequest) {
super(request.getMethodName(), request.getParameters(), request.getClientId());
this.httpServletRequest = httpServletRequest;
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/RequestHandlerTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/RequestHandlerTest.java
index 20d49b4..ed24b24 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/RequestHandlerTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/RequestHandlerTest.java
@@ -31,7 +31,7 @@ import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.apache.james.jmap.json.ObjectMapperFactory;
-import org.apache.james.jmap.model.AuthenticatedProtocolRequest;
+import org.apache.james.jmap.model.AuthenticatedRequest;
import org.apache.james.jmap.model.ClientId;
import org.apache.james.jmap.model.InvocationRequest;
import org.apache.james.jmap.model.ProtocolResponse;
@@ -140,7 +140,7 @@ public class RequestHandlerTest {
new ObjectNode(new JsonNodeFactory(false)).textNode("#1")};
RequestHandler requestHandler = new RequestHandler(ImmutableSet.of(), jmapRequestParser, jmapResponseWriter);
- requestHandler.handle(AuthenticatedProtocolRequest.decorate(InvocationRequest.deserialize(nodes), mockHttpServletRequest));
+ requestHandler.handle(AuthenticatedRequest.decorate(InvocationRequest.deserialize(nodes), mockHttpServletRequest));
}
@Test(expected = IllegalStateException.class)
@@ -208,7 +208,7 @@ public class RequestHandlerTest {
parameters,
new ObjectNode(new JsonNodeFactory(false)).textNode("#1")};
- List<ProtocolResponse> responses = testee.handle(AuthenticatedProtocolRequest.decorate(InvocationRequest.deserialize(nodes), mockHttpServletRequest))
+ List<ProtocolResponse> responses = testee.handle(AuthenticatedRequest.decorate(InvocationRequest.deserialize(nodes), mockHttpServletRequest))
.collect(Collectors.toList());
assertThat(responses).hasSize(1)
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org