小编Nuñ*_*ada的帖子

OpenLayers:从服务器获取 Map、View、TileLayer 和 OSM

我是 OpenLayers(一个开源 JavaScript 库,用于在 Web 浏览器中将地图数据显示为滑动地图)的新手。我将它与 Thymeleaf(一个 Java XML/XHTML/HTML5 模板引擎,可以在 Web 和非 Web 环境中工作)一起使用。

我正在尝试重现此示例,但从服务器获取资源https://openlayers.org/en/latest/examples/reprojection-wgs84.html

我有这个页面:

<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.3.1/build/ol.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.3.1/css/ol.css">

    <style>
        .map {
            width: 100%;
            height:400px;
        }
    </style>
</head>
<body>

<div id="layout">


    <div id="main">

        <div class="content">
            <div class="pure-g">

                <div class="pure-u-1-1 pure-u-xl-10-24 pure-u-med-1">

                    <!-- Content right Wrap -->
                    <div class="content_r_wrap">

                        <!-- Devices Map Module -->
                        <div class="windowHead">
                            <h2>LOCATION INFO</h2>
                        </div>
                        <div class="windowContentMap">
                            <div id="map" class="map"></div>
                                <script th:inline="javascript" th:type="module">
                                  /*<![CDATA[*/
                                  import Map from …
Run Code Online (Sandbox Code Playgroud)

html javascript css openlayers thymeleaf

11
推荐指数
1
解决办法
334
查看次数

在XCode 6.2中禁用了"运行和构建"选项

我有一个项目,它工作正常,但突然我不能建立或运行,从菜单中禁用选项

在此输入图像描述

xcode6

10
推荐指数
1
解决办法
1822
查看次数

Activiti 6.0.0 UI 应用程序/tomcat9 中的内存 H2 数据库/java 版本“9.0.1”

我刚刚从 tomcat9 下载并部署了 activiti-app github.com/Activiti/Activiti/releases/download/activiti-6.0.0/\xe2\x80\xa6,但是在初始化应用程序时出现以下错误:

\n
  11:29:40,090 [http-nio-8080-exec-8] INFO  org.activiti.app.conf.AsyncConfiguration  - Creating Async Task Executor\n11:29:40,887 [http-nio-8080-exec-8] INFO  org.activiti.app.conf.DatabaseConfiguration  - Configuring Datasource\n11:29:40,910 [http-nio-8080-exec-8] INFO  org.activiti.app.conf.DatabaseConfiguration  - Configuring Datasource with following properties (omitted password for security)\n11:29:40,911 [http-nio-8080-exec-8] INFO  org.activiti.app.conf.DatabaseConfiguration  - datasource driver: org.h2.Driver\n11:29:40,911 [http-nio-8080-exec-8] INFO  org.activiti.app.conf.DatabaseConfiguration  - datasource url : jdbc:h2:mem:activiti;DB_CLOSE_DELAY=-1\n11:29:40,911 [http-nio-8080-exec-8] INFO  org.activiti.app.conf.DatabaseConfiguration  - datasource user name : sa\n11:29:40,911 [http-nio-8080-exec-8] INFO  org.activiti.app.conf.DatabaseConfiguration  - Min pool size | Max pool size | acquire increment : 10 | 100 | 5\n11:29:40,947 [http-nio-8080-exec-8] …
Run Code Online (Sandbox Code Playgroud)

spring alfresco h2 activiti tomcat9

10
推荐指数
1
解决办法
541
查看次数

在Spring Boot API上实现JWT身份验证

我有一个SpringBoot 2.0.2.RELEASE Web应用程序,带有这个配置文件:

@Override
protected void configure(HttpSecurity http) throws Exception {

    final List<String> activeProfiles = Arrays.asList(env.getActiveProfiles());
    if (activeProfiles.contains("dev")) {
        http.csrf().disable();
        http.headers().frameOptions().disable();
    }

    http
        .authorizeRequests()
        .antMatchers(publicMatchers()).permitAll()
        .anyRequest().authenticated()
        .and()
        .formLogin().loginPage("/login").defaultSuccessUrl("/bonanza/list")
        .failureUrl("/login?error").permitAll()
        .and()
        .logout().permitAll();
    }
Run Code Online (Sandbox Code Playgroud)

我想添加一个基于自定义JWT的安全过滤器,仅用于匹配的Rest控制器/rest/**,所以我将配置修改为此文件,但现在我无法登录到应用程序,因为我有一个HTTP状态401 -擅自

@Override
protected void configure(HttpSecurity http) throws Exception {

    final List<String> activeProfiles = Arrays.asList(env.getActiveProfiles());
    if (activeProfiles.contains("dev")) {
        http.csrf().disable();
        http.headers().frameOptions().disable();
    }

    http
       .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
       // don't create session
       .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
       .authorizeRequests()
       .antMatchers(publicMatchers()).permitAll()
       .anyRequest().authenticated()
       .and()
       .formLogin().loginPage("/login").defaultSuccessUrl("/bonanza/list")
                   .failureUrl("/login?error").permitAll()
       .and()
       .logout().permitAll();


       // Custom JWT based security filter
       JwtAuthorizationTokenFilter authenticationTokenFilter = …
Run Code Online (Sandbox Code Playgroud)

rest restful-authentication spring-security jwt spring-boot

9
推荐指数
1
解决办法
645
查看次数

OpenStreetMap:从地址获取坐标

OpenStreetMap中是否有任何函数可以让您从地址进行协调?

就像是

http://router.project-osrm.org/locate?request=GetGeocoding&nbaddresses=1&outputFormat=json&addresses_0=1240+Place+Jourdan+PARIS
Run Code Online (Sandbox Code Playgroud)

geolocation

8
推荐指数
1
解决办法
1万
查看次数

设置Windows变量以执行Java程序

我正在设置这个变量

set srcDir = C:\Developpement\Workspaces\Eclipse\MyAuthenticationProvider\src
Run Code Online (Sandbox Code Playgroud)

然后我执行这个程序

java -DMJF=MyAuthentication.jar -Dfiles=%srcDir% weblogic.management.commo.WebLogicMBeanMaker  
Run Code Online (Sandbox Code Playgroud)

但我有这个奇怪的错误

The specified input files directory, "%srcDir%", does not exist.
Run Code Online (Sandbox Code Playgroud)

我甚至尝试过使用

java -DMJF=MyAuthentication.jar -Dfiles=$srcDir weblogic.management.commo.WebLogicMBeanMaker
Run Code Online (Sandbox Code Playgroud)

结果相同

The specified input files directory, "$srcDir", does not exist.
Run Code Online (Sandbox Code Playgroud)

另一个测试:

C:\Developpement\Workspaces\Eclipse\WLAuthenticationProvider>set a=test

C:\Developpement\Workspaces\Eclipse\WLAuthenticationProvider>echo $a
$a

C:\Developpement\Workspaces\Eclipse\WLAuthenticationProvider>
Run Code Online (Sandbox Code Playgroud)

java command-prompt

8
推荐指数
1
解决办法
111
查看次数

输入类型="文本"中的Thymeleaf占位符

我有一个输入文本

<input type="text" id="usernameId"  name="username" placeholder="User" />
Run Code Online (Sandbox Code Playgroud)

我想从属性文件中替换1个文本的占位符用户的文本,但我不知道是否可能

<input type="text" id="usernameId"  name="username" placeholder="th:text="#{user.placeholder}""  />
Run Code Online (Sandbox Code Playgroud)

html thymeleaf

8
推荐指数
1
解决办法
7674
查看次数

Thymeleaf在替换中读取属性

我有这样的代码段,其中,TDK是我在SpringBoot文件中定义的通用变量application.properties命名server.contextPath

我想知道是否有办法替换它

<head th:replace="tdk/common/header :: common-header" />
Run Code Online (Sandbox Code Playgroud)

就像是

<head th:replace="@environment.get('server.contextPath')/common/header :: common-header" />
Run Code Online (Sandbox Code Playgroud)

我在用

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
    <version>1.5.3.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

<head th:replace="~{${@environment.getProperty('serverContextPath') + '/common/header'} :: common-header}" />
Run Code Online (Sandbox Code Playgroud)

结果如下:

org.thymeleaf.exceptions.TemplateInputException: Error resolving template "~{${@environment.getProperty('serverContextPath') + '/common/header'}", template might not exist or might not be accessible by any of the configured Template Resolvers (/tdk/registration/signup:6)
Run Code Online (Sandbox Code Playgroud)

thymeleaf spring-boot

8
推荐指数
1
解决办法
488
查看次数

数据表:日期/时间排序插件未订购

我有一个基本的SpringBoot应用程序.嵌入式Tomcat,Thymeleaf模板引擎我想订购数据表的1个日期列.

在我的POJO中:

public String getTimeFormatted() {
DateTimeFormatter formatter = 
            DateTimeFormatter.ofPattern("EEEE, MMMM d,yyyy h:mm,a", Locale.ENGLISH);
        LocalDateTime dateTime = LocalDateTime.ofEpochSecond(time, 0, ZoneOffset.UTC);      
        return dateTime.format(formatter);
    }
Run Code Online (Sandbox Code Playgroud)

在模板中:

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.15/sorting/datetime-moment.js"></script>

<script th:inline="javascript">
$(document).ready(function() {

    $.fn.dataTable.moment( 'EEEE, MMMM d,yyyy h:mm,a' );

    $('#table').dataTable( {  
        "bLengthChange": false,
        "pageLength": 25,
    }); 
} );
</script>
Run Code Online (Sandbox Code Playgroud)

但它没有正确排序 在此输入图像描述

datatable jquery datatables thymeleaf spring-boot

8
推荐指数
1
解决办法
1949
查看次数

Java 8:从文件夹/子文件夹中获取文件

我在SpringBoot应用程序的resources文件夹中有这个文件夹.

resources/files/a.txt
resources/files/b/b1.txt
resources/files/b/b2.txt
resources/files/c/c1.txt
resources/files/c/c2.txt
Run Code Online (Sandbox Code Playgroud)

我想得到所有的txt文件,所以这是我的代码:

   ClassLoader classLoader = this.getClass().getClassLoader();
   Path configFilePath = Paths.get(classLoader.getResource("files").toURI());   

   List<Path> atrackFileNames = Files.list(configFilePath)
                .filter(s -> s.toString().endsWith(".txt"))
                .map(Path::getFileName)
                .sorted()
                .collect(toList());
Run Code Online (Sandbox Code Playgroud)

但我只得到文件a.txt

java collections functional-programming stream java-8

8
推荐指数
2
解决办法
2万
查看次数