小编Nik*_*Dim的帖子

循环访问Mac终端中的文件

我正在尝试编写一个简单的循环,它将循环遍历当前目录的文件并只打印文件名.

我试过了:

#!/bin/bash    
FILES=/Users/nick/Desktop/*.jpg
    for f in $FILES
    do
        echo $f
    done
Run Code Online (Sandbox Code Playgroud)

但它不起作用.运行./script它只是打印"/Users/nick/Desktop/*.jpg".没有错误

我在MacBook Pro 10.10.4上运行它

谢谢

unix macos bash

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

如何使用CXF为JAX-RS客户端设置超时

我正在使用Rest Client,我正在使用CXFJAX-RS.

我遇到的问题是我找不到任何方法来覆盖客户端的默认超时值.

一个简单的客户:

Client client = ClientBuilder.newClient();
WebTarget target = client.target("http://localhost:8080/MyApp");
target = target.path("jsp/Test.jsp");
Response response = target.request().get();
Run Code Online (Sandbox Code Playgroud)

我已经读过CXF中有两个超时属性被调用ReceiveTimeout,ConnectionTimeout但我还没有找到一种方法在我的客户端中设置它们.

我试过client.property("ReceiveTimeout", 5000);但它不起作用.

我已经看到了使用xml配置文件配置客户端的示例,但如果可能,我不想采用该路径.

有任何想法吗?

java rest web-services cxf httpclient

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

OSGi Karaf Spring Boot 2.1.4-发布错误

我正在尝试使用 Spring Boot 2.1.4 和 Java 8、OSGi 版本 5.0.0 和 Apache Karaf 4.1.3 构建 OSGi Karaf 应用程序。

我在 GitHub 中创建了以下项目,当我使用 Spring Boot 1.5.9 时,该项目构建并运行良好。

但是当我将 Spring boot 版本从 1.5.9-RELEASE 更改为 2.1.4-RELEASE 并尝试执行此操作mvn clean install时,我从 maven-bundle-plugin 收到以下错误

[WARNING] Bundle com.nemesis:osgi-spring-boot-demo-bundle:bundle:0.0.1-SNAPSHOT : Export com.nemesis.osgi.springboot,  has 4,  private references [com.nemesis.osgi.springboot.controller, org.springframework.context.annotation, org.springframework.boot, org.springframework.boot.autoconfigure], 
[ERROR] Bundle com.nemesis:osgi-spring-boot-demo-bundle:bundle:0.0.1-SNAPSHOT : Exception: java.lang.ArrayIndexOutOfBoundsException: 19
[ERROR] Bundle com.nemesis:osgi-spring-boot-demo-bundle:bundle:0.0.1-SNAPSHOT : Invalid class file META-INF/versions/9/module-info.class (java.lang.ArrayIndexOutOfBoundsException: 19)
[ERROR] Bundle com.nemesis:osgi-spring-boot-demo-bundle:bundle:0.0.1-SNAPSHOT : Classes found in the wrong directory: …
Run Code Online (Sandbox Code Playgroud)

osgi apache-karaf maven-bundle-plugin osgi-bundle spring-boot

5
推荐指数
1
解决办法
1025
查看次数

将x和y设置为0时为什么svg文本会消失?

我刚刚开始阅读svg,我提出了以下问题

我正在创建一个简单svgtext内部,如下所示.

从我的阅读我了解,xy对的text标记声明中的文本的位置svg空间.

为什么当我设置都xy0文本不会出现,当我改变x,并y10例如,它显示?是不是x=0y=0这意味着SVG标签的左上角?

谢谢

<svg width="200" height="100">
   <text x="0" y="0">hello</text>
</svg>
Run Code Online (Sandbox Code Playgroud)

html javascript w3c svg

4
推荐指数
1
解决办法
978
查看次数

注入@Context时,FIQL SearchContext会抛出NullPointerException

我想实现用一个简单的REST服务FIQL但我的代码抛出NullPointerException在哪里注入点SearchContext@Context.这是我的代码

我的服务类:

import java.util.*;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import org.apache.cxf.jaxrs.ext.search.SearchCondition;
import org.apache.cxf.jaxrs.ext.search.SearchContext;

@Path("/search")
public class Books {

    private List<Book> theBooks = new LinkedList<Book>();

    @Path("/book")
    @GET
    @Produces(MediaType.APPLICATION_XML)
    public List<Book> getBook(@Context SearchContext searchContext) {

        theBooks.add(new Book("1", "nick1"));
        theBooks.add(new Book("2", "nick2"));
        theBooks.add(new Book("3", "nick3"));
        theBooks.add(new Book("4", "nick4"));
        theBooks.add(new Book("5", "nick5"));

        SearchCondition<Book> condition = searchContext
                .getCondition(Book.class);

        return condition.findAll(theBooks);
    }
}
Run Code Online (Sandbox Code Playgroud)

我的书课

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Book {

    private String …
Run Code Online (Sandbox Code Playgroud)

cxf jax-rs

3
推荐指数
1
解决办法
850
查看次数

Karaf OSGi 配置抛出 ResolutionException:无法解析 root:缺少要求 [root] osgi.identity;

我正在创建一个将在 Karaf 上运行的 Spring Boot 应用程序。我试图在 Karaf 中公开项目配置属性,以便能够使用 config:property-set 更改属性,而无需重新部署应用程序。

因此,我已成功配置我的 karaf 功能以将属性公开给 Karaf,但我正在尝试创建一个 OSGi 组件,以便能够在使用 config:property-set 更改属性时获取更新。

我在尝试安装 .kar 文件时遇到的错误如下:

[[A2019-05-19T23:09:32,926 | INFO  | pipe-kar:install file:/Users/nikos/development/interlink/thirdParty/osgi-karaf-spring-boot-demo/osgi-spring-boot-demo-features/target/osgi-spring-boot-demo-features-0.0.1-SNAPSHOT.kar | KarServiceImpl                   | 35 - org.apache.karaf.kar.core - 4.1.3 | Added feature repository 'mvn:com.nemesis/osgi-spring-boot-demo-features/0.0.1-SNAPSHOT/xml/features'
2019-05-19T23:09:32,927 | INFO  | pipe-kar:install file:/Users/nikos/development/interlink/thirdParty/osgi-karaf-spring-boot-demo/osgi-spring-boot-demo-features/target/osgi-spring-boot-demo-features-0.0.1-SNAPSHOT.kar | FeaturesServiceImpl              | 9 - org.apache.karaf.features.core - 4.1.3 | Adding features: osgi-spring-boot-demo-feature/[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]
2019-05-19T23:09:32,995 | WARN  | pipe-kar:install file:/Users/nikos/development/interlink/thirdParty/osgi-karaf-spring-boot-demo/osgi-spring-boot-demo-features/target/osgi-spring-boot-demo-features-0.0.1-SNAPSHOT.kar | KarServiceImpl                   | 35 - org.apache.karaf.kar.core - 4.1.3 | Unable to install Kar feature osgi-spring-boot-demo-feature/0.0.1.SNAPSHOT
org.osgi.service.resolver.ResolutionException: …
Run Code Online (Sandbox Code Playgroud)

java osgi apache-karaf osgi-bundle karaf-maven-plugin

2
推荐指数
1
解决办法
9297
查看次数