HttpClient的Post请求失败(form表单参数包含中文)

我最近在使用HttpClient通过Post方式发送form表单提交请求,但是,在使用NameValuePair[] 拼写form提交参数的时候,有一些参数名包含了中文。我在测试时候发现,如果参数名中不包含中文,则该参数的值能够成功请求过去。但是,如果参数中包含中文,则请求参数值传递后不成功。
我当时,对参数名称进行了编码集的修改,但是,无任何效果。Post请求传递的是字节流,应该和编码集无关,所以一时想不出到底是哪里除了问题,请各位大侠帮帮忙!谢谢!
以下是我的代码片段:

                HttpClient client = new HttpClient();
                // 从会话中取出cookie信息并设置到client对象中
                client.getState().addCookies(cookie);
                // 创建GetMethod用于获取所有咨询列表信息
                String url="http://A..";
                PostMethod listPost = new PostMethod(url);

                // 拼写参数
                NameValuePair[] body = new NameValuePair[] {
                        new NameValuePair("ctl00产品性质","01-high"),
                        new NameValuePair("ctl00product_name","product01" )};

                Part[] parts=new Part[ body.length];
                for (int i = 0; i < body.length; i++) {

                        parts[i]=new StringPart(body[i].getName(),
                                StringUtils.isNotBlank(body[i].getValue())?body[i].getValue():"","UTF-8");
                }

                listPost.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,"UTF-8");
                listPost.setRequestEntity(new MultipartRequestEntity(parts,listPost.getParams()));

                listPost.setRequestHeader("Accept", "text/html, application/xhtml+xml, */*");

                client.executeMethod(listPost);
                String reString = listPost.getResponseBodyAsString();
                System.out.println(reString);
                if (listPost.getStatusCode() == 200) {
                    return true;
                }
weixin_43084219
weixin_43084219 我很想知道你是怎么解决这个问题的,因为我也遇见这个问题了,正在头疼
一年多之前 回复

2个回答

http一般使用的是utf-8,你要把中文转成utf-8就不会有问题了。如果直接使用unicode或gbs2312之类的,服务端使用uft-8处理后,就是乱码了。

用方法:URLEncoder.encode("中文内容", "utf-8");试试

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
带嵌套参数的POST请求

<div class="post-text" itemprop="text"> <p>I'm fairly new to Go, so I apologize if this is a trivial question. </p> <p>I'm currently trying to write a function that creates a POST request with a nested parameter hash. So the equivalent call in a dynamic language such as javascript would be:</p> <pre><code>$.post('http://example.com', {level1: {level2: 'foo'}}); </code></pre> <p>In my Go code, I currently have have the hash nested in the following way:</p> <pre><code>func (runner *Runner) post(args... interface{}) interface{} { form_url := getString(args[0]) form_data := ??? http.PostForm(form_url, form_data) </code></pre> <p>The actual type for the form data (interface{}) is provided by a 3rd party library, so I cannot really change it. </p> <p>The problem is the PostForm expects a url.Values type for the form data, which is define as </p> <pre><code>type Values map[string][]string </code></pre> <p>What would be the best of handling this? My conclusion so far is that I would need to write a function that would HTTP encode the nested hash and have the following signature:</p> <pre><code>func httpEncodeNestedMap(data interface{}) map[string][]string {...} </code></pre> <p>What would be the idiomatic implementation of this in Go?</p> <p>Thanks.</p> </div>

Laravel处理POST请求作为GET

<div class="post-text" itemprop="text"> <p>I have written two routes in my routes.php</p> <pre><code>Route::get('/users/portfolio', [ 'as' =&gt; 'api.v1.users.portfolio', 'uses' =&gt; 'UsersController@portfolio' ]); Route::post('/users/portfolio', [ 'as' =&gt; 'api.v1.users.portfolio', 'uses' =&gt; 'UsersController@portfolio' ]); </code></pre> <p>GET Route is used to show all info to user Post Route is used to send that info in mail</p> <p>If I Call POST localhost:8000/api/v1/users/portfolio Then It Works Fine Result of print_r(request()-&gt;method()) is POST</p> <p>But If I Call POST localhost:8000/api/v1/users/portfolio/ (Note a slash in the end) Then Laravel handles this as a GET Request Result of print_r(request()-&gt;method()) is GET</p> </div>

java Post请求接收body里的参数

try { URL url = new URL(strURL);// 创建连接 HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setUseCaches(false); connection.setInstanceFollowRedirects(true); connection.setRequestMethod("POST");// 设置请求方式 connection.setRequestProperty("Accept","application/json");// 设置接收数据的格式 connection.setRequestProperty("Content-Type","application/json");// 设置发送数据的格式 connection.connect(); OutputStreamWriter out = new OutputStreamWriter( connection.getOutputStream(),"UTF-8");// utf-8编码 out.append(params); out.flush(); out.close(); // 读取响应 int length = (int) connection.getContentLength();// 获取长度 InputStream is = connection.getInputStream(); if (length != -1){ byte[] data = new byte[length]; byte[] temp = new byte[512]; int readLen = 0; int destPos = 0; while ((readLen = is.read(temp)) > 0){ System.arraycopy(temp, 0, data, destPos, readLen); destPos += readLen; } String result = new String(data, "UTF-8"); System.out.println(result); return result; } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } --接收方法 @RequestMapping(value="/test", method = RequestMethod.POST) @ResponseBody public String test(HttpServletRequest request,HttpServletResponse response,@RequestBody String str){ System.out.println(str); return "DetailedRules"; }

关于HttpClient的问题,如何使用HttpClient重定向?

``` /* * HttpRequestProxy.java * * Created on November 3, 2008, 9:53 AM */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.SimpleHttpConnectionManager; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; public class HttpRequestProxy { // 超时间隔 private static int connectTimeOut = 60000; // 让connectionmanager管理httpclientconnection时是否关闭连接 private static boolean alwaysClose = false; // 返回数据编码格式 private String encoding = "UTF-8"; private final HttpClient client = new HttpClient(); public HttpClient getHttpClient() { return client; } /** * 用法: HttpRequestProxy hrp = new HttpRequestProxy(); * hrp.doRequest("http://www.163.com",null,null,"gbk"); * * @param url * 请求的资源URL * @param postData * POST请求时form表单封装的数据 没有时传null * @param header * request请求时附带的头信息(header) 没有时传null * @param encoding * response返回的信息编码格式 没有时传null * @return response返回的文本数据 * @throws CustomException */ public String doRequest(String url, Map postData, Map header, String encoding) throws Exception { String responseString = null; // 头部请求信息 Header[] headers = null; if (header != null) { Set entrySet = header.entrySet(); int dataLength = entrySet.size(); headers = new Header[dataLength]; int i = 0; for (Iterator itor = entrySet.iterator(); itor.hasNext();) { Map.Entry entry = (Map.Entry) itor.next(); headers[i++] = new Header(entry.getKey().toString(), entry.getValue().toString()); } } // post方式 if (postData != null) { PostMethod postRequest = new PostMethod(url.trim()); if (headers != null) { for (int i = 0; i < headers.length; i++) { postRequest.setRequestHeader(headers[i]); } } Set entrySet = postData.entrySet(); int dataLength = entrySet.size(); NameValuePair[] params = new NameValuePair[dataLength]; int i = 0; for (Iterator itor = entrySet.iterator(); itor.hasNext();) { Map.Entry entry = (Map.Entry) itor.next(); params[i++] = new NameValuePair(entry.getKey().toString(), entry.getValue().toString()); } postRequest.setRequestBody(params); try { responseString = this.executeMethod(postRequest, encoding); } catch (Exception e) { throw e; } finally { postRequest.releaseConnection(); } } return responseString; } private String executeMethod(HttpMethod request, String encoding) throws Exception { String responseContent = null; InputStream responseStream = null; BufferedReader rd = null; try { this.getHttpClient().executeMethod(request); if (encoding != null) { responseStream = request.getResponseBodyAsStream(); rd = new BufferedReader(new InputStreamReader(responseStream, encoding)); String tempLine = rd.readLine(); StringBuffer tempStr = new StringBuffer(); String crlf = System.getProperty("line.separator"); while (tempLine != null) { tempStr.append(tempLine); tempStr.append(crlf); tempLine = rd.readLine(); } responseContent = tempStr.toString(); } else responseContent = request.getResponseBodyAsString(); Header locationHeader = request.getResponseHeader("location"); // 返回代码为302,301时,表示页面己经重定向,则重新请求location的url,这在 // 一些登录授权取cookie时很重要 if (locationHeader != null) { String redirectUrl = locationHeader.getValue(); this.doRequest(redirectUrl, null, null, null); } } catch (HttpException e) { throw new Exception(e.getMessage()); } catch (IOException e) { throw new Exception(e.getMessage()); } finally { if (rd != null) try { rd.close(); } catch (IOException e) { throw new Exception(e.getMessage()); } if (responseStream != null) try { responseStream.close(); } catch (IOException e) { throw new Exception(e.getMessage()); } } return responseContent; } /** * 特殊请求数据,这样的请求往往会出现redirect本身而出现递归死循环重定向 所以单独写成一个请求方法 * 比如现在请求的url为:http://localhost:8080/demo/index.jsp 返回代码为302 * 头部信息中location值为:http://localhost:8083/demo/index.jsp * 这时httpclient认为进入递归死循环重定向,抛出CircularRedirectException异常 * * @param url * @return * @throws CustomException */ public String doSpecialRequest(String url, int count, String encoding) throws Exception { String str = null; InputStream responseStream = null; BufferedReader rd = null; GetMethod getRequest = new GetMethod(url); // 关闭httpclient自动重定向动能 getRequest.setFollowRedirects(false); try { this.client.executeMethod(getRequest); Header header = getRequest.getResponseHeader("location"); if (header != null) { // 请求重定向后的URL,count同时加1 this.doSpecialRequest(header.getValue(), count + 1, encoding); } // 这里用count作为标志位,当count为0时才返回请求的URL文本, // 这样就可以忽略所有的递归重定向时返回文本流操作,提高性能 if (count == 0) { getRequest = new GetMethod(url); getRequest.setFollowRedirects(false); this.client.executeMethod(getRequest); responseStream = getRequest.getResponseBodyAsStream(); rd = new BufferedReader(new InputStreamReader(responseStream, encoding)); String tempLine = rd.readLine(); StringBuffer tempStr = new StringBuffer(); String crlf = System.getProperty("line.separator"); while (tempLine != null) { tempStr.append(tempLine); tempStr.append(crlf); tempLine = rd.readLine(); } str = tempStr.toString(); } } catch (HttpException e) { throw new Exception(e.getMessage()); } catch (IOException e) { throw new Exception(e.getMessage()); } finally { getRequest.releaseConnection(); if (rd != null) try { rd.close(); } catch (IOException e) { throw new Exception(e.getMessage()); } if (responseStream != null) try { responseStream.close(); } catch (IOException e) { throw new Exception(e.getMessage()); } } return str; } public static void main(String[] args) throws Exception { HttpRequestProxy hrp = new HttpRequestProxy(); Map date = new HashMap(); date.put("jyidApplet", "1"); date.put("codeNumApplet", "1"); date.put("jymxIdApplet", "447"); date.put("patientIdApplet", "1118"); String str = hrp.doRequest("http://127.0.0.1:8080/lis/mz/addTM",date, null, null); System.out.println(str); } } ```

ionic3 http请求更改headers post请求出错

我ionic3中设置http请求,后台为webapi,get请求没问题,post不带参数也能请求, 添加参数就报错,要么405要么415,更改ContenT_Type好像没起作用,增加tonken后台也是无法获取值,有哪位大神 遇到过知道怎么解决吗? //token验证 var headers = new Headers(); headers.append('Content-Type', 'application/json'); headers.append('Authorization', 'weixiao-token');//这里添加了token let options = new RequestOptions(JSON.stringify({ headers: headers })); this.http.request('http://localhost:6112/api/UserInfo/Login',options) .subscribe((res:Response)=>{ console.log(res.json()); }); ``` 后台获取到的是null //post带参数 let headers =new Headers({ "Content-Type":"application/x-www-form-urlencoded"}) let body =JSON.stringify({name:"chuanzhi"}) let reqO = new RequestOptions({headers:headers}) this.http.post("http://localhost:23909/api/Cs/postPaths", body,reqO) .subscribe((res:Response)=>{ console.log(res.json()); }) 在chrome中查看没有变化Content-Type:application/json; charset=utf-8 报错 发现参数在request payload中,报错415然后想到去掉JSON.stringify(),找不到参数了,并且报错405 这是后台的接口,试过去掉[FromBody]也没用,实在没辙了 [Route("api/Cs/postPaths")] [HttpPost] public string postPaths([FromBody]string name) { return name; } 刚开始学,希望前辈指教下

无法从POST请求中获取数据

<div class="post-text" itemprop="text"> <p>I want to get data from POST request. I have form which create this POST request and redirect it to some action, you can see that in this line:</p> <pre><code>&lt;?php $form = ActiveForm::begin([ 'id' =&gt; 'my-form', 'options' =&gt; ['enctype' =&gt; 'multipart/form-data'], 'action' =&gt; ['site/form'] ]); ?&gt; </code></pre> <p>then some method,in my case actionForm() in SiteController must to handle this request. I need to get that data and save it to db. I have model for that:</p> <pre><code>&lt;?php namespace app\models; use Yii; /** * This is the model class for table "form". * * @property integer $id * @property string $name * @property string $email * @property integer $age * @property integer $height * @property integer $weight * @property string $city * @property string $techies * @property string $english_level * @property resource $photo_1 * @property resource $photo_2 * @property resource $photo_3 * @property resource $photo_4 * @property resource $photo_5 */ class Form extends \yii\db\ActiveRecord { /** * @inheritdoc */ public static function tableName() { return 'form'; } /** * @inheritdoc */ public function rules() { return [ [['name', 'email', 'age', 'height', 'weight', 'city', 'techies', 'english_level', 'photo_1', 'photo_2', 'photo_3', 'photo_4', 'photo_5'], 'required'], [['name', 'email', 'city', 'techies', 'english_level', 'photo_1', 'photo_2', 'photo_3', 'photo_4', 'photo_5'], 'string'], [['age', 'height', 'weight'], 'integer'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' =&gt; 'ID', 'name' =&gt; 'Name', 'email' =&gt; 'Email', 'age' =&gt; 'Age', 'height' =&gt; 'Height', 'weight' =&gt; 'Weight', 'city' =&gt; 'City', 'techies' =&gt; 'Techies', 'english_level' =&gt; 'English Level', 'photo_1' =&gt; 'Photo 1', 'photo_2' =&gt; 'Photo 2', 'photo_3' =&gt; 'Photo 3', 'photo_4' =&gt; 'Photo 4', 'photo_5' =&gt; 'Photo 5', ]; } } </code></pre> <p>this is model that created from gii model generator. I also have table in my db named form and with all rows. In my db.php I have all configuration for db. But when I clicked button in my form,page only reload without anything creating. <strong>Action in controller:</strong></p> <pre><code>public function actionForm() { $Form = new Form(); if (($loaded = $Form-&gt;load(Yii::$app-&gt;request-&gt;post('form'))) &amp;&amp; $Form-&gt;save()) { return 'ok'; }elseif($loaded){ var_dump($Form-&gt;getErrors()); } return $this-&gt;render('form',array( 'Form' =&gt; $Form, )); } when all good that method must to show "ok" or errors,but nothing happened,but something must to happen. </code></pre> <p><strong>My view file:</strong></p> <pre><code>&lt;?php use yii\helpers\Html; use yii\widgets\ActiveForm; use dosamigos\fileupload\FileUploadUI; ?&gt; &lt;head&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt; &lt;/head&gt; &lt;?php $form = ActiveForm::begin([ 'id' =&gt; 'my-form', 'options' =&gt; ['enctype' =&gt; 'multipart/form-data'], 'action' =&gt; ['site/form'] ]); ?&gt; &lt;div class="row"&gt; &lt;div class="col-lg-6"&gt; &lt;?= $form-&gt;field($Form, 'name')-&gt;textInput(['class'=&gt;'name_class'])-&gt;input('name',['placeholder' =&gt; "Имя"])-&gt;label(false); ?&gt; &lt;/div&gt; &lt;div class="col-lg-6"&gt; &lt;?= $form-&gt;field($Form, 'email')-&gt;textInput()-&gt;input('email',['placeholder' =&gt; "E-mail"])-&gt;label(false); ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-lg-6"&gt; &lt;?= $form-&gt;field($Form, 'age')-&gt;textInput()-&gt;input('age',['placeholder' =&gt; "Возраст(полных лет)"])-&gt;label(false); ?&gt; &lt;/div&gt; &lt;div class="col-lg-6"&gt; &lt;?= $form-&gt;field($Form, 'height')-&gt;textInput()-&gt;input('height',['placeholder' =&gt; "Рост"])-&gt;label(false); ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-lg-6"&gt; &lt;?= $form-&gt;field($Form, 'weight')-&gt;textInput()-&gt;input('weight',['placeholder' =&gt; "Вес"])-&gt;label(false); ?&gt; &lt;/div&gt; &lt;div class="col-lg-6"&gt; &lt;?= $form-&gt;field($Form, 'city')-&gt;textInput()-&gt;input('city',['placeholder' =&gt; "Город проживания"])-&gt;label(false); ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-lg-3"&gt; &lt;p&gt;&lt;img class="describe_images" src="computer.png"&gt;&lt;/img&gt;Нужна ли техника в аренду&lt;/p&gt; &lt;/div&gt; &lt;?= $form-&gt;field($Form, 'techies')-&gt;checkboxList(['no'=&gt;'Нет', 'yes_camera'=&gt;'Да,только камера', 'yes_both'=&gt;'да,компьютер и камера'])-&gt;label(false) ?&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-lg-3"&gt; &lt;p&gt;&lt;img class="describe_images" src="English.png"&gt;&lt;/img&gt;Знание английского&lt;/p&gt; &lt;/div&gt; &lt;?= $form-&gt;field($Form, 'english_level')-&gt;checkboxList(['starter'=&gt;'Без знания', 'elementary'=&gt;'Базовый', 'intermediate'=&gt;'Средний','up-intermediate'=&gt;'Высокий','advanced'=&gt;'Превосходный'])-&gt;label(false) ?&gt; &lt;/div&gt; &lt;script&gt; $('#my-form').submit( function(e) { e.preventDefault(); var data = new FormData(this); // &lt;-- 'this' is your form element $.ajax({ url: 'index.php/Form', data: data, cache: false, contentType: false, processData: false, type: 'POST', success: function(data){ alert(data); }, error: function(){ alert('ERROR at PHP side!!'); } }); }); &lt;/script&gt; &lt;script&gt; $(function() { // Multiple images preview in browser var imagesPreview = function(input, placetoinsert) { if (input.files) { var filesAmount = input.files.length; for (i = 0; i &lt; filesAmount; i++) { var reader = new FileReader(); reader.onload = function(event) { $($.parseHTML('&lt;img&gt;')).attr('src', event.target.result).appendTo('.preview'); } reader.readAsDataURL(input.files[i]); } } }; $('#gallery-photo-add').on('change', function() { imagesPreview(this, 'div.gallery'); }); }); &lt;/script&gt; &lt;div class="row"&gt; &lt;div class="col-lg-6"&gt; &lt;div class="col-lg-6"&gt; &lt;p class="add_photo"&gt;&lt;img class="describe_images" src="photo.png"&gt;&lt;/img&gt;Добавить фото(до 5 штук)&lt;/p&gt; &lt;/div&gt; &lt;div class="col-lg-6"&gt; &lt;?= $form-&gt;field($Form, 'images[]')-&gt;fileInput(['multiple' =&gt; true, 'accept' =&gt; 'image/*','id'=&gt;'gallery-photo-add'])-&gt;label(false) ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-lg-6 pixels-line"&gt; &lt;div class="preview"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;?= Html::submitButton('Отправить', ['class' =&gt; 'btn btn-primary']) ?&gt; &lt;/div&gt; &lt;?php ActiveForm::end() ?&gt; </code></pre> </div>

http的post请求出现401的错误,怎么解决

import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; public class GetToken { public static final String POST_URL = "https://c2bt4.maxuscloud.com/oauth/token"; /** * 调用Post接口 */ public static void httpURLConnectionPOST(){ try { URL url = new URL(POST_URL); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); // post请求缓存设为false connection.setUseCaches(false); // 设置该HttpURLConnection实例是否自动执行重定向 connection.setInstanceFollowRedirects(true); connection.setRequestProperty("Content-Type","application/json;charset=utf-8"); connection.connect(); DataOutputStream dataout = new DataOutputStream(connection.getOutputStream()); String param = "client_id=bc8f844701de11e98372fa163ed907b0&client_secret=cda0673501de11e98372fa163ed907b0&scope=read write&grant_type=client_credentials"; dataout.writeBytes(param); dataout.flush(); dataout.close(); BufferedReader bf = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8")); String line; StringBuilder sb = new StringBuilder(); // 用来存储响应数据 // 循环读取流,若不到结尾处 while ((line = bf.readLine()) != null) { //sb.append(bf.readLine()); sb.append(line).append(System.getProperty("line.separator")); } bf.close(); // 重要且易忽略步骤 (关闭流,切记!) connection.disconnect(); // 销毁连接 System.out.println(sb.toString()); }catch (Exception e){ e.printStackTrace(); } } public static void main(String[] args) throws UnknownHostException { httpURLConnectionPOST(); } } ![图片说明](https://img-ask.csdn.net/upload/201906/10/1560155768_914838.jpg)

java中PostMethod和HttpPost都可以提交post表单,请问他们有什么区别

PostMethod HttpPost 尤其是在cookie和保存信息方面有什么不同?求大神解释 我抛砖引玉,上代码! import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.util.Scanner; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.cookie.CookiePolicy; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class Byrbt { /** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { // TODO Auto-generated method stub //先下载登陆页面 URL login=new URL("http://bt.byr.cn/login.php"); InputStreamReader isr=new InputStreamReader(login.openStream(),"utf-8"); BufferedReader br=new BufferedReader(isr); String line=""; String html=""; while((line=br.readLine())!=null){ //html=html+line+"\n"; html+=line; } Document doc=Jsoup.parse(html); //找到图片,下载图片 String imgSrc=""; imgSrc=doc.body().getElementsByAttribute("method").select("tr").select("img").attr("src").toString(); String realSrc="http://bt.byr.cn/"+imgSrc; System.out.println(realSrc); getPhotoFromWeb(realSrc); String imgString=""; String imgHash=""; imgHash=realSrc.split("imagehash=")[1]; System.out.println("输入d盘里的验证码"); Scanner sca =new Scanner(System.in); imgString=sca.next(); //登陆 HttpClient httpClient=new HttpClient(); httpClient.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); PostMethod post = new PostMethod("http://bt.byr.cn/login.php"); post.setRequestHeader(new Header( "User-Agent", "Mozilla/5.0 /Windows; U; Windows NT 4.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.0")); post.addParameter("username", "wingrove"); post.addParameter("password","jiao12" ); post.addParameter("imagestring",imgString); post.addParameter("imagehash",imgHash); httpClient.executeMethod(post); System.out.println("GET POST STATUS: "+ post.getStatusLine().toString()); // GetMethod get = new GetMethod("http://bt.byr.cn/torrents.php?cat=406"); // get.setRequestHeader(new Header( // "User-Agent", // "Mozilla/5.0 /Windows; U; Windows NT 4.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.0")); // httpClient.executeMethod(get); // isr=new InputStreamReader(post.getResponseBodyAsStream(),"utf-8"); br=new BufferedReader(isr); line=""; html=""; while((line=br.readLine())!=null){ html=html+line+"\n"; } System.out.println(html); } public static void getPhotoFromWeb(String urlString) throws MalformedURLException, Exception{ //这个程序只适用于网络,不适用于本地可能是由于url的局限 URL url = new URL(urlString); File outFile =new File("d:/CAPTCHA.jpg"); OutputStream os = new FileOutputStream(outFile); InputStream is = url.openStream(); byte[] buff = new byte[1024]; while(true) { int readed = is.read(buff); if(readed == -1) { break; } byte[] temp = new byte[readed]; System.arraycopy(buff, 0, temp, 0, readed); os.write(temp); } is.close(); os.close(); } } private void doPost(String url, Map<String, String> headers, String body) throws IOException { 02 HttpPost post = new HttpPost(url); 03 for (Map.Entry<String, String> header : headers.entrySet()) { 04 post.setHeader(header.getKey(), header.getValue()); 05 } 06 post.setEntity(new StringEntity(body)); 07 HttpContext context = createBasicAuthContext("admin", "password"); 08 CloseableHttpResponse response = client.execute(host, post, context); 09 try { 10 // status = response.getStatusLine().getStatusCode(); 11 // headers = response.getAllHeaders(); 12 13 // HttpEntity entity = response.getEntity(); 14 // text = IOUtils.toString(entity.getContent(), "ISO-8859-1"); 15 } finally { 16 response.close(); 17 } 18 }

OkHttp使用post方式提交multipart/form-data

之前使用HttpClient,但是由于AS的问题,放弃了,改用OkHttp,但还是出现提交了表单但是没有出现正常的成功跳转, 同时返回状态码却是200 OK;还有就是,我的post方法指定的url是一个get方式提交数据的url,然后在这个url的基础上 再提交post数据,截图如下: 这是multipart/form-data: ![图片说明](https://img-ask.csdn.net/upload/201605/09/1462773887_889400.png) 这是我的代码: ![图片说明](https://img-ask.csdn.net/upload/201605/09/1462773914_754910.png)

关于将参数传到已有form中。

服务器端已经做了一个form 并且有 用户名 和 密码的参数 我怎样 把我的安卓端 注册的数据 post 到他的 form中?

httpclient4+怎么禁用编码(Content-Transfer-Encoding)

httpclient 当POST表单时使用了Content-Type:multipart/form-data时表单自动编码了: 如下 ``` POST ------------------ HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/form-data; boundary= MIME-Version: 1.0 Content-Length: 6329 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.3.1 (java 1.5) Cookie: JSESSIONID= Cookie2: $Version=1 - - - - -=_Part_35_1834923761.1445844705665 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: form-data; name="content" <?xml version=3D'1.0' encoding=3D"GBK" standalone=3D"yes"?> <Package xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"> <Header> <RequestType>01</RequestType> <SendTime>2014-11-28 11:35:05</SendTime> <ThirdSerial>R2015030501</ThirdSerial> <ComSerial xsi:nil=3D"true"/> <Asyn>0</Asyn> <ProductCode>0001</ProductCode> </Header> <Request> ``` POST是一个表单 ,xml本身是表单content的值, 可是服务器不支持quoted-printable这个编码,tmd. 求解

通过multipart/form-data ,python+post上传excel文档

Content-Disposition: form-data; name="distributeDetailFile"; filename="test.xlsx" Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Content-Disposition: form-data; name="name" TRT -----------------------------148644891810696992751850105888 Content-Disposition: form-data; name="type" 10 -----------------------------148644891810696992751850105888 Content-Disposition: form-data; name="assetCode" zsc -----------------------------148644891810696992751850105888--

如何从PUT HTTP请求(表单数据)获取数据

<div class="post-text" itemprop="text"> <p>This is my function in my API I need to get the data from the form-data from the HTTP request.</p> <p>I need to get the put values to update my data in my class query.</p> <pre><code> function method() { $method = $_SERVER['REQUEST_METHOD']; return $method; } function updateUser() { $method = method(); if($method == 'PUT'){ $put_data = file_get_contents("php://input"); parse_str($put_data, $post_vars); return $post_vars; }else{ $status = '400 Bad Request'; return $status; } } </code></pre> <p>{"------WebKitFormBoundaryYKcobRh4FtrGCYaI Content-Disposition:_form-data;_name":"\"test\" test_value ------WebKitFormBoundaryYKcobRh4FtrGCYaI-- "}</p> <p>This is what i get from the return $post_vars</p> <p>I need to have test: test_value</p> </div>

如何在网页上选择多种表单之一来使用HttpClient POST数据?

<div class="post-text" itemprop="text"> <p>I'm creating a method that will go to our university catalog website and return the degree plan for the selected school year. This is my code to send a POST request to the dropdown box to select the school year. </p> <pre><code> // Post to catalog website to choose catalog year HttpClient client = new HttpClient(); string catalogURL = "http://catalog.cpp.edu/index.php"; //Example choose 2015/16 catalog (value = "8") //input parameter for drop down box in catalog var parameter = new Dictionary&lt;string,string&gt;{ { "value", "8" } }; var encodedContent = new FormUrlEncodedContent(parameter); var response = await client.PostAsync(catalogURL, encodedContent).ConfigureAwait(false); if (response.StatusCode == HttpStatusCode.OK) { //get content: var responseContent = await response.Content.ReadAsStringAsync ().ConfigureAwait (false); //return html doc for catalog year return responseContent; } </code></pre> <p>However, I don't believe it's working. It's returning the html doc for the default page, the 2016/17 catalog, not the 2015/16 catalog. I think it may not be posting to the correct form, as there is another one before the drop down box: a search bar. What am I doing wrong?</p> <p>This is what the source code looks like for the drop down box that I want to access:</p> <pre><code> &lt;form name="select_catalog" method="post" action="/index.php" style="margin: 0px"&gt; &lt;table border="0" cellspacing="0" cellpadding="0"&gt; &lt;tbody&gt; &lt;tr valign="top"&gt; &lt;td&gt; &lt;select tabindex="201" name="catalog" title="select a catalog" id="select_catalog"&gt; &lt;option value="10" selected&gt; 2016-2017 University Catalog&lt;/option&gt; &lt;option value="8"&gt; 2015-2016 University Catalog&lt;/option&gt; &lt;option value="9"&gt; 2014-2015 University Catalog&lt;/option&gt; &lt;option value="5"&gt; 2013-2014 University Catalog&lt;/option&gt; &lt;option value="4"&gt; 2012-2013 University Catalog&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; </code></pre> <p>*Note: the url for the page remains the same regardless of the year selected, but the linke to the curriculum plans are different.</p> <p>Sorry if this is a dumb question, but I don't have much experience with C# or .NET</p> </div>

C#如何在Http Request Header中加入参数

请问如何在Http Request Header中加入参数 使用C#调用讯飞的AIUI文本语义,一直返回授权请求头参数为空

post远程服务器返回错误: (415)

``` Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim url As String = "http://api.jsform.com/api/v1/entry/query" Dim request As HttpWebRequest = CType(HttpWebRequest.Create(url), HttpWebRequest) Dim encoding As New UTF8Encoding() request.Method = "POST" request.ContentType = "application/x-www-form-urlencoded" request.Credentials = CredentialCache.DefaultCredentials Dim ddd As String = "{" & Chr(34) & "form_id" & Chr(34) & ":" & Chr(34) & "5a6586b6e7aea961dac4a41d" & Chr(34) & "}" es(usernamepassword))) Dim code As String = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(String.Format("{0}:{1}", "5a44aa7fe7aea932ad6b5d56", "DwTTsvTQJGCCZiqwGQVj149YbJ8BHz1D"))) request.Headers.Add("Authorization", "Basic " + code) Dim bys As Byte() = encoding.GetBytes(ddd) request.ContentLength = bys.Length Dim newStream As Stream = request.GetRequestStream() newStream.Write(bys, 0, bys.Length) newStream.Close() Dim sr As StreamReader = New StreamReader(request.GetResponse().GetResponseStream) TextBox3.Text = sr.ReadToEnd End Sub ``` 远程服务器返回错误: (415),求大侠指导。

C#HTTPClient表单发布和提交问题

<div class="post-text" itemprop="text"> <p>I am trying to do some light screen scraping of a php site with a simple form to simplify a research portion of my work. The page has a simple form with three fields, and a submit button. </p> <p>When I run my code the original page is returned as if I submitted nothing. I also tried to paste in the the fields as a ?name= etc... after the php url but that also returns me to the original page as if I had not pressed the submit button. </p> <p>Here is my current code:</p> <pre><code>private async void postRequest(string url) { using (HttpClient client = new HttpClient()) { var values = new List&lt;KeyValuePair&lt;string, string&gt;&gt;(); values.Add(new KeyValuePair&lt;string, string&gt;("case_type", "55")); values.Add(new KeyValuePair&lt;string, string&gt;("petname", "singh")); values.Add(new KeyValuePair&lt;string, string&gt;("year", "2016")); values.Add(new KeyValuePair&lt;string, string&gt;("button", "Submit")); var content = new FormUrlEncodedContent(values); var response = await client.PostAsync(url, content); var responseString = await response.Content.ReadAsStringAsync(); using (StreamWriter post = new StreamWriter("post_website.txt")) { post.WriteLine(responseString); } } } </code></pre> <p><a href="https://i.stack.imgur.com/uv5C6.png" rel="nofollow noreferrer">Chrome Dev Tools screenshot after submit</a>. I redacted parts of the url, it's a public information site, but being safe just in case.</p> <p>I assume I am doing something wrong since I have basically taught myself C#, and this is my first time trying to do anything web related with C#. </p> <p>I found a similar issue on StackOverflow here: <a href="https://stackoverflow.com/questions/8140366/fill-form-c-sharp-post-error">Fill Form C# &amp; Post Error</a>, but this code didn't work either and I don't believe a cookie is needed. I have tried various other StackOverflow answers regarding using HttpClient and WebClient POST requests to the server, but none have worked.</p> <p>Thanks in advance for any suggestions or insight. </p> </div>

模拟登录,网站源码里面有几个隐藏的input流水号,获取到模拟post请求就是登录不了。

private string getMatch(string text, Regex reg) { Match mBody = reg.Match(text); return mBody.Value; } private void btnLogin_Click(object sender, EventArgs e) { HttpClient httpClient = new HttpClient(); httpClient.MaxResponseContentBufferSize = 256000; httpClient.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); string url = "http://ehire.51job.com/MainLogin.aspx"; HttpResponseMessage response = httpClient.GetAsync(new Uri(url)).Result; string result = response.Content.ReadAsStringAsync().Result; string ctmName = "会员名"; string userName = "账号"; string password = "密码"; string checkCode = string.Empty; string isRememberMe = "false"; string returl = string.Empty; Regex reg = new Regex(@"(?<=id=""hidLangType"" value="").*(?="")"); Regex reg1 = new Regex(@"(?<=id=""hidAccessKey"" value="").*(?="")"); Regex reg2 = new Regex(@"(?<=id=""fksc"" value="").*(?="")"); Regex reg3 = new Regex(@"(?<=id=""hidEhireGuid"" value="").*(?="")"); string langtype = getMatch(result, reg); string oldAccessKey = getMatch(result, reg1); string sc = getMatch(result, reg2); string ec = getMatch(result, reg3); HttpContent postContent = new FormUrlEncodedContent(new Dictionary<string, string>() { {"ctmName", ctmName}, {"userName", userName}, {"password", password}, {"checkCode", checkCode}, {"oldAccessKey", oldAccessKey}, {"langtype", langtype}, {"isRememberMe", isRememberMe}, {"sc", sc}, {"ec", ec}, {"returl", returl} }); response = httpClient.PostAsync(new Uri(url), postContent).Result result = response.Content.ReadAsStringAsync().Result; txtResult.Text = result; httpClient.Dispose(); } 一直停留在登陆页面进不了后面,怎么解决啊?

multipart / form-data上传文件并将其保存在PHP中

<div class="post-text" itemprop="text"> <p>I´am using a Angular frontend and PHP backend to try upload files and save them on an ftp-server. </p> <p>To Upload the Files is this code used:</p> <pre><code>uploadFiles(file: File, uploadFolder: string): Observable&lt;ApiResponseModel&gt; { const adress = environment.apiAdress.api + environment.apiAdress.fileUpload; let header: HttpHeaders = this.getHeader(); header = header.set('Content-Type', 'multipart/form-data'); const formData: FormData = new FormData(); formData.append(uploadFolder, file, file.name); return this.httpClient.post&lt;ApiResponseModel&gt;(adress, formData, {headers: header }); } </code></pre> <p>In my PHP backend i get the file Content und a description of the Post(Content-Type, Content-Disposition, etc), but i cant create a file as long as the additional information in the content is available. Is it possible to remove them easily?</p> <p>The file-content i get looks like this:</p> <p>"------WebKitFormBoundaryCr85Bf8XFGMEeJy5</p> <p>Content-Disposition: form-data; name=""; filename="PDF_Test.pdf"</p> <p>Content-Type: application/pdf</p> <p>%PDF-1.5 %����</p> <p>PDF Content </p> <p>------WebKitFormBoundaryCr85Bf8XFGMEeJy5 "</p> </div>

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

ArrayList源码分析(入门篇)

ArrayList源码分析 前言: 写这篇博客的主要原因是,在我上一次参加千牵科技Java实习生面试时,有被面试官问到ArrayList为什么查找的速度较快,插入和删除的速度较慢?当时我回答得不好,很大的一部分原因是因为我没有阅读过ArrayList源码,虽然最后收到Offer了,但我拒绝了,打算寒假学得再深入些再广泛些,下学期开学后再去投递其他更好的公司。为了更加深入理解ArrayList,也为

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

玩转springboot启动banner定义所得

最近接手了一个springboot项目,不是不熟悉这个框架,启动时打印的信息吸引了我。 这不是我熟悉的常用springboot的打印信息啊,我打开自己的项目: 还真是的,不用默认的感觉也挺高大上的。一时兴起,就去研究了一下源代码,还正是有些收获,稍后我会总结一下。正常情况下做为一个老程序员,是不会对这种小儿科感兴趣的,不就是一个控制台打印嘛。哈哈! 于是出于最初的好奇,研究了项目的源代码。看到

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

立即提问
相关内容推荐