ソースを参照

修改

Signed-off-by: anderx <312518615@qq.com>
anderx 5 年 前
コミット
e529314dfd
共有2 個のファイルを変更した47 個の追加43 個の削除を含む
  1. 4 0
      src/main/java/com/kede/common/controller/WebpageController.java
  2. 43 43
      src/main/java/com/kede/core/auth/RestClient.java

+ 4 - 0
src/main/java/com/kede/common/controller/WebpageController.java

@@ -334,7 +334,11 @@ public class WebpageController extends BaseController {
 	
 	@RequestMapping(value = "/null", method = RequestMethod.GET)
 	public ModelAndView isnull(HttpServletRequest request, ModelAndView modelview) {
+		RedirectView rv = new RedirectView();
 		modelview.setViewName("/null");
+		modelview.setViewName("/portal/index");
+		rv.setExposeModelAttributes(false);
+		modelview.setView(rv);
 		return modelview;
 	}
 	

+ 43 - 43
src/main/java/com/kede/core/auth/RestClient.java

@@ -1,43 +1,43 @@
-package com.kede.core.auth;
-
-import java.util.Base64;
-
-
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.client.RestTemplate;
-
-public class RestClient {
-	private final String BS_HOST= "http://localhost:8090/";
-	//@Test
-	public void whenSecuredRestApiIsConsumed_then200OK() {
-	    RestTemplate restTemplate = new RestTempleteConfig().getRestTemplate();
-	    ResponseEntity<String> entity = restTemplate.exchange(BS_HOST, HttpMethod.GET, null, String.class);
-	    System.out.println(entity.getStatusCode());
-	    System.out.println(entity.getBody());
-	}
-	private HttpHeaders getHeaders(){
-		String plainCredentials="dev:123456";
-		String base64Credentials = Base64.getEncoder().encodeToString(plainCredentials.getBytes());
-		HttpHeaders headers = new HttpHeaders();
-		headers.add("Authorization", "Basic " + base64Credentials);
-		return headers;
-	}
- 
-	public String sendToBs(String apiUrl,HttpMethod method,LinkedMultiValueMap<String, String> params) {
-		RestTemplate restTemplate = new RestTemplate();
-		HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(params,getHeaders());
-		ResponseEntity<String> response = restTemplate.exchange(BS_HOST + "/" + apiUrl, method,request, String.class);
-		
-		return response.getBody();
-	}
-	
-//	@Test
-	public void testLogin() {
-		System.out.println(sendToBs("login", HttpMethod.GET, null));
-	}
-}
+package com.kede.core.auth;
+
+import java.util.Base64;
+
+
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+public class RestClient {
+	private final String BS_HOST= "http://localhost:8090/";
+	//@Test
+	public void whenSecuredRestApiIsConsumed_then200OK() {
+	    RestTemplate restTemplate = new RestTempleteConfig().getRestTemplate();
+	    ResponseEntity<String> entity = restTemplate.exchange(BS_HOST, HttpMethod.GET, null, String.class);
+	    System.out.println(entity.getStatusCode());
+	    System.out.println(entity.getBody());
+	}
+	private HttpHeaders getHeaders(){
+		String plainCredentials="dev:123456";
+		String base64Credentials = Base64.getEncoder().encodeToString(plainCredentials.getBytes());
+		HttpHeaders headers = new HttpHeaders();
+		headers.add("Authorization", "Basic " + base64Credentials);
+		return headers;
+	}
+ 
+	public String sendToBs(String apiUrl,HttpMethod method,LinkedMultiValueMap<String, String> params) {
+		RestTemplate restTemplate = new RestTemplate();
+		HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(params,getHeaders());
+		ResponseEntity<String> response = restTemplate.exchange(BS_HOST + "/" + apiUrl, method,request, String.class);
+		
+		return response.getBody();
+	}
+	
+//	@Test
+	public void testLogin() {
+		System.out.println(sendToBs("login", HttpMethod.GET, null));
+	}
+}