This commit is contained in:
wangliwen 2022-06-01 18:26:21 +08:00
parent 7f8a4f9d43
commit 7d69521fa4
2 changed files with 19 additions and 24 deletions

View File

@ -172,7 +172,7 @@ public class ActModelService {
BufferedImage bufferedImage = ImageIO.read(in); BufferedImage bufferedImage = ImageIO.read(in);
ImageIO.write(bufferedImage, "png", response.getOutputStream()); ImageIO.write(bufferedImage, "png", response.getOutputStream());
} else { } else {
response.getWriter().println("No image Info!"); response.getOutputStream().println("No image Info!");
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -22,7 +22,6 @@ import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
@ -30,16 +29,12 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
/** /**
* oauth2过滤器 * oauth2过滤器
*
*/ */
@Component() @Component()
@Scope("prototype") @Scope("prototype")
@ -161,7 +156,7 @@ public class Oauth2Filter extends AuthenticatingFilter {
Result r = new Result().error(HttpStatus.SC_UNAUTHORIZED, msg); Result r = new Result().error(HttpStatus.SC_UNAUTHORIZED, msg);
String json = new Gson().toJson(r); String json = new Gson().toJson(r);
response.getWriter().print(json); response.getOutputStream().print(json);
} }
public boolean login(HttpServletRequest request, HttpServletResponse response) throws Exception { public boolean login(HttpServletRequest request, HttpServletResponse response) throws Exception {
@ -257,7 +252,7 @@ public class Oauth2Filter extends AuthenticatingFilter {
+ URLEncoder.encode(requeststr, "UTF-8"); + URLEncoder.encode(requeststr, "UTF-8");
response.addHeader("REDIRECT", keeperUrl); response.addHeader("REDIRECT", keeperUrl);
response.setStatus(HttpStatus.SC_UNAUTHORIZED); response.setStatus(HttpStatus.SC_UNAUTHORIZED);
response.getWriter().write(HttpStatus.SC_UNAUTHORIZED); response.getOutputStream().write(HttpStatus.SC_UNAUTHORIZED);
} }