Skip to content

Commit

Permalink
Upgraded dependencies - servlet, metro, grizzly
Browse files Browse the repository at this point in the history
- servlet6
- grizzly 4 snapshot
- webservices 4 snapshot

Signed-off-by: David Matějček <dmatej@seznam.cz>
  • Loading branch information
dmatej committed Mar 16, 2022
1 parent b50d5b1 commit 5f22f7a
Show file tree
Hide file tree
Showing 9 changed files with 413 additions and 238 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Contributors to Eclipse Foundation.
* Copyright (c) 2021-2022 Contributors to Eclipse Foundation.
* Copyright (c) 1997-2022 Oracle and/or its affiliates. All rights reserved.
* Copyright 2004 The Apache Software Foundation
*
Expand All @@ -25,12 +25,19 @@ public class Constants {
public static final int MAJOR_VERSION = 6;
public static final int MINOR_VERSION = 0;

public static final String JSP_SERVLET_CLASS =
"org.glassfish.wasp.servlet.JspServlet";
public static final String JSP_SERVLET_CLASS = "org.glassfish.wasp.servlet.JspServlet";

public static final String JSP_SERVLET_NAME = "jsp";

public static final String DEFAULT_SERVLET_NAME = "default";

public static final String IS_DEFAULT_ERROR_PAGE_ENABLED_INIT_PARAM = "org.glassfish.web.isDefaultErrorPageEnabled";

public static final String COOKIE_COMMENT_ATTR = "Comment";
public static final String COOKIE_DOMAIN_ATTR = "Domain";
public static final String COOKIE_MAX_AGE_ATTR = "Max-Age";
public static final String COOKIE_PATH_ATTR = "Path";
public static final String COOKIE_SECURE_ATTR = "Secure";
public static final String COOKIE_HTTP_ONLY_ATTR = "HttpOnly";
public static final String COOKIE_SAME_SITE_ATTR = "SameSite";
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 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 All @@ -16,13 +17,14 @@

package org.apache.catalina.core;

import org.apache.catalina.Globals;
import org.apache.catalina.LogFacade;

import java.text.MessageFormat;
import java.util.Collections;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.logging.Logger;
import java.util.TreeMap;

import jakarta.servlet.SessionCookieConfig;

/**
Expand All @@ -31,14 +33,15 @@
*/
public class SessionCookieConfigImpl implements SessionCookieConfig {

private String name;
private String domain;
private String path;
private String comment;
private boolean httpOnly = true;
private boolean secure;
private StandardContext ctx;
private int maxAge = -1;
private static final int DEFAULT_MAX_AGE = -1;
private static final boolean DEFAULT_HTTP_ONLY = false;
private static final boolean DEFAULT_SECURE = false;
private static final String DEFAULT_NAME = "JSESSIONID";

private String name = DEFAULT_NAME;

private final Map<String,String> attributes = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
private final StandardContext ctx;

private static final ResourceBundle rb = LogFacade.getLogger().getResourceBundle();

Expand Down Expand Up @@ -95,8 +98,7 @@ public void setDomain(String domain) {
new Object[] {"dnmain", ctx.getName()});
throw new IllegalStateException(msg);
}

this.domain = domain;
setAttribute(Constants.COOKIE_DOMAIN_ATTR, domain);
}


Expand All @@ -106,7 +108,7 @@ public void setDomain(String domain) {
*/
@Override
public String getDomain() {
return domain;
return getAttribute(Constants.COOKIE_DOMAIN_ATTR);
}


Expand All @@ -124,8 +126,7 @@ public void setPath(String path) {
new Object[] {"path", ctx.getName()});
throw new IllegalStateException(msg);
}

this.path = path;
setAttribute(Constants.COOKIE_PATH_ATTR, path);
}


Expand All @@ -137,7 +138,7 @@ public void setPath(String path) {
*/
@Override
public String getPath() {
return path;
return getAttribute(Constants.COOKIE_PATH_ATTR);
}


Expand All @@ -155,8 +156,7 @@ public void setComment(String comment) {
new Object[] {"comment", ctx.getName()});
throw new IllegalStateException(msg);
}

this.comment = comment;
setAttribute(Constants.COOKIE_COMMENT_ATTR, comment);
}


Expand All @@ -166,7 +166,7 @@ public void setComment(String comment) {
*/
@Override
public String getComment() {
return comment;
return getAttribute(Constants.COOKIE_COMMENT_ATTR);
}


Expand All @@ -187,8 +187,7 @@ public void setHttpOnly(boolean httpOnly) {
new Object[] {"httpOnly", ctx.getName()});
throw new IllegalStateException(msg);
}

this.httpOnly = httpOnly;
setAttribute(Constants.COOKIE_HTTP_ONLY_ATTR, String.valueOf(httpOnly));
}


Expand All @@ -199,7 +198,8 @@ public void setHttpOnly(boolean httpOnly) {
*/
@Override
public boolean isHttpOnly() {
return httpOnly;
String value = getAttribute(Constants.COOKIE_HTTP_ONLY_ATTR);
return value == null ? DEFAULT_HTTP_ONLY : Boolean.parseBoolean(value);
}


Expand All @@ -223,8 +223,7 @@ public void setSecure(boolean secure) {
new Object[] {"secure", ctx.getName()});
throw new IllegalStateException(msg);
}

this.secure = secure;
setAttribute(Constants.COOKIE_SECURE_ATTR, String.valueOf(secure));
}


Expand All @@ -239,7 +238,8 @@ public void setSecure(boolean secure) {
*/
@Override
public boolean isSecure() {
return secure;
String value = getAttribute(Constants.COOKIE_SECURE_ATTR);
return value == null ? DEFAULT_SECURE : Boolean.parseBoolean(value);
}


Expand All @@ -250,35 +250,28 @@ public void setMaxAge(int maxAge) {
new Object[] {"maxAge", ctx.getName()});
throw new IllegalStateException(msg);
}

this.maxAge = maxAge;
setAttribute(Constants.COOKIE_MAX_AGE_ATTR, String.valueOf(maxAge));
}


@Override
public int getMaxAge() {
return maxAge;
String value = getAttribute(Constants.COOKIE_MAX_AGE_ATTR);
return value == null ? DEFAULT_MAX_AGE : Integer.parseInt(value);
}


@Override
public void setAttribute(String name, String value) {
// TODO IMPLEMENT!

this.attributes.put(name, value);
}


@Override
public String getAttribute(String name) {
// TODO IMPLEMENT!
return null;
return this.attributes.get(name);
}


@Override
public Map<String, String> getAttributes() {
// TODO IMPLEMENT!
return null;
return Collections.unmodifiableMap(this.attributes);
}

}

0 comments on commit 5f22f7a

Please sign in to comment.