Skip to content

Commit

Permalink
Merge pull request eclipse-ee4j#23898 from arjantijms/requestid
Browse files Browse the repository at this point in the history
  • Loading branch information
arjantijms authored Apr 11, 2022
2 parents b9c951c + 5e7123a commit a22523c
Show file tree
Hide file tree
Showing 4 changed files with 877 additions and 827 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022, 2022 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -610,20 +611,17 @@ public long getContentLengthLong() {

@Override
public String getRequestId() {
// TODO Implement!
return null;
return servletRequest.getRequestId();
}

@Override
public String getProtocolRequestId() {
// TODO Implement!
return null;
return servletRequest.getProtocolRequestId();
}

@Override
public ServletConnection getServletConnection() {
// TODO Implement!
return null;
return servletRequest.getServletConnection();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
import org.glassfish.grizzly.Buffer;
import org.glassfish.grizzly.CompletionHandler;
import org.glassfish.grizzly.EmptyCompletionHandler;
import org.glassfish.grizzly.http.Protocol;
import org.glassfish.grizzly.http.server.Response.SuspendedContextImpl;
import org.glassfish.grizzly.http.server.TimeoutHandler;
import org.glassfish.grizzly.http.server.util.MappingData;
Expand Down Expand Up @@ -3825,20 +3826,67 @@ private boolean isSessionVersioningSupported() {

@Override
public String getRequestId() {
// TODO Implement!
return null;
return grizzlyRequest.getRequestId();
}

@Override
public String getProtocolRequestId() {
// TODO Implement!
return null;
return grizzlyRequest.getProtocolRequestId();
}

@Override
public ServletConnection getServletConnection() {
// TODO Implement!
return null;
String connectionId = grizzlyRequest.getConnection() == null ? null : Long.toString(grizzlyRequest.getConnection().getId());
return new ServletConnectionImpl(connectionId, grizzlyRequest.getProtocol(), grizzlyRequest.isSecure());
}

/**
* Trivial implementation of the {@link ServletConnection}
*
* @author David Matejcek
*/
public static class ServletConnectionImpl implements ServletConnection {

private final String connectionId;
private final Protocol protocol;
private final boolean secure;

/**
* Just sets all fields.
*
* @param connectionId - see {@link #getConnectionId()}, can be null.
* @param protocol - see {@link #getProtocol()} and {@link Protocol}, can be null.
* @param secure - true if the connection was encrypted.
*/
public ServletConnectionImpl(String connectionId, Protocol protocol, boolean secure) {
this.connectionId = connectionId;
this.protocol = protocol;
this.secure = secure;
}

@Override
public String getConnectionId() {
return this.connectionId;
}


@Override
public String getProtocol() {
return protocol == null ? "unknown" : this.protocol.getProtocolString();
}


@Override
public String getProtocolConnectionId() {
// we don't support HTTP3 yet.
return "";
}


@Override
public boolean isSecure() {
return this.secure;
}
}

}
Loading

0 comments on commit a22523c

Please sign in to comment.