List of usage examples for java.util EnumSet of
@SafeVarargs public static <E extends Enum<E>> EnumSet<E> of(E first, E... rest)
From source file:org.fon.documentmanagementsystem.config.WebAppInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(AppConfig.class); ctx.setServletContext(servletContext); ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1);//from w w w .j a v a 2 s . c o m servlet.setMultipartConfig(new MultipartConfigElement("", 1024 * 1024 * 25, 1024 * 1024 * 25, 0)); CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); characterEncodingFilter.setEncoding("UTF-8"); characterEncodingFilter.setForceEncoding(true); FilterRegistration.Dynamic characterEncoding = servletContext.addFilter("characterEncoding", characterEncodingFilter); EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD); characterEncoding.addMappingForUrlPatterns(dispatcherTypes, true, "/*"); }
From source file:com.github.fge.jackson.SampleNodeProvider.java
public static Iterator<Object[]> getSamplesExcept(final NodeType first, final NodeType... other) { return getSamples(Sets.complementOf(EnumSet.of(first, other))); }
From source file:org.jblogcms.core.config.MainConfig.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(MainContext.class); ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME, new DispatcherServlet(rootContext)); dispatcher.setLoadOnStartup(1);//ww w .j a v a 2 s. co m dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING); EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD); CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); characterEncodingFilter.setEncoding("UTF-8"); characterEncodingFilter.setForceEncoding(true); FilterRegistration.Dynamic characterEncoding = servletContext.addFilter("characterEncoding", characterEncodingFilter); characterEncoding.addMappingForUrlPatterns(dispatcherTypes, true, "/*"); FilterRegistration.Dynamic security = servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy()); security.addMappingForUrlPatterns(dispatcherTypes, true, "/*"); servletContext.addListener(new ContextLoaderListener(rootContext)); }
From source file:ch.cyberduck.core.irods.IRODSHomeFinderService.java
@Override public Path find() throws BackgroundException { final Path home = super.find(); if (home == DEFAULT_HOME) { final String user; final Credentials credentials = session.getHost().getCredentials(); if (StringUtils.contains(credentials.getUsername(), ':')) { user = StringUtils.splitPreserveAllTokens(credentials.getUsername(), ':')[1]; } else {/*from ww w. j av a 2 s.c om*/ user = credentials.getUsername(); } return new Path( new StringBuilder().append(Path.DELIMITER).append(session.getRegion()).append(Path.DELIMITER) .append("home").append(Path.DELIMITER).append(user).toString(), EnumSet.of(Path.Type.directory, Path.Type.volume)); } return home; }
From source file:com.smartsheet.api.internal.ReportResourcesImplTest.java
@Test public void testGetReport() throws SmartsheetException, IOException { server.setResponseBody(new File("src/test/resources/getReport.json")); Report report = reportResources.getReport(4583173393803140L, EnumSet.of(ReportInclusion.ATTACHMENTS, ReportInclusion.DISCUSSIONS), 1, 1); assertEquals(report.getPermalink(), "https://app.smartsheet.com/b/home?lx=pWNSDH9itjBXxBzFmyf-5w"); assertTrue(report.getColumns().get(0).getVirtualId() == 4583173393803140L); }
From source file:de.schildbach.pte.service.LocationController.java
@RequestMapping(value = "/location/nearby", method = RequestMethod.GET) @ResponseBody/*from w w w . jav a2 s. c om*/ public NearbyLocationsResult nearby(@RequestParam("lat") final int lat, @RequestParam("lon") final int lon) throws IOException { final Location coord = Location.coord(lat, lon); return provider.queryNearbyLocations(EnumSet.of(LocationType.STATION, LocationType.POI), coord, 5000, 100); }
From source file:ch.cyberduck.core.googlestorage.S3SingleUploadServiceTest.java
@Test public void testUpload() throws Exception { final S3SingleUploadService m = new S3SingleUploadService(session, new S3WriteFeature(session, new S3DisabledMultipartService())); final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume)); final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); final String random = new RandomStringGenerator.Builder().build().generate(1000); final OutputStream out = local.getOutputStream(false); IOUtils.write(random, out, Charset.defaultCharset()); out.close();//from w w w . ja v a 2 s .com final TransferStatus status = new TransferStatus(); status.setLength(random.getBytes().length); m.upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED), new DisabledStreamListener(), status, new DisabledLoginCallback()); assertTrue(new S3FindFeature(session).find(test)); final PathAttributes attributes = session.list(container, new DisabledListProgressListener()).get(test) .attributes(); assertEquals(random.getBytes().length, attributes.getSize()); new S3DefaultDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); local.delete(); }
From source file:org.bitcoinrt.web.config.BitcointWebAppInitializer.java
public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext webAppContext = new AnnotationConfigWebApplicationContext(); webAppContext.register(WebConfig.class); final DispatcherServlet dispatcherServlet = new DispatcherServlet(webAppContext); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcherServlet", dispatcherServlet); dispatcher.setLoadOnStartup(1);// w ww .ja v a2 s .c om dispatcher.addMapping("/site/*"); UrlRewriteFilter urlRewriteFilter = new UrlRewriteFilter(); servletContext.addFilter("UrlRewriteFilter", urlRewriteFilter) .addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), false, "/*"); }
From source file:com.google.code.stackexchange.client.examples.QuestionsApiExample.java
/** * Process command line.// w w w .ja v a 2 s. co m * * @param line the line * @param options the options */ private static void processCommandLine(CommandLine line, Options options) { if (line.hasOption(HELP_OPTION)) { printHelp(options); } else if (line.hasOption(APPLICATION_KEY_OPTION)) { final String keyValue = line.getOptionValue(APPLICATION_KEY_OPTION); final StackExchangeApiClientFactory factory = StackExchangeApiClientFactory.newInstance(keyValue); final StackExchangeApiClient client = factory.createStackExchangeApiClient(); if (line.hasOption(ID_OPTION)) { String idValue = line.getOptionValue(ID_OPTION); List<Question> question = client.getQuestions(Long.valueOf(idValue)); printResult(question.get(0)); } else { List<Question> questions = client .getQuestions(EnumSet.of(FilterOption.INCLUDE_BODY, FilterOption.INCLUDE_COMMENTS)); for (Question question : questions) { printResult(question); } List<PostTimeline> questionTimeline = client.getQuestionsTimeline(2420689L); for (PostTimeline timeline : questionTimeline) { printResult(timeline); } } } else { printHelp(options); } }
From source file:com.asual.summer.ajax.AjaxViewContextImpl.java
public void processPartial(PhaseId phaseId) { FacesContext context = FacesContext.getCurrentInstance(); PartialViewContext partialViewContext = context.getPartialViewContext(); Collection<String> renderIds = partialViewContext.getRenderIds(); if (phaseId == PhaseId.RENDER_RESPONSE) { try {/*from w w w .ja v a 2 s. co m*/ ResponseWriter writer = FacesContext.getCurrentInstance().getResponseWriter(); writer.startDocument(); writer.write("<!DOCTYPE html>\n".toCharArray()); writer.startElement("html", null); writer.startElement("title", null); writer.write("Ajax Response"); writer.endElement("title"); if (renderIds != null && !renderIds.isEmpty()) { EnumSet<VisitHint> hints = EnumSet.of(VisitHint.SKIP_UNRENDERED, VisitHint.EXECUTE_LIFECYCLE); context.getViewRoot().visitTree(new AjaxVisitContext(renderIds, hints), new AjaxVisitCallback(phaseId)); } writer.endElement("html"); writer.endDocument(); } catch (IOException ioe) { } catch (RuntimeException e) { throw e; } } }