Skip to content

Commit

Permalink
initial work on the servlet API update
Browse files Browse the repository at this point in the history
eventually fixes oracle#4075
  • Loading branch information
vladak committed Nov 22, 2022
1 parent c101828 commit dce9a5e
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import jakarta.servlet.AsyncContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletConnection;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.ServletRequest;
Expand Down Expand Up @@ -98,54 +99,26 @@ public int getMaxInactiveInterval() {
return 3600;
}

@Override
@SuppressWarnings("deprecation")
public jakarta.servlet.http.HttpSessionContext getSessionContext() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Object getAttribute(String string) {
return attrs.get(string);
}

@Override
@SuppressWarnings("deprecation")
public Object getValue(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Enumeration<String> getAttributeNames() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
@SuppressWarnings("deprecation")
public String[] getValueNames() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setAttribute(String string, Object o) {
attrs.put(string, o);
}

@Override
@SuppressWarnings("deprecation")
public void putValue(String string, Object o) {
}

@Override
public void removeAttribute(String string) {
attrs.remove(string);
}

@Override
@SuppressWarnings("deprecation")
public void removeValue(String string) {
}

@Override
public void invalidate() {
attrs = new HashMap<>();
Expand Down Expand Up @@ -291,11 +264,6 @@ public boolean isRequestedSessionIdFromURL() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override @Deprecated
public boolean isRequestedSessionIdFromUrl() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean authenticate(HttpServletResponse httpServletResponse) {
return false;
Expand Down Expand Up @@ -456,11 +424,6 @@ public RequestDispatcher getRequestDispatcher(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override @Deprecated
public String getRealPath(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public int getRemotePort() {
throw new UnsupportedOperationException("Not supported yet.");
Expand Down Expand Up @@ -515,4 +478,19 @@ public AsyncContext getAsyncContext() {
public DispatcherType getDispatcherType() {
return null;
}

@Override
public String getRequestId() {
return "123";
}

@Override
public String getProtocolRequestId() {
return null;
}

@Override
public ServletConnection getServletConnection() {
return null;
}
}
2 changes: 1 addition & 1 deletion opengrok-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Portions Copyright (c) 2018, 2020, Chris Fraire <[email protected]>.
<dependency>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions opengrok-web/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">

<display-name>OpenGrok</display-name>
<description>A wicked fast source browser</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;

public class CookieFilterTest {
class CookieFilterTest {
static class DummyHttpServletResponse implements HttpServletResponse {

@Override
Expand All @@ -74,18 +74,6 @@ public String encodeRedirectURL(String s) {
return null;
}

@Override
@Deprecated
public String encodeUrl(String s) {
return null;
}

@Override
@Deprecated
public String encodeRedirectUrl(String s) {
return null;
}

@Override
public void sendError(int i, String s) throws IOException {

Expand Down Expand Up @@ -142,12 +130,6 @@ public void setStatus(int i) {

}

@Override
@Deprecated
public void setStatus(int i, String s) {

}

@Override
public int getStatus() {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import jakarta.servlet.AsyncContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletConnection;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.ServletRequest;
Expand Down Expand Up @@ -90,54 +91,26 @@ public int getMaxInactiveInterval() {
return 3600;
}

@Override
@SuppressWarnings("deprecation")
public jakarta.servlet.http.HttpSessionContext getSessionContext() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Object getAttribute(String string) {
return attrs.get(string);
}

@Override
@SuppressWarnings("deprecation")
public Object getValue(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Enumeration<String> getAttributeNames() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
@SuppressWarnings("deprecation")
public String[] getValueNames() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setAttribute(String string, Object o) {
attrs.put(string, o);
}

@Override
@SuppressWarnings("deprecation")
public void putValue(String string, Object o) {
}

@Override
public void removeAttribute(String string) {
attrs.remove(string);
}

@Override
@SuppressWarnings("deprecation")
public void removeValue(String string) {
}

@Override
public void invalidate() {
}
Expand Down Expand Up @@ -273,12 +246,6 @@ public boolean isRequestedSessionIdFromURL() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
@Deprecated
public boolean isRequestedSessionIdFromUrl() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean authenticate(HttpServletResponse httpServletResponse) {
return false;
Expand Down Expand Up @@ -434,12 +401,6 @@ public RequestDispatcher getRequestDispatcher(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
@Deprecated
public String getRealPath(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public int getRemotePort() {
throw new UnsupportedOperationException("Not supported yet.");
Expand Down Expand Up @@ -494,4 +455,19 @@ public AsyncContext getAsyncContext() {
public DispatcherType getDispatcherType() {
return null;
}

@Override
public String getRequestId() {
return "123";
}

@Override
public String getProtocolRequestId() {
return null;
}

@Override
public ServletConnection getServletConnection() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import jakarta.servlet.AsyncContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletConnection;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.ServletRequest;
Expand Down Expand Up @@ -85,54 +86,26 @@ public int getMaxInactiveInterval() {
return 3600;
}

@Override
@SuppressWarnings("deprecation")
public jakarta.servlet.http.HttpSessionContext getSessionContext() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Object getAttribute(String string) {
return attrs.get(string);
}

@Override
@SuppressWarnings("deprecation")
public Object getValue(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Enumeration<String> getAttributeNames() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
@SuppressWarnings("deprecation")
public String[] getValueNames() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setAttribute(String string, Object o) {
attrs.put(string, o);
}

@Override
@SuppressWarnings("deprecation")
public void putValue(String string, Object o) {
}

@Override
public void removeAttribute(String string) {
attrs.remove(string);
}

@Override
@SuppressWarnings("deprecation")
public void removeValue(String string) {
}

@Override
public void invalidate() {
}
Expand Down Expand Up @@ -284,12 +257,6 @@ public boolean isRequestedSessionIdFromURL() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
@Deprecated
public boolean isRequestedSessionIdFromUrl() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean authenticate(HttpServletResponse httpServletResponse) {
return false;
Expand Down Expand Up @@ -445,12 +412,6 @@ public RequestDispatcher getRequestDispatcher(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
@Deprecated
public String getRealPath(String string) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public int getRemotePort() {
throw new UnsupportedOperationException("Not supported yet.");
Expand Down Expand Up @@ -505,4 +466,19 @@ public AsyncContext getAsyncContext() {
public DispatcherType getDispatcherType() {
return null;
}

@Override
public String getRequestId() {
return "123";
}

@Override
public String getProtocolRequestId() {
return null;
}

@Override
public ServletConnection getServletConnection() {
return null;
}
}
Loading

0 comments on commit dce9a5e

Please sign in to comment.