小编Tan*_*arg的帖子

下载图像时出现CORS问题

我有一个API,它将base64字符串转换为图像并在Tomcat Server中写入图像.图像在调用API后成功写入,但在检索相同图像时出现错误:

"请求资源上没有'Access-Control-Allow-Origin'标头.因此不允许访问Origin.XMLHttpRequest无法加载http:// hostname:4444 // tmpFiles/31487660124865.jpg.没有'访问控制 - Allow-Origin'标头出现在请求的资源上.

我的代码如下:

public Message uploadImage(Map<String, String> map) {

    // Initializing the message
    Message message = new Message();

    try {

        // Get the file data
        String fileData = map.get("file_data");

        // Split the data with the comma
        String base64Image = fileData.split(",")[1];

        // Convert the base64 input to binary
        byte[] imageBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary(base64Image);

        BufferedImage image = ImageIO.read(new ByteArrayInputStream(imageBytes));

        // Manipulations in File Name
        String fileName = map.get("file_name");
        String file = fileName.substring(0, fileName.indexOf(".")); …
Run Code Online (Sandbox Code Playgroud)

java cors tomcat7

9
推荐指数
1
解决办法
1394
查看次数

wso2 api manger carbon page给403禁止

我已经下载了一个新的wso2 api管理器并尝试打开链接http:// host_name:9443/carbon.它给出了403禁止的错误,堆栈跟踪是:

- JavaLogger potential cross-site request forgery (CSRF) attack thwarted (user:<anonymous>, ip:127.0.0.1, method:POST, uri:/carbon/admin/login_action.jsp, error:required token is missing from the request)
Run Code Online (Sandbox Code Playgroud)

有没有人知道什么是错的或者我错过了什么?

api wso2

6
推荐指数
2
解决办法
5564
查看次数

标签 统计

api ×1

cors ×1

java ×1

tomcat7 ×1

wso2 ×1