List of usage examples for org.springframework.http HttpMethod GET
HttpMethod GET
To view the source code for org.springframework.http HttpMethod GET.
Click Source Link
From source file:org.openwms.tms.FetchStartedTransportOrder.java
@Override public TransportOrder apply(String barcode) { ResponseEntity<List<TransportOrder>> exchange = restTemplate.exchange( "http://tms-service/v1/transportorders?barcode=" + barcode + "&state=STARTED", HttpMethod.GET, null, new ParameterizedTypeReference<List<TransportOrder>>() { });/* w w w . ja v a2s . com*/ if (exchange.getBody().size() == 0) { throw new NotFoundException(String.format( "No started TransportOrders for TransportUnit [%s] found, no routing possible", barcode)); } return exchange.getBody().get(0); }
From source file:cz.muni.fi.mushroomhunter.restclient.AllMushroomsSwingWorker.java
@Override protected List<MushroomDto> doInBackground() throws Exception { String plainCreds = RestClient.USER_NAME + ":" + RestClient.PASSWORD; byte[] plainCredsBytes = plainCreds.getBytes(); byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes); String base64Creds = new String(base64CredsBytes); HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", "Basic " + base64Creds); HttpEntity<String> request = new HttpEntity<>(headers); RestTemplate restTemplate = new RestTemplate(); ResponseEntity<MushroomDto[]> responseEntity = restTemplate.exchange( RestClient.SERVER_URL + "pa165/rest/mushroom/", HttpMethod.GET, request, MushroomDto[].class); MushroomDto[] mushroomDtoArray = responseEntity.getBody(); List<MushroomDto> mushroomDtoList = new ArrayList<>(); mushroomDtoList.addAll(Arrays.asList(mushroomDtoArray)); return mushroomDtoList; }
From source file:fragment.web.StaticPagesControllerTest.java
@Test public void testErrorPages() { MockHttpServletRequest request = getRequestTemplate(HttpMethod.GET, "/errors/error"); request.addHeader("Referer", "REFERER_MARKER"); ModelAndView mav = controller.handle(request); ModelAndViewAssert.assertViewName(mav, null); ModelAndViewAssert.assertModelAttributeValue(mav, "ref", "REFERER_MARKER"); ModelAndViewAssert.assertModelAttributeValue(mav, "uri", "/errors/error"); }
From source file:de.hybris.platform.marketplaceintegrationbackoffice.utils.MarketplaceintegrationbackofficeHttpClientImpl.java
@Override public boolean redirectRequest(final String requestUrl) throws IOException { final boolean result = true; final RestTemplate restTemplate = new RestTemplate(); final java.net.URI uri = java.net.URI.create(requestUrl); final java.awt.Desktop dp = java.awt.Desktop.getDesktop(); if (dp.isSupported(java.awt.Desktop.Action.BROWSE)) { dp.browse(uri);/*from w w w . jav a 2s. co m*/ } restTemplate.execute(requestUrl, HttpMethod.GET, new RequestCallback() { @Override public void doWithRequest(final ClientHttpRequest request) throws IOException { // empty block should be documented } }, new ResponseExtractor<Object>() { @Override public Object extractData(final ClientHttpResponse response) throws IOException { final HttpStatus statusCode = response.getStatusCode(); LOG.debug("Response status: " + statusCode.toString()); return response.getStatusCode(); } }); return result; }
From source file:com.bcknds.demo.oauth2.security.ResourceServer.java
@Override public void configure(HttpSecurity http) throws Exception { // oauth/token enpoint should be insecure since it is the security entry point http.authorizeRequests().antMatchers("/oauth/token").anonymous(); // GET requests for secure need the read scope http.authorizeRequests().antMatchers(HttpMethod.GET, "/secure**").access("#oauth2.hasScope('read')"); // All requests except GET require the write scope. These are not specified since // the permissions fall down and GET is above this one. http.authorizeRequests().antMatchers("/secure**").access("#oauth2.hasScope('write')"); }
From source file:org.openwms.common.FetchLocationGroupByName.java
@Override public LocationGroupVO apply(String name) { Map<String, Object> maps = new HashMap<>(); maps.put("name", name); try {// ww w . j a va 2 s . c o m ResponseEntity<LocationGroupVO> exchange = restTemplate.exchange( "http://common-service" + CommonConstants.API_LOCATIONGROUPS + "?name=" + name, HttpMethod.GET, null, LocationGroupVO.class, maps); System.out.println(exchange); return exchange.getBody(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:com.revze.crudspring.config.SecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers(HttpMethod.GET, "/api/catatan/**").hasRole("CATATAN_VIEW") .antMatchers(HttpMethod.POST, "/api/catatan/**").hasRole("CATATAN_CREATE") .antMatchers(HttpMethod.DELETE, "/api/catatan/**").hasRole("CATATAN_DELETE") .antMatchers(HttpMethod.PUT, "/api/catatan/**").hasRole("CATATAN_UPDATE").antMatchers("/lib/**") .permitAll().antMatchers("/scripts/**").permitAll().anyRequest().authenticated().and().formLogin() .loginPage("/login.html").defaultSuccessUrl("/").loginProcessingUrl("/login").permitAll().and() .logout().permitAll().and().csrf().disable(); }
From source file:com.mc.printer.model.panel.client.paper.ReadSavedTask.java
public HashMap<String, List<SaveOject>> getRemoteServer() { HashMap<String, List<SaveOject>> map = new HashMap(); try {//from w w w . j a va2 s.c om String URI = ClientConstants.WS_HTTP; String urlParam = "key=" + formValueKey; logger.debug("URL parameter:" + urlParam); CommFindEntity<SavedDataEntity> response = restTemplate.exchange(URI + "/data/" + "?" + urlParam, HttpMethod.GET, null, new ParameterizedTypeReference<CommFindEntity<SavedDataEntity>>() { }).getBody(); logger.debug("return data from server." + response); if (response != null && response.getCount() > 0) { logger.info("return data total." + response.getCount()); List<SavedDataEntity> alldata = response.getResult(); for (SavedDataEntity d : alldata) { SaveOject obj = new SaveOject(); obj.setElementName(d.getElementname()); obj.setValue(d.getValue()); obj.setBranchName(d.getBranch() != null ? d.getBranch().getName() : ""); String dateStr = "key"; if (d.getSubmitdate() != null) { dateStr = DateHelper.format(d.getSubmitdate(), "yyyy/MM/dd HH:mm"); } if (!map.containsKey(dateStr)) { List<SaveOject> secitonLs = new ArrayList(); secitonLs.add(obj); map.put(dateStr, secitonLs); } else { map.get(dateStr).add(obj); } } } } catch (Exception e) { } return map; }
From source file:org.openwms.common.FetchLocationByCoord.java
@Override public LocationVO apply(String coordinate) { Map<String, Object> maps = new HashMap<>(); maps.put("locationPK", coordinate); try {/*www .j av a 2s. c om*/ ResponseEntity<LocationVO> exchange = restTemplate.exchange( "http://common-service" + CommonConstants.API_LOCATIONS + "?locationPK=" + coordinate, HttpMethod.GET, null, LocationVO.class, maps); System.out.println(exchange); return exchange.getBody(); } catch (Exception e) { e.printStackTrace(); throw e; } }
From source file:org.zalando.github.spring.IssuesTemplate.java
@Override public List<Issue> listAllIssues() { return getRestOperations().exchange(buildUri("/issues?per_page=25"), HttpMethod.GET, null, issueListTypeRef) .getBody();/*from w w w . ja va2 s.c om*/ }