wps保存回调
This commit is contained in:
@ -22,8 +22,8 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -39,6 +39,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static com.chinaunicom.mall.ebtp.cloud.security.starter.common.Constants.COOKIE_TOKEN_CODE;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@ -136,8 +139,7 @@ public class WpsController {
|
|||||||
public void getWpsUrlByGet(HttpServletRequest request, HttpServletResponse response,
|
public void getWpsUrlByGet(HttpServletRequest request, HttpServletResponse response,
|
||||||
@RequestParam("fileId") String fileId,
|
@RequestParam("fileId") String fileId,
|
||||||
@RequestParam("fileName") String fileName,
|
@RequestParam("fileName") String fileName,
|
||||||
@RequestParam("userToken") String userToken,
|
@RequestParam("userToken") String userToken
|
||||||
@RequestHeader(name = "Authorization") String token
|
|
||||||
) {
|
) {
|
||||||
WpsClientInVo in = new WpsClientInVo();
|
WpsClientInVo in = new WpsClientInVo();
|
||||||
in.setFileId(fileId);
|
in.setFileId(fileId);
|
||||||
@ -145,6 +147,20 @@ public class WpsController {
|
|||||||
in.setUserToken(userToken);
|
in.setUserToken(userToken);
|
||||||
String str = this.wpsService.getKSWpsUrl(in);
|
String str = this.wpsService.getKSWpsUrl(in);
|
||||||
try {
|
try {
|
||||||
|
String token = userToken;
|
||||||
|
Optional<Cookie> optionalCookie = Optional.ofNullable(request.getCookies())
|
||||||
|
.flatMap(cookies ->
|
||||||
|
Stream.of(cookies)
|
||||||
|
.filter(item -> StringUtils.equals(item.getName(), COOKIE_TOKEN_CODE))
|
||||||
|
.findFirst());
|
||||||
|
|
||||||
|
if (optionalCookie.isPresent()) {
|
||||||
|
token = optionalCookie.get().getValue();
|
||||||
|
log.info("cookie:",token);
|
||||||
|
}else{
|
||||||
|
log.error("未获取到cookie");
|
||||||
|
}
|
||||||
|
|
||||||
response.setContentType("text/html;charset=utf-8");
|
response.setContentType("text/html;charset=utf-8");
|
||||||
PrintWriter out = response.getWriter();
|
PrintWriter out = response.getWriter();
|
||||||
response.setHeader("Cookie","mall3_token="+token);
|
response.setHeader("Cookie","mall3_token="+token);
|
||||||
|
Reference in New Issue
Block a user