method2testcases stringlengths 118 6.63k |
|---|
### Question:
OptionImpl implements Option { public String toString() { StringBuffer result = new StringBuffer(getName() + " [ "); getAttributeNames().forEach(key -> result.append(key + "=\"" + getString(key) + "\" ")); result.append("]"); return result.toString(); } OptionImpl(String name); OptionImpl(String name, Ma... |
### Question:
OptionImpl implements Option { public int getAttributeAsInteger(String name) { return Integer.valueOf(attributeMap.get(name)); } OptionImpl(String name); OptionImpl(String name, Map<String, String> map); String getName(); OptionImpl addMap(Map<String, String> map); OptionImpl addAttribute(String name, St... |
### Question:
OptionImpl implements Option { public boolean containsAttribute(String name) { return attributeMap.containsKey(name); } OptionImpl(String name); OptionImpl(String name, Map<String, String> map); String getName(); OptionImpl addMap(Map<String, String> map); OptionImpl addAttribute(String name, String valu... |
### Question:
OptionsImpl implements Options { public void addOption(Option option) { optionsMap.put(option.getName(), option); } void addOption(Option option); Option getOption(String name); boolean hasOption(String name); Set<String> getOptionNames(); String getOptionValue(String optionName, String attributeName); S... |
### Question:
XHTML { public static String getAttr(String tag, String attr) { String value = ""; Pattern p = Pattern.compile(getAttributeExpression(attr)); Matcher m = p.matcher(tag); if (m.find()) { value = m.group(1); } return value; } static String removeAttr(String tag, String attr); static String setAttr(String t... |
### Question:
OptionsImpl implements Options { public String getOptionValue(String optionName, String attributeName) { Option option = getOption(optionName); return (null == option) ? null : option.getString(attributeName); } void addOption(Option option); Option getOption(String name); boolean hasOption(String name);... |
### Question:
OptionsImpl implements Options { public Integer getInteger(String name, String attribute) { return hasOption(name) ? getOption(name).getInteger(attribute) : null; } void addOption(Option option); Option getOption(String name); boolean hasOption(String name); Set<String> getOptionNames(); String getOption... |
### Question:
OptionsImpl implements Options { public Boolean getBoolean(String name, String attribute) { return hasOption(name) ? getOption(name).getBoolean(attribute) : null; } void addOption(Option option); Option getOption(String name); boolean hasOption(String name); Set<String> getOptionNames(); String getOption... |
### Question:
OptionsImpl implements Options { public <E extends Enum<E>> E getEnum(String name, String attribute, Class<E> type) { return hasOption(name) ? getOption(name).getEnum(attribute, type) : null; } void addOption(Option option); Option getOption(String name); boolean hasOption(String name); Set<String> getOp... |
### Question:
OptionsImpl implements Options { public Set<String> getOptionNames() { return optionsMap.keySet(); } void addOption(Option option); Option getOption(String name); boolean hasOption(String name); Set<String> getOptionNames(); String getOptionValue(String optionName, String attributeName); String toString(... |
### Question:
OptionsImpl implements Options { public String toString() { StringBuffer result = new StringBuffer(); result.append(optionsMap.values()); return result.toString(); } void addOption(Option option); Option getOption(String name); boolean hasOption(String name); Set<String> getOptionNames(); String getOptio... |
### Question:
MessageSourceChain implements MessageSource { public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { check(); String message = null; for (int i = 0; i < messageSources.length && message == null; i++) { message = messageSources[i].getMessage(code, args, defaultMessage,... |
### Question:
SortParamSupport { Pageable getPageable(String string) { if (MODE_RESET.equals(string) || StringUtils.endsWith(string, MODE_RESET)) { reset = true; } String key = getSessionKey(); String currentOrder = sessionMap.get(key); Pageable currentParams = parseParamsToPageable(currentOrder, false); Pageable parse... |
### Question:
XSSUtil { public String stripXss(String parameter) { if (null == parameter) { return parameter; } return Jsoup.clean(encoder.canonicalize(parameter), whitelist); } XSSUtil(Encoder encoder); XSSUtil(Encoder encoder, Whitelist whitelist, String... exceptions); String stripXss(String parameter); String[] st... |
### Question:
ExpressionEvaluator { @SuppressWarnings("unchecked") public final <T> T evaluate(String expression, Class<T> targetType) { ValueExpression ve = ef.createValueExpression(ctx, expression, targetType); Object value = ve.getValue(ctx); T result = (T) value; if (LOGGER.isDebugEnabled()) { StringBuilder sb = ne... |
### Question:
ExpressionEvaluator { public boolean isExpression(String value) { return null != value && value.matches("\\$\\{.*\\}"); } ExpressionEvaluator(Map<String, ?> variables); ExpressionEvaluator(javax.el.VariableMapper variableMapper); @SuppressWarnings("unchecked") final T evaluate(String expression, Class<T>... |
### Question:
XHTML { public static String getTag(String tag) { String value = ""; Pattern p = Pattern.compile("<(\\w+?)\\s"); Matcher m = p.matcher(tag); if (m.find()) { value = m.group(1); } return value; } static String removeAttr(String tag, String attr); static String setAttr(String tag, String attr, String value... |
### Question:
RepositoryUtils { public static boolean isSnapshot(String name) { return name.contains(SNAPSHOT); } private RepositoryUtils(); static String getContextPath(); static boolean isNewer(PackageVersion versionA, PackageVersion versionB); static boolean isNewer(PackageInfo packageA, PackageInfo packageB); stat... |
### Question:
RepositoryUtils { public static Date getDate(PackageInfo packageInfo) { try { return FDF.parse(packageInfo.getTimestamp()); } catch (ParseException e) { return new Date(0L); } } private RepositoryUtils(); static String getContextPath(); static boolean isNewer(PackageVersion versionA, PackageVersion versi... |
### Question:
RepositoryUtils { public static Comparator<PackageInfo> getVersionComparator() { return (p1, p2) -> { int compared = 0; if (Version.isValidVersion(p1.getVersion()) && Version.isValidVersion(p2.getVersion())) { compared = Version.parseVersion(p1.getVersion(), true) .compareTo(Version.parseVersion(p2.getVer... |
### Question:
StringNormalizer { public static String removeNonPrintableCharacters(final String value) { return replaceNonPrintableCharacters(value, StringUtils.EMPTY); } static final String normalize(final String input); static String removeNonPrintableCharacters(final String value); static String replaceNonPrintable... |
### Question:
CacheProvider { protected File getCache() { return mkdir(cache); } CacheProvider(Properties platformConfig); CacheProvider(Properties platformConfig, boolean changeOwner); void clearCache(Site site); void clearCache(Site site, String application); File getPlatformCache(Nameable site, Nameable application... |
### Question:
CacheProvider { public void clearCache(Site site) { clear(getPlatformCache(site)); clear(getApplicationCache(site)); } CacheProvider(Properties platformConfig); CacheProvider(Properties platformConfig, boolean changeOwner); void clearCache(Site site); void clearCache(Site site, String application); File ... |
### Question:
CacheProvider { protected File getPlatformCache() { return mkdir(platform); } CacheProvider(Properties platformConfig); CacheProvider(Properties platformConfig, boolean changeOwner); void clearCache(Site site); void clearCache(Site site, String application); File getPlatformCache(Nameable site, Nameable ... |
### Question:
CacheProvider { public String getRelativePlatformCache(Nameable site, Nameable application) { String applicationCache = getPlatformCache(site.getName(), application.getName()).getAbsolutePath(); return applicationCache.substring(prefixLength); } CacheProvider(Properties platformConfig); CacheProvider(Pro... |
### Question:
CacheProvider { public File getImageCache(Nameable site, Nameable application) { return mkdir(getImageCache(site.getName(), application.getName())); } CacheProvider(Properties platformConfig); CacheProvider(Properties platformConfig, boolean changeOwner); void clearCache(Site site); void clearCache(Site ... |
### Question:
PageParameterProcessor { boolean processPageParams(List<String> applicationUrlParameters, UrlSchema urlSchema) { processPostParams(urlSchema.getPostParams()); processGetParams(urlSchema.getGetParams()); boolean urlParamsAdded = processUrlParams(applicationUrlParameters, urlSchema.getUrlParams()); processS... |
### Question:
PropertyConstantCreator { public static void main(String[] args) throws IOException { if (args.length < 3) { throw new IllegalArgumentException( "at least 3 parameters needed: filePath* targetClass* outFolder* [charset]"); } String filePath = args[0]; String targetClass = args[1]; String outfolder = args[... |
### Question:
TemplateService { public org.appng.xml.application.Template getTemplate(String templateDir) throws IOException, JAXBException { return validateResource(MarshallService.getApplicationMarshallService(), TEMPLATE_XML, new FileInputStream(new File(templateDir, TEMPLATE_XML)), org.appng.xml.application.Templat... |
### Question:
TemplateService { public ZipFileProcessor<Template> getTemplateExtractor() { ZipFileProcessor<Template> templateExtractor = new ZipFileProcessor<Template>() { public Template process(ZipFile zipFile) throws IOException { org.appng.xml.application.Template templateXml = null; List<TemplateResource> resourc... |
### Question:
TemplateService { public Template installTemplate(PackageArchive packageArchive) throws BusinessException { try { ZipFileProcessor<Template> templateExtractor = getTemplateExtractor(); Template template = packageArchive.processZipFile(templateExtractor); Template existing = templateRepository.findByName(t... |
### Question:
InitializerService { @Transactional public void initPlatform(PlatformProperties platformConfig, Environment env, DatabaseConnection rootConnection, ServletContext ctx, ExecutorService executor) throws InvalidConfigurationException { logEnvironment(); loadPlatform(platformConfig, env, null, null, executor)... |
### Question:
InitializerService { @Transactional public synchronized void loadSite(Environment env, SiteImpl siteToLoad, FieldProcessor fp) throws InvalidConfigurationException { loadSite(env, siteToLoad, true, fp); } InitializerService(); @Transactional void initPlatform(PlatformProperties platformConfig, Environment... |
### Question:
PropertySupport { public void initPlatformConfig(String rootPath, Boolean devMode) { initPlatformConfig(rootPath, devMode, new java.util.Properties(), true); } PropertySupport(PropertyHolder propertyHolder); static java.util.Properties getProperties(Properties platFormConfig, Site site, Application applic... |
### Question:
RuleValidation { public static boolean fileSize(List<FormUpload> fUpload, String minSize, String maxSize) { return isValidFileUpload(fUpload, minSize, false) && isValidFileUpload(fUpload, maxSize, true); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<Form... |
### Question:
RuleValidation { public static boolean fileType(List<FormUpload> fUpload, String types) { List<String> fileTypes = Arrays.asList(types.split(COMMA)); if (fUpload != null) { for (FormUpload fileName : fUpload) { if (!fileTypes.contains(fileName.getContentType())) { return false; } } } return true; } RuleVa... |
### Question:
ImageProcessor { public ImageProcessor rotate(int degrees) { op.rotate((double) degrees); return this; } ImageProcessor(File imageMagickPath, File sourceFile, File targetFile); ImageProcessor(File imageMagickPath, File sourceFile, File targetFile, boolean checkMagicBytes); ImageProcessor(File sourceFile... |
### Question:
RuleValidation { public static boolean fileCount(List<FormUpload> fUpload, int minCount, int maxCount) { return fileCountMin(fUpload, minCount) && fileCountMax(fUpload, maxCount); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); b... |
### Question:
RuleValidation { public static boolean fileCountMin(List<FormUpload> fUpload, int count) { return getNumberOfFiles(fUpload) >= count; } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean s... |
### Question:
RuleValidation { public static boolean fileCountMax(List<FormUpload> fUpload, int count) { return getNumberOfFiles(fUpload) <= count; } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean s... |
### Question:
DatabaseService extends MigrationService { @Transactional public DatabaseConnection initDatabase(java.util.Properties config, boolean managed, boolean setActive) { DatabaseConnection platformConnection = initDatabase(config); MigrationInfoService statusComplete = platformConnection.getMigrationInfoService... |
### Question:
RuleValidation { public static boolean string(String string) { return regExp(string, EXP_STRING); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean... |
### Question:
DatabaseService extends MigrationService { protected String getUserName(Site site, Application application) { return "site" + site.getId() + "app" + application.getId(); } void resetApplicationConnection(SiteApplication siteApplication, String databasePrefix); @Transactional DatabaseConnection initDataba... |
### Question:
LdapService { public List<SubjectImpl> getMembersOfGroup(Site site, String groupName) { List<SubjectImpl> subjects = new ArrayList<>(); String serviceUser = site.getProperties().getString(LDAP_USER); char[] servicePassword = site.getProperties().getString(LDAP_PASSWORD).toCharArray(); LdapCredentials ldap... |
### Question:
Signer { public static SignatureWrapper signRepo(Path repoPath, SignerConfig config) throws SigningException { String missingKey = config.hasMissingKey(); if (missingKey != null) throw new SigningException(ErrorType.SIGN, String.format("Missing configuration key '%s' in SignerConfig.", missingKey)); LOGGE... |
### Question:
RuleValidation { public static boolean captcha(String value, String result) { return StringUtils.equals(value, result); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String s... |
### Question:
Signer { public static Signer getRepoValidator(ValidatorConfig config, byte[] indexFileData, byte[] signatureData) throws SigningException { return getRepoValidator(config, indexFileData, signatureData, null); } private Signer(ValidatorConfig config); static Signer getRepoValidator(ValidatorConfig config... |
### Question:
BCryptPasswordHandler implements PasswordHandler { public boolean isValidPassword(String password) { boolean isValid = BCrypt.checkpw(password, authSubject.getDigest()); return isValid; } BCryptPasswordHandler(AuthSubject authSubject); void applyPassword(String password); boolean isValidPassword(String pa... |
### Question:
BCryptPasswordHandler implements PasswordHandler { public boolean isValidPasswordResetDigest(String digest) { String expectedDigest = new SaltedDigestSha1().getDigest(authSubject.getEmail(), authSubject.getSalt()); return expectedDigest.equals(digest); } BCryptPasswordHandler(AuthSubject authSubject); voi... |
### Question:
DigestValidator { public boolean validate(String sharedSecret) { if (!errors && setClientDate() && validateTimestamp() && validateHashedPart(sharedSecret)) { LOGGER.info("Digest successfully validated."); return true; } LOGGER.error("Digest validation failed."); return false; } DigestValidator(String dige... |
### Question:
DefaultPasswordPolicy implements PasswordPolicy { public String generatePassword() { return random(6, LOWERCASE + UPPERCASE) + random(1, NUMBER) + random(1, PUNCT); } @Deprecated DefaultPasswordPolicy(); @Deprecated DefaultPasswordPolicy(String regEx, String errorMessageKey); @Override void configure(Pr... |
### Question:
DefaultPasswordPolicy implements PasswordPolicy { public boolean isValidPassword(char[] password) { return pattern.matcher(new String(password)).matches(); } @Deprecated DefaultPasswordPolicy(); @Deprecated DefaultPasswordPolicy(String regEx, String errorMessageKey); @Override void configure(Properties ... |
### Question:
Sha1PasswordHandler implements PasswordHandler { public void applyPassword(String password) { String salt = saltedDigest.getSalt(); String digest = saltedDigest.getDigest(password, salt); authSubject.setSalt(salt); authSubject.setDigest(digest); authSubject.setPasswordLastChanged(new Date()); } Sha1Passwo... |
### Question:
Sha1PasswordHandler implements PasswordHandler { public boolean isValidPassword(String password) { String digest = saltedDigest.getDigest(password, authSubject.getSalt()); return digest.equals(authSubject.getDigest()); } Sha1PasswordHandler(AuthSubject authSubject); void applyPassword(String password); bo... |
### Question:
RuleValidation { public static boolean email(String string) { return regExp(string, EMAIL_PATTERN); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boole... |
### Question:
Sha1PasswordHandler implements PasswordHandler { public String calculatePasswordResetDigest() { return saltedDigest.getDigest(authSubject.getEmail(), authSubject.getSalt()); } Sha1PasswordHandler(AuthSubject authSubject); void applyPassword(String password); boolean isValidPassword(String password); Strin... |
### Question:
Sha1PasswordHandler implements PasswordHandler { public boolean isValidPasswordResetDigest(String digest) { return calculatePasswordResetDigest().equals(digest); } Sha1PasswordHandler(AuthSubject authSubject); void applyPassword(String password); boolean isValidPassword(String password); String calculateP... |
### Question:
SessionListener implements ServletContextListener, HttpSessionListener, ServletRequestListener { public void sessionCreated(HttpSessionEvent event) { createSession(event.getSession()); } void contextInitialized(ServletContextEvent sce); void contextDestroyed(ServletContextEvent sce); void sessionCreated(... |
### Question:
SessionListener implements ServletContextListener, HttpSessionListener, ServletRequestListener { public void sessionDestroyed(HttpSessionEvent event) { HttpSession httpSession = event.getSession(); Environment env = DefaultEnvironment.get(httpSession); if (env.isSubjectAuthenticated()) { ApplicationContex... |
### Question:
Controller extends DefaultServlet implements ContainerServlet { @Override protected void doPut(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException { if (isServiceRequest(servletRequest)) { doGet(servletRequest, servletResponse); } else { LOGGER.debu... |
### Question:
RuleValidation { public static boolean equals(String string1, String string2) { return StringUtils.equals(string1, string2); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(Str... |
### Question:
Controller extends DefaultServlet implements ContainerServlet { @Override protected void doDelete(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException { if (isServiceRequest(servletRequest)) { doGet(servletRequest, servletResponse); } else { LOGGER.d... |
### Question:
RuleValidation { public static boolean regExp(String string, String regex) { return string.matches(regex); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); stati... |
### Question:
RuleValidation { private static int size(Object item) { if (null == item) { return 0; } if (Collection.class.isAssignableFrom(item.getClass())) { return ((Collection<?>) item).size(); } if (CharSequence.class.isAssignableFrom(item.getClass())) { return ((CharSequence) item).length(); } throw new Unsupport... |
### Question:
Controller extends DefaultServlet implements ContainerServlet { protected void doHead(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request, wrapResponseForHeadRequest(response)); } Controller(); void serveResource(HttpServletRequest request, HttpSe... |
### Question:
PageCacheFilter implements javax.servlet.Filter { static boolean isException(String exceptionsProp, String servletPath) { if (null != exceptionsProp) { Set<String> exceptions = new HashSet<>(Arrays.asList(exceptionsProp.split(StringUtils.LF))); for (String e : exceptions) { if (servletPath.startsWith(e.tr... |
### Question:
PageCacheFilter implements javax.servlet.Filter { static Integer getExpireAfterSeconds(Properties cachingTimes, boolean antStylePathMatching, String servletPath, Integer defaultValue) { if (null != cachingTimes && !cachingTimes.isEmpty()) { if (antStylePathMatching) { for (Object path : cachingTimes.keySe... |
### Question:
JspExtensionFilter implements Filter { protected String doReplace(List<RedirectRule> redirectRules, String sourcePath, String domain, String jspExtension, String content) { long startTime = System.currentTimeMillis(); int numRules = 0; if (null != redirectRules) { numRules = redirectRules.size(); for (Red... |
### Question:
MonitoringHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment env, Site site, PathInfo pathInfo) throws ServletException, IOException { servletResponse.addHeader(HttpHeaders.WWW_AUTHENTICATE, BASIC_REALM); if (isAuthent... |
### Question:
RuleValidation { public static boolean sizeMin(Object item, int min) { return size(item) >= min; } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean ... |
### Question:
ImageProcessor { public ImageProcessor quality(double quality) { op.quality(quality); return this; } ImageProcessor(File imageMagickPath, File sourceFile, File targetFile); ImageProcessor(File imageMagickPath, File sourceFile, File targetFile, boolean checkMagicBytes); ImageProcessor(File sourceFile, Fi... |
### Question:
GuiHandler implements RequestHandler { public void handle(HttpServletRequest servletRequest, HttpServletResponse servletResponse, Environment environment, Site site, PathInfo pathInfo) throws ServletException, IOException { Properties platformProperties = environment.getAttribute(Scope.PLATFORM, Platform.... |
### Question:
RepositoryWatcher implements Runnable { void init(Cache<String, CachedResponse> cache, String wwwDir, File configFile, String ruleSourceSuffix, List<String> documentDirs) throws Exception { this.cache = cache; this.watcher = FileSystems.getDefault().newWatchService(); this.wwwDir = FilenameUtils.normalize... |
### Question:
ApplicationPostProcessor implements BeanFactoryPostProcessor, Ordered { public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { beanFactory.registerSingleton("site", site); beanFactory.registerSingleton("application", application); beanFactory.getBean(Applic... |
### Question:
SubjectImpl implements Subject, Auditable<Integer> { @Column(name = "locked") public boolean isLocked() { return locked; } @NotNull(message = ValidationMessages.VALIDATION_NOT_NULL) @Pattern(regexp = ValidationPatterns.USERNAME_OR_LDAPGROUP_PATTERN, message = ValidationPatterns.USERNAME_GROUP_MSSG) @Size... |
### Question:
SubjectImpl implements Subject, Auditable<Integer> { @Transient public boolean isInactive(Date now, Integer inactiveLockPeriod) { return null != lastLogin && inactiveLockPeriod > 0 && DateUtils.addDays(lastLogin, inactiveLockPeriod).before(now); } @NotNull(message = ValidationMessages.VALIDATION_NOT_NULL... |
### Question:
RuleValidation { public static boolean sizeMax(Object item, int max) { return size(item) <= max; } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean ... |
### Question:
PropertyImpl extends SimpleProperty implements Property, Auditable<String>, Comparable<Property> { @Override @Column(name = "prop_type") @Enumerated(EnumType.STRING) public Type getType() { return super.getType(); } PropertyImpl(); PropertyImpl(String name, String value); PropertyImpl(String name, Strin... |
### Question:
SiteImpl implements Site, Auditable<Integer> { private void closeClassloader() { try { siteClassLoader.close(); } catch (IOException e) { LOGGER.error("error while closing classloader", e); } siteClassLoader = null; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer getId(); void setId(Int... |
### Question:
ActionHelper { public ActionHelper deselectAllOptions(String name) { Optional<ActionField> field = getField(name); if (field.isPresent() && isSelectionType(field.get())) { field.get().getOptions().getEntries().forEach(o -> o.setSelected(false)); } return this; } ActionHelper(ResponseEntity<Action> action)... |
### Question:
ActionHelper { public ActionHelper setFieldValue(String name, Object value) { Optional<ActionField> field = getField(name); if (field.isPresent() && !isSelectionType(field.get())) { field.get().setValue(value); } return this; } ActionHelper(ResponseEntity<Action> action); static ActionHelper create(Respon... |
### Question:
RestClient { protected HttpHeaders getHeaders(boolean acceptAnyType) { HttpHeaders headers = new HttpHeaders(); if (!cookies.isEmpty()) { cookies.keySet().forEach(k -> { String cookie = cookies.get(k); headers.add(HttpHeaders.COOKIE, k + "=" + cookie); LOGGER.debug("sent cookie: {}={}", k, cookies.get(k))... |
### Question:
RestClient { protected void setCookies(ResponseEntity<?> entity) { List<String> setCookies = entity.getHeaders().get(HttpHeaders.SET_COOKIE); if (null != setCookies) { for (String c : setCookies) { int valueStart = c.indexOf('='); String name = c.substring(0, valueStart); int end = c.indexOf(';'); String ... |
### Question:
RestClient { public RestResponseEntity<Datasource> datasource(String application, String id) throws URISyntaxException { return datasource(application, id, (Pageable) null); } RestClient(String url); RestClient(String url, Map<String, String> cookies); RestResponseEntity<Datasource> datasource(String app... |
### Question:
RuleValidation { public static boolean sizeMinMax(Object item, int min, int max) { return sizeMax(item, max) && sizeMin(item, min); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean str... |
### Question:
HashPassword implements ExecutableCliCommand { public void execute(CliEnvironment cle) throws BusinessException { boolean passwordSet = StringUtils.isNotBlank(password); if (!(interactive || passwordSet)) { throw new BusinessException("Either password must be given or -i must be set!"); } if (interactive)... |
### Question:
CliBootstrap { static File getPlatformRootPath(CliBootstrapEnvironment env) { File appngHome = env.getFileFromEnv(APPNG_HOME); return checkFile(APPNG_HOME, appngHome, true); } static void main(String[] args); static int run(String[] args); static String CURRENT_COMMAND; static final String APPNG_HOME; }#... |
### Question:
RuleValidation { public static boolean number(String string) { return regExp(string, EXP_NUMBER); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); static boolean string(String string); static boolean... |
### Question:
PrettyTable { public String render(boolean tabbedValues, boolean beVerbose) { boolean withBorders = !tabbedValues; tableWidth = 0; StringBuilder builder = new StringBuilder(); builder = (withBorders) ? builder.append(PrettyTable.VERTICAL_BORDER) : builder; int noOfColumns = 0; for (TableColumn column : co... |
### Question:
PrettyTable { static String tabbed(String n) { return n + PrettyTable.TAB; } PrettyTable(); void addColumn(String name); void addColumn(String name, boolean isVerbose); void addRow(Object... values); String render(boolean tabbedValues, boolean beVerbose); List<TableRow> getRows(); int getColumnIndex(Strin... |
### Question:
PersonAction implements ActionProvider<Person> { @Override public void perform(Site site, Application application, Environment environment, Options options, Request request, Person formBean, FieldProcessor fieldProcessor) { String mode = options.getOptionValue("action", "id"); if ("edit".equals(mode)) { I... |
### Question:
Updater { protected void updateAppNGizer(Resource resource, String appNGizerHome) throws RestClientException, IOException { if (!(resource.exists() && new File(appNGizerHome).exists())) { return; } Path warArchive = Files.createTempFile(null, null); try ( FileOutputStream out = new FileOutputStream(warArc... |
### Question:
Updater { @RequestMapping(path = "/checkVersionAvailable/{version:.+}", method = RequestMethod.GET) public ResponseEntity<Void> checkVersionAvailable(@PathVariable("version") String version, HttpServletRequest request) throws IOException { if (isBlocked(request)) { return forbidden(); } Resource resource ... |
### Question:
RuleValidation { public static boolean numberFractionDigits(String string, int digits, int fraction) { return number(string, DOT, digits, fraction); } RuleValidation(Request container); Map<String, List<FormUpload>> getFileParams(Map<String, List<FormUpload>> formUploads); boolean validate(String rule); s... |
### Question:
Updater { @RequestMapping(method = RequestMethod.GET, path = "/update/start/{version:.+}", produces = MediaType.TEXT_HTML_VALUE) public ResponseEntity<String> getStartPage(@PathVariable("version") String version, @RequestParam(required = false, defaultValue = "") String onSuccess, HttpServletRequest reque... |
### Question:
Parameter extends BodyTagSupport { public Parameter() { } Parameter(); @Override int doEndTag(); String getName(); void setName(String name); boolean isUnescape(); void setUnescape(boolean unescape); @Override String toString(); }### Answer:
@Test public void testParameter() throws IOException, JspExcept... |
### Question:
Attribute extends TagSupport implements Tag { @Override public int doStartTag() { switch (modeInternal) { case READ: readValue(); try { JspWriter out = pageContext.getOut(); out.print(value); } catch (IOException ioe) { LOGGER.error("error while writing to JspWriter", ioe); } break; case WRITE: writeValue... |
### Question:
MultiSiteSupport { public void process(Environment env, String application, HttpServletRequest servletRequest) throws JspException { process(env, application, null, servletRequest); } void process(Environment env, String application, HttpServletRequest servletRequest); void process(Environment env, Strin... |
### Question:
Permission extends TagSupport { @Override public int doStartTag() throws JspException { try { Environment env = DefaultEnvironment.get(pageContext); HttpServletRequest servletRequest = (HttpServletRequest) pageContext.getRequest(); MultiSiteSupport multiSiteSupport = processMultiSiteSupport(env, servletRe... |
### Question:
TagletProcessor { public boolean perform(Site callingSite, Site executingSite, Application application, Map<String, String> tagletAttributes, org.appng.api.Request applicationRequest, String methodName, String type, Writer out) throws JAXBException, TransformerConfigurationException, FileNotFoundException... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.