java.io.FileNotFoundException: http://www.xxxxx.net:8080/test/test/ 403错误

2023-11-04

POST请求错误内容

java.io.FileNotFoundException: http://www.xxxxx.net:8080/test/test/
	at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186)
	at org.cocos2dx.lib.QuickHTTPInterface.close(QuickHTTPInterface.java:489)
	at org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native Method)
	at org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame(Cocos2dxRenderer.java:104)
	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
并且在http.getResponseCode()错误码为403,很奇怪为什么会这样。因为用curl是正常的。

问题点:

HttpURLConnection重定向问题,在curl因为用的自动处理没太在意,然而HttpURLConnection好像自动处理不正常。没办法只能手动处理了。

http.setInstanceFollowRedirects(false); //不自动处理重定向
设置当前对象手动处理重定向。这样 http.getResponseCode()可能出现 301 和 302然后手动处理重定向问题

	static HttpURLConnection reloadRedirectHttpURLConnection(HttpURLConnection http) {
		HttpURLConnection redirectHttp = http;
		try {
			int statusCode = http.getResponseCode();
			// https redirect
			if (statusCode == HttpURLConnection.HTTP_MOVED_TEMP || statusCode == HttpURLConnection.HTTP_MOVED_PERM || statusCode == HttpURLConnection.HTTP_SEE_OTHER) {
				String newUrl = http.getHeaderField("Location");
				String cookies = http.getHeaderField("Set-Cookie");
				redirectHttp = (HttpURLConnection) new URL(newUrl).openConnection();
				redirectHttp.setRequestProperty("Cookie", cookies);
				Log.i("QuickHTTPInterface", "Redirect to URL : " + newUrl);
				redirectHttp = reloadRedirectHttpURLConnection(redirectHttp);
			}
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}
		return redirectHttp;
	}

写的一个递归先暂时这样解决一下问题。




贴上修改好的 QuickHTTPInterface 代码 目前处理得不是很好。不改 C++代码

package org.cocos2dx.lib;

import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.ProtocolException;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.zip.GZIPInputStream;
import java.util.zip.InflaterInputStream;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

public class QuickHTTPInterface {
	static String BOUNDARY = "----------------------------78631b43218d";
	static String NEWLINE = "\r\n";

	static HashMap<HttpURLConnection, HttpURLConnection> redirects = new HashMap<HttpURLConnection, HttpURLConnection>();

	static HttpURLConnection createURLConnect(String strURL) {
		URL url;
		HttpURLConnection urlConnection;
		try {
			url = new URL(strURL);
			urlConnection = (HttpURLConnection) url.openConnection();
			urlConnection.setRequestProperty("Accept-Encoding", "identity");
			urlConnection.setDoInput(true);
		} catch (Exception e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
			return null;
		}

		return urlConnection;
	}

	static void setRequestMethod(HttpURLConnection http, String strMedthod) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		try {
			if ("POST".equalsIgnoreCase(strMedthod)) {
				http.setDoOutput(true);
				http.setUseCaches(false);
				http.setInstanceFollowRedirects(false); //不自动处理重定向
				http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
			}
			http.setRequestMethod(strMedthod);
		} catch (ProtocolException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}
	}

	static void addRequestHeader(HttpURLConnection http, String strkey, String strValue, boolean bNeedBoundary) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		if ("Content-Type".equalsIgnoreCase(strkey.trim()) && bNeedBoundary) {
			strValue += ("; boundary=" + BOUNDARY);
		}
		http.setRequestProperty(strkey, strValue);
	}

	static void setTimeout(HttpURLConnection http, int msTime) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		http.setConnectTimeout(msTime);
		http.setReadTimeout(msTime);
	}

	static int connect(HttpURLConnection http) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		int nSuc = 0;

		try {
			http.connect();
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
			nSuc = 1;
		}

		return nSuc;
	}

	static void postContent(HttpURLConnection http, String name, String value, boolean bNeedConnectSym) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		try {
			DataOutputStream out = new DataOutputStream(http.getOutputStream());
			String content = null;
			if (null == name || 0 == name.length()) {
				content = java.net.URLEncoder.encode(value, "utf-8");
			} else {
				content = java.net.URLEncoder.encode(name, "utf-8") + "=" + java.net.URLEncoder.encode(value, "utf-8");
			}
			if (bNeedConnectSym) {
				content = "&" + content;
			}
			out.write(content.getBytes());
			out.flush();
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}
	}

	static void postContentByteArray(HttpURLConnection http, byte[] byteArray) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		try {
			OutputStream out = http.getOutputStream();

			out.write(byteArray);

			out.flush();
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}
	}

	static void postFormContent(HttpURLConnection http, String key, String val) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		try {
			OutputStream out = http.getOutputStream();

			out.write(getBoundaryContentHeader(key, val).getBytes());

			out.flush();
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}
	}

	static void postFormFile(HttpURLConnection http, String name, String filePath) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		try {
			FileInputStream fin = new FileInputStream(filePath);
			OutputStream out = http.getOutputStream();

			out.write(getBoundaryFileHeader(name, filePath).getBytes());
			byte[] buffer = new byte[1024];
			int len = 0;
			while ((len = fin.read(buffer)) != -1) {
				out.write(buffer, 0, len);
			}
			out.write(NEWLINE.getBytes());

			out.flush();
			fin.close();
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}
	}

	static void postFormEnd(HttpURLConnection http, boolean bBoundary) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		if ("GET".equalsIgnoreCase(http.getRequestMethod())) {
			return;
		}

		try {
			OutputStream out = http.getOutputStream();

			if (bBoundary) {
				out.write(getBoundaryEnd().getBytes());
				out.flush();
			}
			out.flush();
			out.close();
		
			// https redirect
			HttpURLConnection reloadHttp = reloadRedirectHttpURLConnection(http);
			if (reloadHttp != null && reloadHttp != http) {
				redirects.put(http, reloadHttp);
			}
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}
	}

	private static HttpURLConnection reloadRedirectHttpURLConnection(HttpURLConnection http) {
		HttpURLConnection redirectHttp = http;
		try {
			int statusCode = http.getResponseCode();
			// https redirect
			if (statusCode == HttpURLConnection.HTTP_MOVED_TEMP || statusCode == HttpURLConnection.HTTP_MOVED_PERM || statusCode == HttpURLConnection.HTTP_SEE_OTHER) {
				String newUrl = http.getHeaderField("Location");
				String cookies = http.getHeaderField("Set-Cookie");
				redirectHttp = (HttpURLConnection) new URL(newUrl).openConnection();
				redirectHttp.setRequestProperty("Cookie", cookies);
				Log.i("QuickHTTPInterface", "Redirect to URL : " + newUrl);
				redirectHttp = reloadRedirectHttpURLConnection(redirectHttp);
			}
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}
		return redirectHttp;
	}

	static String getBoundaryFileHeader(String key, String filePath) {
		File file = new File(filePath);
		StringBuilder sb = new StringBuilder();
		sb.append("--");
		sb.append(BOUNDARY);
		sb.append(NEWLINE);
		sb.append("Content-Disposition: form-data; ");
		sb.append("name=\"");
		sb.append(key);
		sb.append("\"; ");
		sb.append("filename=\"");
		sb.append(file.getName());
		sb.append("\"");
		sb.append(NEWLINE);
		sb.append("Content-Type: application/octet-stream");
		sb.append(NEWLINE);
		sb.append(NEWLINE);

		return sb.toString();
	}

	static String getBoundaryContentHeader(String key, String val) {
		StringBuilder sb = new StringBuilder();
		sb.append("--");
		sb.append(BOUNDARY);
		sb.append(NEWLINE);
		sb.append("Content-Disposition: form-data; name=\"");
		sb.append(key);
		sb.append("\"");
		sb.append(NEWLINE);
		sb.append(NEWLINE);
		sb.append(val);
		sb.append(NEWLINE);

		return sb.toString();
	}

	static String getBoundaryEnd() {
		StringBuilder sb = new StringBuilder();
		sb.append("--");
		sb.append(BOUNDARY);
		sb.append("--");
		sb.append(NEWLINE);

		return sb.toString();
	}

	static int getResponedCode(HttpURLConnection http) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		int code = 0;
		try {
			code = http.getResponseCode();
			// Log.i("QuickHTTPInterface", "reponed code:" + code);
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}
		return code;
	}

	static String getResponedErr(HttpURLConnection http) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		String msg;
		try {
			msg = http.getResponseMessage();
		} catch (IOException e) {
			msg = e.toString();
			Log.e("QuickHTTPInterface", msg);
		}

		return msg;
	}

	static String getResponedHeader(HttpURLConnection http) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		Map<String, List<String>> headers = http.getHeaderFields();

		JSONObject json = new JSONObject();
		try {
			for (Entry<String, List<String>> entry : headers.entrySet()) {
				String key = entry.getKey();
				if (null == key) {
					key = "";
				}
				List<String> value = entry.getValue();
				JSONArray jsonArray = new JSONArray();
				for (String strVal : value) {
					jsonArray.put(strVal);
				}
				json.put(key, jsonArray);
			}
		} catch (JSONException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}

		return json.toString();
	}

	static String getResponedHeaderByIdx(HttpURLConnection http, int idx) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		Map<String, List<String>> headers = http.getHeaderFields();
		if (null == headers) {
			return null;
		}

		String header = null;

		int counter = 0;
		for (Entry<String, List<String>> entry : headers.entrySet()) {
			if (counter == idx) {
				String key = entry.getKey();
				if (null == key) {
					header = listToString(entry.getValue(), ",") + "\n";
				} else {
					header = key + ":" + listToString(entry.getValue(), ",") + "\n";
				}
				break;
			}
			counter++;
		}

		return header;
	}

	private static String parseResponedHeaderByKey(HttpURLConnection http, String key){
		Map<String, List<String>> headers = http.getHeaderFields();
		if (null == headers) {
			return null;
		}

		String header = null;

		for (Entry<String, List<String>> entry : headers.entrySet()) {
			if (key.equalsIgnoreCase(entry.getKey())) {

				if ("set-cookie".equalsIgnoreCase(key)) {
					header = combinCookies(entry.getValue(), http.getURL().getHost());
				} else {
					header = listToString(entry.getValue(), ",");
				}
				break;
			}
		}
		return header;
	}
	
	static String getResponedHeaderByKey(HttpURLConnection http, String key) {
		if (null == key) {
			return null;
		}

		String header = parseResponedHeaderByKey(http, key);
		
		if (header == null || header.isEmpty()) {
			HttpURLConnection redirectHttp = redirects.get(http);
			if (redirectHttp != null) {
				header = parseResponedHeaderByKey(redirectHttp, key);
			}
		}

		return header;
	}
	
	private static int parseResponedHeaderByKeyInt(HttpURLConnection http, String key){
		String value = http.getHeaderField(key);

		if (null == value) {
			return 0;
		} else {
			return Integer.parseInt(value);
		}
	}

	static int getResponedHeaderByKeyInt(HttpURLConnection http, String key) {
		int value = parseResponedHeaderByKeyInt(http, key);
		if (0 == value) {
			HttpURLConnection redirectHttp = redirects.get(http);
			if (redirectHttp != null) {
				return parseResponedHeaderByKeyInt(redirectHttp, key);
			}
		} 
		return value;
	}

	static int getContentLeng(HttpURLConnection http) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		return http.getContentLength();
	}

	static byte[] getResponedString(HttpURLConnection http) {
		HttpURLConnection redirectHttp = redirects.get(http);
		if (redirectHttp != null) {
			http = redirectHttp;
		}
		InputStream in;
		try {
			in = http.getInputStream();
			String contentEncoding = http.getContentEncoding();
			if (contentEncoding != null) {
				if (contentEncoding.equalsIgnoreCase("gzip")) {
					in = new GZIPInputStream(http.getInputStream()); // reads 2 bytes to determine GZIP stream!
				} else if (contentEncoding.equalsIgnoreCase("deflate")) {
					in = new InflaterInputStream(http.getInputStream());
				}
			}
		} catch (IOException e) {
			in = http.getErrorStream();
		} catch (Exception e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
			return null;
		}

		try {
			byte[] buffer = new byte[1024];
			byte[] retBuf = null;
			int len = in.read(buffer);
			// Log.i("QuickHTTPInterface", "have recv data:" + len);

			if (-1 == len) {
				retBuf = new byte[1];
				retBuf[0] = 0;
			} else {
				retBuf = new byte[len + 1];
				retBuf[0] = 1;
				System.arraycopy(buffer, 0, retBuf, 1, len);
			}
			return retBuf;
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}

		return null;
	}

	static void close(HttpURLConnection http) {
		try {
			HttpURLConnection redirectHttp = redirects.get(http);
			if (redirectHttp != null) {
				redirects.remove(http);
				redirectHttp.getInputStream().close();
				redirectHttp.disconnect();
			}
			http.getInputStream().close();
		} catch (IOException e) {
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		} finally {
			if (http != null) {
				http.disconnect();
			}
		}
	}

	public static String listToString(List<String> list, String strInterVal) {
		if (list == null) {
			return null;
		}
		StringBuilder result = new StringBuilder();
		boolean flag = false;
		for (String str : list) {
			if (flag) {
				result.append(strInterVal);
			}
			if (null == str) {
				str = "";
			}
			result.append(str);
			flag = true;
		}
		return result.toString();
	}
	private static void parseSession(String cookie_value) {
		String gSession;
		if (cookie_value == null)
			return;
		String[] cookies = cookie_value.split(";");
		String cookie = null;
		for (int i = 0; i < cookies.length; i++) {
			cookie = cookies[i];
			if (cookie.toLowerCase().startsWith("sessionid")) {
				gSession = cookie;
				Log.d("QuickHTTPInterface", "gSession:" + gSession);
				break;
			}
		}
	}
	public static String combinCookies(List<String> list, String strDomain) {
		StringBuilder sbCookies = new StringBuilder();

		String strKey = null;
		String strValue = null;
		String strExpire = null;
		boolean bSecure = false;
		boolean bFirst = false;

		for (String str : list) {
			bSecure = false;
			bFirst = true;
			String[] parts = str.split(";");
			for (String part : parts) {
				String[] item = part.split("=");
				if (bFirst) {
					if (2 == item.length) {
						strKey = item[0];
						strValue = item[1];
					} else {
						strKey = "";
						strValue = "";
					}
					bFirst = false;
				}
				if ("expires".equalsIgnoreCase(item[0].trim())) {
					strExpire = str2Seconds(item[1].trim());
				} else if ("secure".equalsIgnoreCase(item[0].trim())) {
					bSecure = true;
				} else if ("domain".equalsIgnoreCase(item[0].trim())) {
					strDomain = item[1];
				}
			}

			if (null == strDomain) {
				strDomain = "none";
			}

			sbCookies.append(strDomain);
			sbCookies.append('\t');
			sbCookies.append("FALSE\t"); // access
			sbCookies.append("/\t"); // path
			if (bSecure) {
				sbCookies.append("TRUE\t"); // secure
			} else {
				sbCookies.append("FALSE\t"); // secure
			}
			sbCookies.append(strExpire); // expire tag
			sbCookies.append("\t");
			sbCookies.append(strKey); // key
			sbCookies.append("\t");
			sbCookies.append(strValue); // value
			sbCookies.append('\n');
		}

		return sbCookies.toString();
	}

	private static String str2Seconds(String strTime) {
		Calendar c = Calendar.getInstance();
		long millisSecond = 0;

		try {
			if(strTime.contains("-0000"))
				c.setTime(new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss zzzzz", Locale.US).parse(strTime));
			else
				c.setTime(new SimpleDateFormat("EEE, dd-MMM-yyyy hh:mm:ss zzz", Locale.US).parse(strTime));
			millisSecond = c.getTimeInMillis() / 1000;
		} catch (ParseException e) {
			millisSecond = -1;
			Log.e("QuickHTTPInterface", e.toString());
			e.printStackTrace();
		}

		if (-1 == millisSecond) {
			return strTime;
		}

		return Long.toString(millisSecond);
	}

}



本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

java.io.FileNotFoundException: http://www.xxxxx.net:8080/test/test/ 403错误 的相关文章

  • 如何使用javac编译java包结构

    我正在尝试编译 从命令行 一个 java 包 该包导入我自己的另一个包 我正在关注一个在线教程 http www roseindia net java master java createsubpackage shtml但当我尝试编译最终的
  • Java 中类似 HashMap 的可排序数据结构?

    Java 中是否有某种类似于 HashMap 的数据结构 可以按键或值排序 在 PHP 中 您可以拥有可排序的关联数组 Java中有这样的东西吗 HashMaps 几乎按照定义是未排序的 一个好的哈希函数会产生看似随机的密钥分布 如果你想使
  • 如何在 Java 中验证从 Azure AD B2C 生成的 JWT 令牌?

    我正在寻找 Java 代码示例来验证 Azure AD B2C 令牌 我们可以使用哪些依赖项 所有 JWT 令牌的 JWT 令牌验证步骤或代码是否相同还是会有所不同 我们的项目中没有使用 Spring Security 有大量的图书馆her
  • 方法重载。你能过度使用它吗?

    当定义多个使用不同过滤器返回相同形状的数据的方法时 什么是更好的做法 显式方法名称或重载方法 例如 如果我有一些产品并且我正在从数据库中提取 显式方式 public List
  • Guice:当 FactoryBuilder 中提供合适的构造函数时,“找不到合适的构造函数”

    我使用 Guice 进行依赖注入 但收到此错误 1 Could not find a suitable constructor in java lang Void Classes must have either one and only
  • 如何通过两跳 SSH 隧道使用 JProfiler

    我正在尝试将 JProfiler 连接到在我将调用的服务器上运行的 JVMremote 该服务器只能从我的工作站访问 local 通过我将调用的另一台服务器middle 我的计划是将 JProfiler 连接到remote是这样的 安装 J
  • 打印数组时出错

    我得到这个代码 import java util import java io public class Oblig3A public static void main String args OrdAnalyse O new OrdAna
  • LibGDX 闪烁

    我已经使用 LibGDX UI 设置来启动一个项目 我在实现 ApplicationListener 中唯一拥有的是 public void create setScreen new LoadingScreen this 这应该会触发 Lo
  • [TYPE] 类型的 Bean 'x' 不符合所有 BeanPostProcessors 的处理条件

    我有一个ResourceAspect class Component Aspect public class ResourceAspect Before execution public public void resourceAccess
  • docker 中带有参数的 jar 文件

    Helo 我有一个 java jar 文件 当我从终端运行它时 它会接受一堆参数作为输入 我想制作一个 docker 映像并运行它 其中包含 jar 文件 我仍然可以在其中传递 jar 文件的参数 将 jar 文件设置为您的入口点 http
  • 声纳要求将这一领域定为最终目标

    我的程序中有以下代码 在与 Maven 集成后 我正在运行 SonarQube 5 对其进行代码质量检查 我面临这个错误 将此 public static processStatus 字段设为最终字段 将此 public static pr
  • MongoDb Spring 在嵌套对象中查找

    我正在使用 Spring Data Mongodb 和这样的文档 id ObjectId 565c5ed433a140520cdedd7f attributes 565c5ed433a140520cdedd73 333563851 list
  • 使用 JavaFX 将可执行 Jar 限制为一个窗口

    我正在通过构建 JavaFX 应用程序E fx 剪辑 and Java场景生成器 基本功能是登录窗口 登录后 将打开新窗口 然后登录窗口消失 目前还处于原型阶段 用完eclipse后 我想要的功能都有了 启动时显示登录窗口 代码如下 Ove
  • Spring Boot - 如何在开发过程中禁用@Cacheable?

    我正在寻找两件事 如何在开发过程中使用 Spring boot dev 配置文件禁用所有缓存 application properties 中似乎没有通用设置可以将其全部关闭 最简单的方法是什么 如何禁用特定方法的缓存 我尝试像这样使用 S
  • 如何保存/加载 BigInteger 数组

    我想保存 加载BigInteger数组传入 传出 SharedPreferences 如何做呢 例如对于以下数组 private BigInteger dataCreatedTimes new BigInteger 20 Using Gso
  • 为什么这段代码可以在 Java 7 中运行,而不能在 Java 8 中运行?

    我目前使用 IDE Eclipse 版本 Neon 2 Release 4 6 2 和版本 java Version 8 Update 131 在此代码中 IDE 给出错误 类型不匹配 无法从字节转换为整数 Integer i byte 1
  • 我有什么理由应该嘲笑?

    我也是 Mockito 和 PowerMockito 的新手 我发现我无法使用纯 Mockito 测试静态方法 因此我需要使用 PowerMockito 对吗 我有一个非常简单的类 名为 Validate 使用这个非常简单的方法 publi
  • Maven编译错误:包不存在

    我正在尝试向现有企业项目添加 Maven 支持 这是一个多模块项目 前 2 个模块编译和打包没有问题 但我面临编译错误 我尝试在多个模块中使用相同的依赖项 我的结构是 gt parent gt pom xml gt module 1 gt
  • 每次修改代码时都必须 mvn clean install

    我不是来自 Java 世界 但我必须为我的一个项目深入研究它 我不明白为什么每次修改或更新代码时 都必须 mvn clean install 来调试代码的最新版本 你知道为什么吗 尝试按Ctrl Shift F9 热插拔 有时会有所帮助
  • 最新版本 6.* Struts2 支持 Tomcat 10 吗? [复制]

    这个问题在这里已经有答案了 最新版本 6 Struts2 支持 Tomcat 10 吗 异常启动过滤器 struts2 java lang ClassCastException class org apache struts2 dispat

随机推荐

  • HTML注释

    目录 HTML 注释标签 实例 实例 实例 条件注释 软件程序标签 一个完整的实例 注释标签 用于在 HTML 插入注释 HTML 注释标签 您能够通过如下语法向 HTML 源代码添加注释 实例 注释 在开始标签中有一个惊叹号 但是结束标签
  • LeetCode:1625. 执行操作后字典序最小的字符串

    题目链接 1625 执行操作后字典序最小的字符串 力扣 LeetCode 题目信息 给你一个字符串 s 以及两个整数 a 和 b 其中 字符串 s 的长度为偶数 且仅由数字 0 到 9 组成 你可以在 s 上按任意顺序多次执行下面两个操作之
  • 用大数乘法计算阶乘

    在比较小的范围内阶乘可以递归实现 而求更大的数的阶乘一般用到long long长整形数 不过 即使这样 在耗时和再大些的阶乘上力有不逮 所以 在输入比较大的情况下 用大数乘法计算阶乘是最好的选择 计算过程分2步 1 输入字符串s 将它的值保
  • 瑞吉外卖【用户移动端】

    用户移动端 一 手机验证码登录 1 短信发送 1 1 短信服务介绍 1 2 阿里云短信服务 2 手机验证码登录 2 1 需求分析 2 2 数据模型 2 3 代码开发 二 菜品展示 购物车 下单 1 用户地址薄 1 1 需求分析 1 2 数据
  • VLT:Vision-Language Transformer用于引用的视觉语言转换和查询生成分割

    摘要 在这项工作中 我们解决了引用分割的挑战性任务 引用分割中的查询表达式通常通过描述目标对象与其他对象的关系来表示目标对象 因此 为了在图像中的所有实例中找到目标实例 模型必须对整个图像有一个整体的理解 为了实现这一点 我们将引用分割重新
  • kali Linux的优点与缺点

    Kali Linux简介 用于数字取证操作系统 Kali Linux是基于Debian的Linux发行版 设计用于数字取证操作系统 由Offensive Security Ltd维护和资助 最先由Offensive Security的Mat
  • 使用X-WIN32 EXCEED等软件显示远程LINUX桌面的设置

    href http blog bcchinese net shiaohuazhang Services Pingback aspx rel pingback gt 使用X WIN32 EXCEED等软件显示远程LINUX桌面的设置 RED
  • 使用思维导图,优雅的完成自己的代码

    我自己常常在写代码的时候 会突然搞不清变量用来干嘛的 也会被理不清的逻辑搞得自己异常烦躁 我甚至常常暗示自己我不适合写代码 思维总是那么不清晰 直到我发现了思维导图的妙用 最开始使用思维导图的时候 我其实是用来记知识点的 然而某一刻就灵光一
  • Scrum是用来发现问题的

    原文链接作者 Mark Levison 机械的Scrum对比真正的Scrum 差别在哪里 最近 我和一个朋友聊到了他们公司实施Scrum的情况 他们有些迷茫 在实施Scrum之前 他们经常为了访问一台测试机而不得不等上一个小时 甚至更多时间
  • 单例模式 - 饿汉式与懒汉式详解

    什么是单例模式 对于一个软件系统中的某些类而言 只有一个实例很重要 就像Windows中的任务管理器一样 只能打开一个 如果不适用机制对窗口对象进行唯一化 必定会弹出多个窗口 如果这些窗口显示的内容完全一致 则是重复对象 浪费内存资源 如果
  • H2数据库攻略之一-简介

    1 H2数据库介绍 常用的开源数据库 H2 Derby HSQLDB MySQL PostgreSQL 其中H2 HSQLDB类似 十分适合作为嵌入式数据库使用 其它的数据库大部分都需要安装独立的客户端和服务器端 H2的优势 1 h2采用纯
  • jQuery qTip2提示插件 (示例图,API)

    author YHC 首先介绍一下 主要的作用 用作网页中的提示 例如新手入门的导航 看下图你就明白了 当然这个插件在提示上功能非常丰富 下面主要介绍下载地址 以及入门的一个最小的 例子 qTip2官网下载地址 qTip2官网推荐下载地址
  • Android webView去除默认边框

    Android WebView无论怎么修改它的属性都会存在一定的边距 这是因为 HTML 的 body 标签默认存在一定边距 修改 webView 的属性并没有作用 解决办法 修改 html 代码 html data 原本需要加载的html
  • KaTeX

    KaTeX LaTeX数学公式编辑手册 只需要在第三列写法前后分别加上 就可以转换为符号 但需注意 CSDN的使用的是 KaTeX KaTeX KATE X数学公式 而不是 LaTeX LaTeX LATE X 两者会有些许区别 如果有
  • 漂亮的计算器页面 html,html+css实现一个好看的计算器实例代码

    最终效果如下图 2 有bug 就是整数后点击 号结果正确 如果小数后面点击 的话结果就错误 其他都正常 求指点 input的value是string类型的 在JS中改如何正确处理下图 1中的if部分 图 1 图 2 HTML代码如下 简单的
  • 【超全汇总】学习数据结构与算法,计算机基础知识,看这篇就够了

    由于文章有点多 并且发的文章也不是一个系列一个系列发的 不过我的文章大部分都是围绕着 数据结构 算法 计算机网络 操作系统 Linux 数据库 这几个方面发的 为了方便大家阅读 我整理了一波 不过公众号可以说是不支持修改文章 因为我决定每两
  • Java环境从删除到重装

    Java环境从删除到重装 前言 须知 如何完全删除jdk 安装jdk 前言 今天由于一些原因把Java环境删除了 怎么装都装不好 遇到了很多错误 在网上找了好多解决办法之后终于弄好了 所以写成一份Java环境从删除到重装 给各位不小心删除J
  • Centos7下基于jdk11 安装RocketMQ

    1 简介 RocketMQ是阿里巴巴中间件团队自研的一款高性能 高吞吐量 低延迟 高可用 高可靠 具备金融级稳定性 的分布式消息中间件 开源后并于2016年捐赠给Apache社区孵化 目前已经成为了 Apache顶级项目 当前在国内被广泛的
  • 用html+js实现代码背景墙特效【建议收藏】

    在csdn里面 有些博主的主页非常的帅 就是代码从上往下掉的特效 那么这种效果我们作为程序员该如何去写出来呢 不用担心 这篇博客就分享如何创建一个代码背景墙 1 效果展示 2 代码分享
  • java.io.FileNotFoundException: http://www.xxxxx.net:8080/test/test/ 403错误

    POST请求错误内容 java io FileNotFoundException http www xxxxx net 8080 test test at libcore net http HttpURLConnectionImpl get