日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java http 401_401 API请求状态错误

發(fā)布時(shí)間:2023/12/16 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java http 401_401 API请求状态错误 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

當(dāng)我試圖實(shí)現(xiàn)只顯示一條消息的簡單web服務(wù)時(shí),總是會遇到這個(gè)錯(cuò)誤(angular5+springboot)

狀態(tài):401,狀態(tài)文本:“確定”,網(wǎng)址:80/本地主機(jī):你好“;,確定:

錯(cuò)誤,}錯(cuò)誤:“。。。標(biāo)題:HttpHeaders

{normalizedNames:Map(0),lazyUpdate:null,lazyInit:}消息:

錯(cuò)誤狀態(tài):“http401”狀態(tài)確定“文本:

"80/本地主機(jī):你好";

控制器.java:

@GetMapping("/hello")

public String sayhello(){ return "{\"message\": \"Hello, world!\"}";}

}

你好.component.ts:

import { Component, OnInit } from '@angular/core';

import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http';

import { Observable } from 'rxjs/Rx';

import { Adresse } from '../shared/adresse';

@Component({

selector: 'app-forgot', templateUrl: './forgot.component.html',

styleUrls: ['./forgot.component.css']

})

export class ForgotComponent implements OnInit {

message: string;

ip: string = Adresse.ip;

constructor(private http: HttpClient) { }

ngOnInit(): void {

this.http.get(this.ip + '/hello').subscribe(data => {

console.log('DATA', data);

this.message = data['message'];

})

}

}

總結(jié)

以上是生活随笔為你收集整理的java http 401_401 API请求状态错误的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。