@@ -23,7 +23,7 @@ public class SimpleHttpCookie {
2323
2424 private final Date expires ;
2525 private final Integer maxAge ;
26- private final boolean
26+ private final Boolean
2727 secure ,
2828 httpOnly ;
2929
@@ -46,7 +46,7 @@ public class SimpleHttpCookie {
4646 * @author Ktt Development
4747 */
4848 @ Deprecated
49- public SimpleHttpCookie (final String name , final String value , final String domain , final String path , final String sameSite , final Date expires , final Integer maxAge , final boolean secure , final boolean httpOnly ){
49+ public SimpleHttpCookie (final String name , final String value , final String domain , final String path , final String sameSite , final Date expires , final Integer maxAge , final Boolean secure , final Boolean httpOnly ){
5050 if (name == null )
5151 throw new NullPointerException ("Cookie name can not be null" );
5252 else
@@ -78,7 +78,7 @@ public SimpleHttpCookie(final String name, final String value, final String doma
7878 @ SuppressWarnings ({"ConstantConditions" , "SpellCheckingInspection" })
7979 @ Override @ Deprecated
8080 public final String toString (){
81- StringBuilder OUT = new StringBuilder ();
81+ final StringBuilder OUT = new StringBuilder ();
8282
8383 OUT .append (name ).append ("=" ).append (value );
8484 if (expires != null )
@@ -89,9 +89,9 @@ public final String toString(){
8989 OUT .append ("; Domain=" ).append (domain );
9090 if (path != null )
9191 OUT .append ("; Path=" ).append (path );
92- if (secure )
92+ if (secure != null && secure )
9393 OUT .append ("; Secure=" ).append (secure );
94- if (httpOnly )
94+ if (httpOnly != null && httpOnly )
9595 OUT .append ("; HttpOnly=" ).append (httpOnly );
9696 if (sameSite != null )
9797 OUT .append ("; SameSite=" ).append (sameSite );
@@ -114,16 +114,16 @@ public final String toCookieHeaderString(){
114114
115115 OUT .append (name ).append ("=" ).append (value );
116116 if (expires != null )
117- OUT .append ("; Expires=" ).append (sdf .format (expires )).append (" GMT" );
117+ OUT .append ("; Expires=" ).append (new SimpleDateFormat ( "EEE, dd MMM yyyy HH:mm:ss" ) .format (expires )).append (" GMT" );
118118 if (maxAge != null )
119119 OUT .append ("; Max-Age=" ).append (maxAge );
120120 if (domain != null )
121121 OUT .append ("; Domain=" ).append (domain );
122122 if (path != null )
123123 OUT .append ("; Path=" ).append (path );
124- if (secure )
124+ if (secure != null && secure )
125125 OUT .append ("; Secure=" ).append (secure );
126- if (httpOnly )
126+ if (httpOnly != null && httpOnly )
127127 OUT .append ("; HttpOnly=" ).append (httpOnly );
128128 if (sameSite != null )
129129 OUT .append ("; SameSite=" ).append (sameSite );
@@ -135,7 +135,6 @@ public final String toCookieHeaderString(){
135135 * Builder class for {@link SimpleHttpCookie}.
136136 *
137137 * @see SimpleHttpCookie
138- *
139138 * @since 02.03.00
140139 * @version 02.03.00
141140 * @author Ktt Development
@@ -150,8 +149,8 @@ public static class Builder {
150149 private String sameSite ;
151150 private Date expires ;
152151 private int maxAge ;
153- private boolean secure = false ;
154- private boolean httpOnly = false ;
152+ private Boolean secure ;
153+ private Boolean httpOnly ;
155154
156155 /**
157156 * Creates an HTTP cookie builder given a key and value.
@@ -199,7 +198,6 @@ public final String getValue(){
199198 * @return domain to send the cookie to
200199 *
201200 * @see #setDomain(String)
202- *
203201 * @since 02.03.00
204202 * @author Ktt Development
205203 */
@@ -214,7 +212,6 @@ public final String getDomain(){
214212 * @return cookie builder
215213 *
216214 * @see #getDomain()
217- *
218215 * @since 02.03.00
219216 * @author Ktt Development
220217 */
@@ -229,7 +226,6 @@ public final Builder setDomain(final String domain){
229226 * @return what path to send the cookie to
230227 *
231228 * @see #setPath(String)
232- *
233229 * @since 02.03.00
234230 * @author Ktt Development
235231 */
@@ -244,7 +240,6 @@ public final String getPath(){
244240 * @return cookie builder
245241 *
246242 * @see #getPath()
247- *
248243 * @since 02.03.00
249244 * @author Ktt Development
250245 */
@@ -259,7 +254,6 @@ public final Builder setPath(final String path){
259254 * @return if the cookie should be prevented from being sent cross-site.
260255 *
261256 * @see #setSameSite(String)
262- *
263257 * @since 02.03.00
264258 * @author Ktt Development
265259 */
@@ -274,7 +268,6 @@ public final String isSameSite(){
274268 * @return cookie builder
275269 *
276270 * @see #isSameSite()
277- *
278271 * @since 02.03.00
279272 * @author Ktt Development
280273 */
@@ -291,7 +284,6 @@ public final Builder setSameSite(final String sameSite){
291284 * @see #setExpires(Date)
292285 * @see #getMaxAge()
293286 * @see #setMaxAge(int)
294- *
295287 * @since 02.03.00
296288 * @author Ktt Development
297289 */
@@ -308,7 +300,6 @@ public final Date getExpires(){
308300 * @see #getExpires()
309301 * @see #getMaxAge()
310302 * @see #setMaxAge(int)
311- *
312303 * @since 02.03.00
313304 * @author Ktt Development
314305 */
@@ -325,7 +316,6 @@ public final Builder setExpires(final Date expires){
325316 * @see #getExpires()
326317 * @see #setExpires(Date)
327318 * @see #setMaxAge(int)
328- *
329319 * @since 02.03.00
330320 * @author Ktt Development
331321 */
@@ -342,7 +332,6 @@ public final int getMaxAge(){
342332 * @see #getExpires()
343333 * @see #setExpires(Date)
344334 * @see #getMaxAge()
345- *
346335 * @since 02.03.00
347336 * @author Ktt Development
348337 */
@@ -357,7 +346,6 @@ public final Builder setMaxAge(final int maxAge){
357346 * @return if the cookie must be sent over a secure/HTTPS protocol
358347 *
359348 * @see #isSecure()
360- *
361349 * @since 02.03.00
362350 * @author Ktt Development
363351 */
@@ -372,7 +360,6 @@ public final boolean isSecure(){
372360 * @return cookie builder
373361 *
374362 * @see #setSecure(boolean)
375- *
376363 * @since 02.03.00
377364 * @author Ktt Development
378365 */
@@ -387,7 +374,6 @@ public final Builder setSecure(final boolean secure){
387374 * @return if only the server should have access to the cookies.
388375 *
389376 * @see #setHttpOnly(boolean)
390- *
391377 * @since 02.03.00
392378 * @author Ktt Development
393379 */
@@ -402,7 +388,6 @@ public final boolean isHttpOnly(){
402388 * @return cookie builder
403389 *
404390 * @see #isHttpOnly()
405- *
406391 * @since 02.03.00
407392 * @author Ktt Development
408393 */
0 commit comments