List of usage examples for org.springframework.http HttpStatus GONE
HttpStatus GONE
To view the source code for org.springframework.http HttpStatus GONE.
Click Source Link
From source file:org.trustedanalytics.servicebroker.h2oprovisioner.rest.RestErrorHandler.java
@ResponseBody @ResponseStatus(HttpStatus.GONE) @ExceptionHandler(JobNotFoundException.class) public String noApplicationsFound(JobNotFoundException e) { return e.getMessage(); }
From source file:net.gbmb.collector.FlowFilter.java
@Override public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { LOGGER.debug(" IN FILTER {} / {}", httpServletRequest.getMethod(), httpServletRequest.getRequestURI()); if (acceptRequest) { return true; } else {// w ww. j a v a2 s . co m // else return http status gone httpServletResponse.setStatus(HttpStatus.GONE.value()); return false; } }
From source file:org.osmtools.ra.context.RelationLoaderService.java
@Cacheable("relation") public Relation loadRelation(long relationId) { try {/* w w w . ja v a 2 s .c o m*/ Osm osmRoot = restOperations.getForObject(GET_RELATION_URL, Osm.class, String.valueOf(relationId)); List<Relation> list = converterService.convert(osmRoot); for (Relation relation : list) { if (relationId == relation.getRelationId()) return relation; } throw new RuntimeException("Relation ID " + relationId + " not found"); } catch (HttpClientErrorException e) { if (e.getStatusCode() == HttpStatus.GONE) { throw new RelationGoneException(); } else throw e; } }
From source file:org.smigo.config.WebConfiguration.java
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/garden-planner-comparison").setViewName("garden-planner-comparison.jsp"); registry.addViewController("/").setViewName("home.jsp"); registry.addViewController("/help").setViewName("help.jsp"); registry.addViewController("/robots.txt").setViewName("robots-txt.jsp"); registry.addViewController("/sitemap.xml").setViewName("sitemap-xml.jsp"); registry.addRedirectViewController("/garden-planner.html", "/views/garden-planner.html") .setStatusCode(HttpStatus.MOVED_PERMANENTLY); registry.addRedirectViewController("/garden/**", "/garden-planner") .setStatusCode(HttpStatus.MOVED_PERMANENTLY); registry.addRedirectViewController("/hasta-luego/**", "/welcome-back") .setStatusCode(HttpStatus.MOVED_PERMANENTLY); registry.addRedirectViewController("/beta/**", "/").setStatusCode(HttpStatus.MOVED_PERMANENTLY); registry.addRedirectViewController("/accept-termsofservice/**", "/accept-terms-of-service") .setStatusCode(HttpStatus.MOVED_PERMANENTLY); registry.addRedirectViewController("/signup/**", "/register").setStatusCode(HttpStatus.MOVED_PERMANENTLY); registry.addRedirectViewController("/_=_", "/garden-planner").setStatusCode(HttpStatus.MOVED_PERMANENTLY); registry.addRedirectViewController("/wall/{username}/**", "/gardener/{username}") .setStatusCode(HttpStatus.MOVED_PERMANENTLY); registry.addRedirectViewController("/tos.html", "/static/terms-of-service.html") .setStatusCode(HttpStatus.MOVED_PERMANENTLY); registry.addStatusController("/static/terms-of-service.html", HttpStatus.GONE); registry.addStatusController("/listspecies", HttpStatus.GONE); registry.addStatusController("/update-species", HttpStatus.GONE); registry.addStatusController("/rest/species/search", HttpStatus.GONE); registry.addStatusController("/addyear/**", HttpStatus.GONE); registry.addStatusController("/deletespecies/**", HttpStatus.GONE); registry.addStatusController("/species/**", HttpStatus.GONE); registry.addStatusController("/rule/**", HttpStatus.GONE); registry.addStatusController("**/*.php", HttpStatus.NOT_FOUND); registry.addStatusController("cgi-bin/**", HttpStatus.NOT_FOUND); registry.addStatusController("**/*.cgi", HttpStatus.NOT_FOUND); registry.addStatusController("/wp/", HttpStatus.NOT_FOUND); registry.addStatusController("/wordpress/", HttpStatus.NOT_FOUND); registry.addStatusController("/HNAP1/", HttpStatus.NOT_FOUND); registry.addStatusController("/blog/robots.txt", HttpStatus.NOT_FOUND); registry.addStatusController("/apple-touch-icon-precomposed.png", HttpStatus.NOT_FOUND); registry.addStatusController("/apple-touch-icon.png", HttpStatus.NOT_FOUND); }
From source file:com.haulmont.restapi.idp.IdpAuthLifecycleManager.java
protected IdpSessionStatus pingIdpSessionServer(String idpSessionId) { log.debug("Ping IDP session {}", idpSessionId); String idpBaseURL = idpConfig.getIdpBaseURL(); if (!idpBaseURL.endsWith("/")) { idpBaseURL += "/"; }//from ww w. ja v a 2 s . c o m String idpSessionPingUrl = idpBaseURL + "service/ping"; HttpPost httpPost = new HttpPost(idpSessionPingUrl); httpPost.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.getMimeType()); UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity( Arrays.asList(new BasicNameValuePair("idpSessionId", idpSessionId), new BasicNameValuePair("trustedServicePassword", idpConfig.getIdpTrustedServicePassword())), StandardCharsets.UTF_8); httpPost.setEntity(formEntity); HttpClientConnectionManager connectionManager = new BasicHttpClientConnectionManager(); HttpClient client = HttpClientBuilder.create().setConnectionManager(connectionManager).build(); try { HttpResponse httpResponse = client.execute(httpPost); int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode == HttpStatus.GONE.value()) { log.debug("IDP session expired {}", idpSessionId); return IdpSessionStatus.EXPIRED; } if (statusCode != HttpStatus.OK.value()) { log.warn("IDP respond status {} on session ping", statusCode); } } catch (IOException e) { log.warn("Unable to ping IDP {} session {}", idpSessionPingUrl, idpSessionId, e); } finally { connectionManager.shutdown(); } return IdpSessionStatus.ALIVE; }
From source file:ch.wisv.areafiftylan.products.controller.OrderRestController.java
@ExceptionHandler(TicketUnavailableException.class) public ResponseEntity<?> handleTicketUnavailableException(TicketUnavailableException e) { return createResponseEntity(HttpStatus.GONE, e.getMessage()); }
From source file:org.springframework.boot.devtools.tunnel.server.HttpTunnelServer.java
/** * Handle an incoming HTTP connection./*from w ww . j a v a2 s. c o m*/ * @param httpConnection the HTTP connection * @throws IOException in case of I/O errors */ protected void handle(HttpConnection httpConnection) throws IOException { try { getServerThread().handleIncomingHttp(httpConnection); httpConnection.waitForResponse(); } catch (ConnectException ex) { httpConnection.respond(HttpStatus.GONE); } }