我在 Spring Boot 项目上使用 Spring security,并且我尝试使用我的控制器的端点,但是当我从我的 js 进行调用时,我收到错误:403 forbidden。
我的安全配置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/resources/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login/")
.defaultSuccessUrl("/inicio/")
.usernameParameter("username").passwordParameter("password")
.permitAll()
.and()
.logout().logoutSuccessUrl("/login/")
.permitAll();
}
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(new BCryptPasswordEncoder());
}
Run Code Online (Sandbox Code Playgroud)
我的控制器端点:
@RequestMapping( value="/getUsuarios")
@ResponseBody
public UsuarioTo getUsuarios( Model model) throws Exception {
UsuarioTo to = getTo();
try
{
to.setListaUsuario(usuarioRepository.findAll());
}catch (Exception e)
{
throw new Exception("Error al obtener los usuarios "+e.getMessage() );
}
return to; …Run Code Online (Sandbox Code Playgroud) 我有一个这样的位置数据地图:
{
'country': 'Japan',
'city': 'Tokyo',
'Latitude': 35.6762,
'Longitude': 139.6503,
'utcOffset': 9
}
Run Code Online (Sandbox Code Playgroud)
女巫是存储这些数据的正确解决方案,为什么?
1)地图列表:
List<Map<String, dynamic>> locations = [
{
'country': 'Japan',
'city': 'Tokyo',
'Latitude': 35.6762,
'Longitude': 139.6503,
'utcOffset': 9
}
];
Run Code Online (Sandbox Code Playgroud)
或多级数据对象
var locations = {
{
'country': 'Egypt',
'city': 'Cairo',
'Latitude': 30.033333,
'Longitude': 31.233334,
'utcOffset': 2
},
{
'country': 'Thailand',
'city': 'Bangkok',
'Latitude': 13.7563,
'Longitude': 100.5018,
'utcOffset': 7
},
};
Run Code Online (Sandbox Code Playgroud)
以及如何访问这两种情况下的数据?
这是我的模型课:
class Contact {
String name;
String email;
int phoneNo;
Contact(this.name, this.email, this.phoneNo);
}
Run Code Online (Sandbox Code Playgroud)
假设我有如下的联系人列表:
List<Contact> contacts = [
new Contact('John', 'john@c.com', 002100),
new Contact('Lily', 'lily@c.com', 083924),
new Contact('Abby', 'abby@c.com', 103385),
];
Run Code Online (Sandbox Code Playgroud)
我想从获取John电话号码contacts List,该怎么办?
我可以使用 PHP 执行此操作的方法很少,但是我找不到使用 Laravel 特定方式执行此操作的方法。
我有一个时间来自以下格式的数据库: Y:M:s
前任: 05:15:00
这就是我想要做的:
将30 分钟添加到该日期,根据上面的示例结果应该是:05:45:00
以下是我当前的代码,我想将 30 分钟添加到$endTime:
//get database value according to selected date
$allocatedDateQuery = DB::table('appointments')->where('date', $request->date)->get();
//loop throug every record to get time
foreach ($allocatedDateQuery as $value) {
$time = $value->time;
$endTime = $time;
}
Run Code Online (Sandbox Code Playgroud) I'm trying to parse the string "78,74"(which is a valid number in Brazil's format) to double, but I'm getting Format Exception and I can't find any way to parse it... Already searched in intl docs but there's nothing helpful.
I don't want to replace the "," with "." because i think that it must be a way to parse it using CultureInfo
My code is like
String x = "78,74";
double d = double.tryParse(x)
Run Code Online (Sandbox Code Playgroud) 代码截图和结果:
嗨,我有StatelessWidget已经Container在它的构建方法返回与Text小部件的子部件。但它的外观和感觉并不像预期的那样。为什么是yellow下划线,如何删除它?
我试着更换Container用Stack,Column并Row没有什么变化。
我试图用iterator一会儿迭代列表,由于某种原因,它会无限循环。
这是代码
{
List<Person> Person1 = new ArrayList<Person>();
Person p1 = new Person("Name1", "Virginia");
Person1.add(new Person("Nae2", "Virginia"));
printerlist(Person1);
printerlist(p1);
}
private static void printerlist(List<Person> p) {
/*
* print the list
*/
while (p.iterator().hasNext()) {
System.out.println(p.iterator().next().getCity());
}
}
Run Code Online (Sandbox Code Playgroud) ......小于或等于另一个数字?
例如,
a = [2, 5, 6, 9]
b = 3
Run Code Online (Sandbox Code Playgroud)
如何在列表中获得小于或等于3的数字a?