public static List<Flash> getFlashes(Request request) { List<Flash> flashes = new LinkedList<Flash>(); Series<Cookie> cookies = request.getCookies(); String flashdrops = cookies.getFirstValue("flashdrop"); if (StringUtils.isBlank(flashdrops)) { return flashes; } for (String dropbox : flashdrops.split(",")) { if(dropbox!=null) { Flash flash = dropboxes.remove(Long.parseLong(dropbox)); if(flash!=null) { flashes.add(flash); } } } return flashes; }
/** * Returns the value of the first parameter found with the given name. * * @param name * The parameter name (case sensitive). * @return The value of the first parameter found with the given name. */ public String getFirstValue(String name) { return getFirstValue(name, false); }
/** * Indicates if this URL is being examined in a context in which it makes * sense to allow user interactions such as popping up an authentication * dialog. * * @return True if it makes sense to allow user interactions. */ public boolean isAllowUserInteraction() { return Boolean.parseBoolean(getHelpedParameters().getFirstValue( "allowUserInteraction", "false")); }
/** * Indicates if the protocol will automatically follow redirects. * * @return True if the protocol will automatically follow redirects. */ public boolean isFollowRedirects() { return Boolean.parseBoolean(getHelpedParameters().getFirstValue( "followRedirects", "false")); }
/** * Returns the minimum threads waiting to service requests. Technically * speaking, this is a core number of threads that are pre-started. * * @return The minimum threads waiting to service requests. */ public int getMinThreads() { return Integer.parseInt(getHelpedParameters().getFirstValue( "minThreads", "1")); }
/** * Returns true if the request is a CORS request. * * @param request * The current request. * @return true if the request is a CORS request. */ public boolean isCorsRequest(Request request) { return request.getHeaders().getFirstValue("Origin", true) != null; }
/** * Returns the maximum number of connections that will be created for any * particular host. * * @return The maximum number of connections that will be created for any * particular host. */ public int getMaxConnectionsPerHost() { return Integer.parseInt(getHelpedParameters().getFirstValue( "maxConnectionsPerHost", "10")); }
/** * Returns the SSL keystore password. * * @return The SSL keystore password. */ public String getKeystorePassword() { return getHelpedParameters().getFirstValue("keystorePassword", ""); }
/** * Returns the SSL keystore path. * * @return The SSL keystore path. */ public String getKeystorePath() { return getHelpedParameters().getFirstValue("keystorePath", System.getProperty("user.home") + File.separator + ".keystore"); }
/** * Returns the SSL keystore type. * * @return The SSL keystore type. */ public String getKeystoreType() { return getHelpedParameters().getFirstValue("keystoreType", "JKS"); }
/** * Returns the name of the RNG algorithm. * * @return The name of the RNG algorithm. */ public String getSecureRandomAlgorithm() { return getHelpedParameters().getFirstValue("secureRandomAlgorithm", null); }
/** * Indicates if we require client certificate authentication. * * @return True if we require client certificate authentication. */ public boolean isNeedClientAuthentication() { return Boolean.parseBoolean(getHelpedParameters().getFirstValue( "needClientAuthentication", "false")); }
/** * Returns the time in ms that connections will persist if listener is low * on resources. * * @return The time in ms that connections will persist if listener is low * on resources. */ public int getLowResourceMaxIdleTimeMs() { return Integer.parseInt(getHelpedParameters().getFirstValue( "lowResourceMaxIdleTimeMs", "2500")); }
/** * Returns the threshold of remaining threads at which the server is * considered as running low on resources. * * @return The threshold of remaining threads at which the server is * considered as running low on resources. */ public int getLowThreads() { return Integer.parseInt(getHelpedParameters().getFirstValue( "lowThreads", "25")); }
/** * Returns the minimum threads waiting to service requests. * * @return The minimum threads waiting to service requests. */ public int getMinThreads() { return Integer.parseInt(getHelpedParameters().getFirstValue( "minThreads", "1")); }
/** * Returns the read timeout value. A timeout of zero is interpreted as an * infinite timeout. * * @return The read timeout value. */ public int getReadTimeout() { return Integer.parseInt(getHelpedParameters().getFirstValue( "readTimeout", "0")); }
/** * Indicates if the protocol is allowed to use caching whenever it can. * * @return True if the protocol is allowed to use caching whenever it can. */ public boolean isUseCaches() { return Boolean.parseBoolean(getHelpedParameters().getFirstValue( "useCaches", "false")); }
/** * Indicates if the protocol is allowed to use caching whenever it can. * * @return True if the protocol is allowed to use caching whenever it can. */ public boolean isUseCaches() { return Boolean.parseBoolean(getHelpedParameters().getFirstValue( "useCaches", "false")); }
/** * Returns the SSL key password. * * @return The SSL key password. */ @Deprecated public String getKeyPassword() { return getHelpedParameters().getFirstValue("keyPassword", getKeystorePassword()); }
/** * Unget current authorization session. */ protected void ungetAuthSession() { String sessionId = getCookies().getFirstValue(ClientCookieID); // cleanup cookie. if (sessionId != null && sessionId.length() > 0) { ConcurrentMap<String, Object> attribs = getContext() .getAttributes(); attribs.remove(sessionId); } }