List of usage examples for org.springframework.http HttpMethod POST
HttpMethod POST
To view the source code for org.springframework.http HttpMethod POST.
Click Source Link
From source file:com.pw.ism.WebSecurityConfig.java
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers(HttpMethod.POST, "/newmessage", "/addheartbeat", "/create/*") .permitAll().antMatchers("/", "/create", "/css/**", "/js/**", "/images/**").permitAll().anyRequest() .authenticated().and().csrf().ignoringAntMatchers("/newmessage", "/addheartbeat").and().formLogin() .loginPage("/login").permitAll().and().logout().permitAll(); }
From source file:org.apache.http.hacked.PostUriRegexMatcher.java
public PostUriRegexMatcher(String uriRegex) { super(HttpMethod.POST.toString(), uriRegex); }
From source file:com.nobu.dvdrentalweb.test.restapi.PersonRestControllerTest.java
@Test public void tesCreate() { Person p = new Person.Builder().firstname("nobu").age(5).build(); HttpEntity<Person> requestEntity = new HttpEntity<>(p, getContentType()); // Make the HTTP POST request, marshaling the request to JSON, and the response to a String ResponseEntity<String> responseEntity = restTemplate.exchange(URL + "api/person/create", HttpMethod.POST, requestEntity, String.class); }
From source file:com.peertopark.spring.commons.CsrfRequestMatcher.java
public CsrfRequestMatcher(String pattern) { this(pattern, HttpMethod.POST); }
From source file:com.joseph.california.test.restapi.ClubRestControllerTest.java
public void tesCreate() { Club club = new Club.Builder("Hackers").build(); HttpEntity<Club> requestEntity = new HttpEntity<>(club, getContentType()); // Make the HTTP POST request, marshaling the request to JSON, and the response to a String ResponseEntity<String> responseEntity = restTemplate.exchange(URL + "api/club/create", HttpMethod.POST, requestEntity, String.class); System.out.println(" THE RESPONSE BODY " + responseEntity.getBody()); System.out.println(" THE RESPONSE STATUS CODE " + responseEntity.getStatusCode()); System.out.println(" THE RESPONSE IS HEADERS " + responseEntity.getHeaders()); Assert.assertEquals(responseEntity.getStatusCode(), HttpStatus.OK); }
From source file:learning.candystore.controller.CandyActionServerSideTest.java
@Test @Ignore//from ww w .j av a2s. c o m public void registerStudent() { request.setRequestURI("/student"); request.setMethod(HttpMethod.POST.name()); request.setContentType("application/json"); String json = "{\"id\":\"2\",\"name\":\"tenjin\",\"age\":\"23\"}"; request.setContent(json.getBytes()); Class<?>[] parameterTypes = new Class<?>[] { Candy.class }; ModelAndView mv = null; try { mv = handlerAdapter.handle(request, response, new HandlerMethod(candyAction, "registerStudent", parameterTypes)); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.hatta.consumer.App.java
@SuppressWarnings({ "unchecked" }) private static AuthTokenInfo sendTokenRequest() { RestTemplate restTemplate = new RestTemplate(); HttpEntity<String> request = new HttpEntity<String>(getHeadersWithClientCredentials()); ResponseEntity<Object> response = restTemplate.exchange(AUTH_SERVER_URI + QPM_PASSWORD_GRANT, HttpMethod.POST, request, Object.class); LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) response.getBody(); AuthTokenInfo tokenInfo = null;//from ww w . j a v a2 s .co m if (map != null) { tokenInfo = new AuthTokenInfo(); tokenInfo.setAccess_token((String) map.get("access_token")); tokenInfo.setToken_type((String) map.get("token_type")); tokenInfo.setRefresh_token((String) map.get("refresh_token")); tokenInfo.setExpires_in((int) map.get("expires_in")); tokenInfo.setScope((String) map.get("scope")); System.out.println(tokenInfo); System.out.println("access_token =" + map.get("access_token") + ", token_type=" + map.get("token_type") + ", refresh_token=" + map.get("refresh_token") + ", expires_in=" + map.get("expires_in") + ", scope=" + map.get("scope")); ; } else { System.out.println("No user exist----------"); } return tokenInfo; }
From source file:nd.dev.framework.basedemo.controllers.StudentActionServerSideTest.java
@Test @Ignore/*from w ww .ja va 2 s . c o m*/ public void registerStudent() { request.setRequestURI("/student"); request.setMethod(HttpMethod.POST.name()); request.setContentType("application/json"); String json = "{\"id\":\"2\",\"name\":\"tenjin\",\"age\":\"23\"}"; request.setContent(json.getBytes()); Class<?>[] parameterTypes = new Class<?>[] { Student.class }; ModelAndView mv = null; try { mv = handlerAdapter.handle(request, response, new HandlerMethod(studentAction, "registerStudent", parameterTypes)); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.nobu.dvdrentalweb.test.restapi.MovieRestControllerTest.java
@Test public void createTest() { Movie movie = new Movie.Builder().moviename("Set it off").build(); HttpEntity<Movie> requestEntity = new HttpEntity<>(movie, getContentType()); ResponseEntity<String> responseEntity = restTemplate.exchange(URL + "api/movie/create", HttpMethod.POST, requestEntity, String.class); }
From source file:com.consol.citrus.admin.converter.endpoint.HttpClientConverter.java
@Override public EndpointModel convert(HttpClientModel model) { EndpointModel endpointModel = new EndpointModel(getEndpointType(), model.getId(), getSourceModelClass().getName()); endpointModel.add(property("requestUrl", model, true)); endpointModel.add(property("requestMethod", model, HttpMethod.POST.name()).options(getHttpMethodOptions())); endpointModel.add(property("errorStrategy", model, ErrorHandlingStrategy.PROPAGATE.getName()) .options(getErrorHandlingStrategyOptions())); endpointModel.add(property("pollingInterval", model, "500")); endpointModel.add(property("messageCorrelator", model).optionKey(MessageCorrelator.class.getName())); endpointModel.add(property("messageConverter", model).optionKey(MessageConverter.class.getName())); endpointModel.add(property("requestFactory", model).optionKey(ClientHttpRequestFactory.class.getName())); endpointModel.add(property("restTemplate", model).optionKey(RestTemplate.class.getName())); endpointModel.add(property("charset", model)); endpointModel.add(property("contentType", model)); endpointModel.add(property("interceptors", model)); addEndpointProperties(endpointModel, model); return endpointModel; }