你可以試著訪問下:http://localhost:8062/info
if(arr[j]>arr[j+1]) 執(zhí)行這一步就直接跳去else了
所以完全沒計算就change = 0;
看你的題目描述應(yīng)該是用標(biāo)志位實現(xiàn)冒泡
int length = arr.length;
boolean flag = true;
int temp = 0;
while (flag) {
flag = false;
for (int j = 1; j < length; j++)
if (arr[j - 1] > arr[j]) {
temp = arr[j - 1];
arr[j - 1] = arr[j];
arr[j] = temp;
flag = true;
}
length--;
}我試了一下,你的配置在我這邊是沒有問題的對應(yīng)的url都可以請求到,post使用postman直接請求的,均可以請求到對應(yīng)的結(jié)果,我覺得你可是試著從其他地方找問題,shiro是沒有配置問題的。
spring mvc上傳文件的時候,你需要在spring mvc配置文件中配置org.springframework.web.multipart.commons.CommonsMultipartResolver文件上傳解析器。
1:當(dāng)一個請求過來的時候,會調(diào)用DispatcherServlet類中的doDispatch(HttpServletRequest, HttpServletResponse)方法。
doDispatch方法體
protected void doDispatch(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpServletRequest processedRequest = request;
HandlerExecutionChain mappedHandler = null;
boolean multipartRequestParsed = false;
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
try {
ModelAndView mv = null;
Exception dispatchException = null;
try {
processedRequest = checkMultipart(request);
multipartRequestParsed = processedRequest != request;
// Determine handler for the current request.
mappedHandler = getHandler(processedRequest, false);
if (mappedHandler == null || mappedHandler.getHandler() == null) {
noHandlerFound(processedRequest, response);
return;
}
// Determine handler adapter for the current request.
HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());
// Process last-modified header, if supported by the handler.
String method = request.getMethod();
boolean isGet = "GET".equals(method);
if (isGet || "HEAD".equals(method)) {
long lastModified = ha.getLastModified(request, mappedHandler.getHandler());
if (logger.isDebugEnabled()) {
String requestUri = urlPathHelper.getRequestUri(request);
logger.debug("Last-Modified value for [" + requestUri + "] is: " + lastModified);
}
if (new ServletWebRequest(request, response).checkNotModified(lastModified) && isGet) {
return;
}
}
if (!mappedHandler.applyPreHandle(processedRequest, response)) {
return;
}
try {
// Actually invoke the handler.
mv = ha.handle(processedRequest, response, mappedHandler.getHandler());
}
finally {
if (asyncManager.isConcurrentHandlingStarted()) {
return;
}
}
applyDefaultViewName(request, mv);
mappedHandler.applyPostHandle(processedRequest, response, mv);
}
catch (Exception ex) {
dispatchException = ex;
}
processDispatchResult(processedRequest, response, mappedHandler, mv, dispatchException);
}
catch (Exception ex) {
triggerAfterCompletion(processedRequest, response, mappedHandler, ex);
}
catch (Error err) {
triggerAfterCompletionWithError(processedRequest, response, mappedHandler, err);
}
finally {
if (asyncManager.isConcurrentHandlingStarted()) {
// Instead of postHandle and afterCompletion
mappedHandler.applyAfterConcurrentHandlingStarted(processedRequest, response);
return;
}
// Clean up any resources used by a multipart request.
if (multipartRequestParsed) {
cleanupMultipart(processedRequest);
}
}
}
2:在doDispatch方法體中調(diào)用checkMultipart(request)方法判斷是否是文件上傳的請求,判斷是根據(jù)Content-type來的,如果是文件上傳的請求,在checkMultipart(request)方法中就會調(diào)用在CommonsMultipartResolver中的方法進(jìn)行文件解析(實際是調(diào)用apache commons-fileupload的文件長傳插件),解析完成后,其實文件已經(jīng)上傳到服務(wù)器本地磁盤了,請看下面的代碼片段。
protected HttpServletRequest checkMultipart(HttpServletRequest request) throws MultipartException {
if (this.multipartResolver != null && this.multipartResolver.isMultipart(request)) {
if (request instanceof MultipartHttpServletRequest) {
logger.debug("Request is already a MultipartHttpServletRequest - if not in a forward, " +
"this typically results from an additional MultipartFilter in web.xml");
}
else {
return this.multipartResolver.resolveMultipart(request);
}
}
// If not returned before: return original request.
return request;
}
在checkMultipart方法體中調(diào)用了CommonsMultipartResolver類的resolveMultipart方法去解析文件,該方法返回的是MultipartHttpServletRequest對象,該對象中存有已經(jīng)上傳的服務(wù)器本地的文件對象。
3:獲取具體處理器的方法(mv = ha.handle(processedRequest, response, mappedHandler.getHandler()) 這行代碼)。
如果是文件上傳的話,processedRequest是上面的checkMultipart方法返回的對象。
實際調(diào)用的org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter類的handle方法,該方法中獲取實際被調(diào)用的方法參數(shù)上有哪些注解,然后根據(jù)注解的一些配置,從processedRequest獲取對應(yīng)的值。
比如你上面的testUpload()方法。在AnnotationMethodHandlerAdapter的handle()的方法中會獲取testUpload()的方法參數(shù)有@RequestParam這個注解,然后解析這個注解,從processedRequest請求中獲取到desc的值,獲取到名為file的文件,最后調(diào)用testUploaad()方法。具體是怎么解析的可以看看org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(Method, Object, NativeWebRequest, ExtendedModelMap)這個方法體。
已經(jīng)解決了,原因是:CAS Server自帶的REST API,僅支持默認(rèn)UsernamePasswordCredential,我的項目中自定義擴展了UsernamePasswordCredential,所以需要在自定義驗證Handler中做個判斷,如果請求的Credential類型為org.apereo.cas.authentication.UsernamePasswordCredential, 就是REST請求來的,直接返回對應(yīng)的UsernamePasswordCredential對象即可。
經(jīng)過1天的奮戰(zhàn),看了很多springboot項目,終于找到原因;
maven配置問題;
錯誤配置如下:
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
正確配置為
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>compile</scope>
</dependency>
附上maven.scope的用法;
maven.scope的用法
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
如果是抽樣的話,那就可以用隨機數(shù)了吧。
使用@RequestBody
@PostMapping("xxx")
public xxx method(@RequestBody String a) {}cgi了解一下,只要是可執(zhí)行程序都可以
謝邀,從左邊開始
merge :就是git的合并代碼。遠(yuǎn)程代碼在你push之前已經(jīng)被修改了。就需要先merge。如果沒有沖突,就自動合并修改,否則需要逐一合并
rebase:拉下來的代碼有沖突,但是不會自動合并。需要你手動合并
第三個branch default我沒用過了
using stash:在更新前先清除stash
第二個沒用過。
$re = '/"body":"([^"]+)".*"transTime":"([^"]+)"/';
$str = '{"returnCode":"0","resultCode":"0","sign":"19333CD7F9710A104DA5D815709697D2","outChannelNo":"2017120100401000000017","status":"02","mchId":"000000010000000002","channel":"wxPubQR","body":"收單支付","outTradeNo":"20171201150337579753","amount":0.01,"transTime":"20171201150337"}';
if (preg_match($re, $str, $matches)) {
echo $matches[1] . "\n";
echo $matches[2] . "\n";
}
[^【]+(?=】)|^[^【】]+$$html = '<p>文章內(nèi)容
<img src="/images/nerong.jpg">
<img src="http://www.xxx.com/images/nerong.jpg">
<img src="/images/pic/nerong.jpg">
<img src="/file/pic/nerong.jpg">
文章測試內(nèi)容</p>';
$html = str_replace('src="/','src="http://www.xxx.com/',$html);刪除的時候重新遍歷一下,把序號改過來
可以把序號和數(shù)據(jù)分開,刪除任意一條數(shù)據(jù)刪除最下面一個序號即可,這樣可以減少重新渲染的數(shù)量
$(document).ready(function () {
var $texta = $('#my-textarea');
var lastWidth = localStorage.getItem("my-area-width");
var lastHeight = localStorage.getItem("my-area-height");
if(lastWidth && lastHeight) {
$texta.css("width",lastWidth+"px");
$texta.css("height",lastHeight+"px");
}
$texta.data('x', $texta.outerWidth());
$texta.data('y', $texta.outerHeight());
$texta.mouseup(function () {
var $this = $(this);
var width = $this.outerWidth();
var height = $this.outerHeight();
if (width != $this.data('x') || height != $this.data('y')) {
alert(width + ' - ' + $this.data('x') + '\n' + height + ' - ' + $this.data('y'));
localStorage.setItem("my-area-width",width);
localStorage.setItem("my-area-height",height);
}
$this.data('x', width);
$this.data('y', height);
});
});ArrayAdapter requires the resource ID to be a TextView,你請求的是adapter用的資源id應(yīng)該是一個textView控件的id。根據(jù)你寫的adapter繼承的ArrayAdapter的的構(gòu)造函數(shù)看,他需要傳的是一個textview控件的資源id而不是一個布局的資源id
可以采用在訪問方法時就對參數(shù)進(jìn)行校驗,采用自定義注解的形式,通過自定義注解的相應(yīng)的aop去寫邏輯進(jìn)行校驗。
上傳文件你可以分塊啊 用plupload 前端控制進(jìn)度 下次打開頁面可以重新繼續(xù)上傳
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國制造2025”,實現(xiàn)中華民族偉大復(fù)興的升級產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗,技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。