19 package org.turro.elephant.web.tags;
21 import java.util.ArrayList;
22 import java.util.List;
23 import java.util.stream.Collectors;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
26 import org.turro.elephant.context.AbstractSessionObject;
27 import org.turro.elephant.context.IConstructor;
28 import org.turro.elephant.web.context.WebContext;
29 import org.turro.string.Strings;
37 public List<String>
tags() {
42 return tags.stream().collect(Collectors.joining(
"/"));
46 return !tags.isEmpty() ? tags.get(0) :
null;
50 return !tags.isEmpty() ? tags.get(tags.size() - 1) :
null;
54 return tags.size() > 1 ? tags.get(tags.size() - 2) :
null;
59 tags.remove(tags.size() -1);
69 public void add(String tag) {
70 if(!Strings.isBlank(tag)) {
77 public static String
key() {
85 public static SessionTags get(HttpServletRequest request, HttpServletResponse response) {
93 public static void remove() {
97 public static void remove(HttpServletRequest request, HttpServletResponse response) {
105 private final List<String> tags;
108 this.tags =
new ArrayList<>();
static void remove(String key)
static< E > E get(String key, Supplier< E > supplier)