我已经读过java EE6中的web.xml是可选的.所以没有web.xml,我如何告诉应用服务器使用Jersey作为JAX-RS规范的实现?
我有一个columnHeader包含两个框架的乐队。
如果参数为TRUE,则第一帧必须可见;如果参数为,则第二帧必须可见FALSE。
所以我只想显示一帧。
我已经连续放了两帧。可见性还可以,但是当我显示第一帧时,它和明细带之间仍留有空白(因为第二帧已隐藏但占据了空间)。
如何删除该空间?
我是 OSGi 的新手,正在尝试使用 OSGi 开发应用程序。我有一个 OSGi 服务,它有一个接口和两个实现。
界面: ExportService
实现:ExcelExportServiceImpl,PdfExportServiceImpl
ExportService是我的接口ExcelExportServiceImpl,PdfExportServiceImpl是ExportService.
我想ExcelExportServiceImpl和PdfExportServiceImpl作为两种不同的服务。
从我的应用程序包中,如果我想使用 excel 导出,我应该能够在ExcelExportServiceImpl不涉及PdfExportServiceImpl.
如何注册两个具有相同接口的不同服务?
@Override
public void start(BundleContext context) throws Exception {
context.registerService(ExportService.class.getName(), new ExcelExportServiceImpl(), null);
context.registerService(ExportService.class.getName(), new PdfExportServiceImpl(), null);
}
}
Run Code Online (Sandbox Code Playgroud)
现在,我在我的激活器中想出了上面的代码,它似乎不起作用,因为这两个服务都ExportService.class.getName()作为类名。如何使用一个接口在同一个 bundle 中实现两个不同的服务?
更新/解决方案:
我在我的服务包的激活器中更改了如下代码,
@Override
public void start(BundleContext context) throws Exception {
Hashtable excelProperty = new Hashtable();
excelProperty.put("type", "excel");
excelServiceRegistration = context.registerService(ExportService.class.getName(), new ExcelExportServiceImpl(), excelProperty); …Run Code Online (Sandbox Code Playgroud) class test {
public static void main(String[] args){
Object o1 = new Object();
Object o2 = new Object();
System.out.println(o1==o2 + " " + o1.equals(o2));
}
}
Run Code Online (Sandbox Code Playgroud)
我明白了为什么这两个o1==o2和o1.equals(o2)的false,但为什么它只是打印出来 "false",而不是"false false"?
我是 Java/ Karaf 4.0.9/ Maven/ Pom/ Camel 的新手,我无法解决这个问题
文件中的Json部分pom.xml,这里我改了很多Json版本,但没有用。
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20151123</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这里我附上了我的Pom.xml文件,我用谷歌搜索了一下。在 GSON 中遇到同样的问题,但我不知道如何解决 felix 中的问题。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>PaxelESBNotification</groupId>
<artifactId>PaxelESBNotification</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>A Camel Blueprint Route</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<!-- Camel BOM -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
<version>2.16.5</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Camel -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-rabbitmq</artifactId>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20151123</version>
</dependency> …Run Code Online (Sandbox Code Playgroud) 在下面的代码中,除了在第一个示例中,我们需要导入productsModule到文件中,这两种延迟加载路由的方式有什么区别?
{ path: 'products', loadchildren: () => productsModule }
Run Code Online (Sandbox Code Playgroud)
对比
{ path: 'products', loadchildren: 'app/products/products.module#ProductsModule' }
Run Code Online (Sandbox Code Playgroud) 我的Angular 5项目在没有问题的情况下工作,将其更新到版本6之后,ng build由于下一个项目而停止使用:
./src/app/assets/i18/en.json中的错误模块解析失败:JSON在位置0处出现意外令牌您可能需要适当的加载程序来处理此文件类型。
这是我的json文件:
{
"app": {
"Welcome": "Welcome",
"New": "New"
},
"mainMenu": {
"Home": "Home",
"Logout": "Logout"
},
"pageHeader": {
"About": "About",
"Settings": "Settings"
}
}
Run Code Online (Sandbox Code Playgroud)
Web上的大多数解决方案都在谈论CopyWebpackPlugin,但是该项目不使用任何Webpack配置文件。
然后,通过此链接,我尝试将json作为数组:
{
"menu":[
"app": {
"Welcome": "Welcome",
"New": "New"
},
"mainMenu": {
"Home": "Home",
"Logout": "Logout"
},
"pageHeader": {
"About": "About",
"Settings": "Settings"
}
]
}
Run Code Online (Sandbox Code Playgroud)
但是,尽管文件包含16行,却出现了以下错误。
意外的令牌:在JSON中的位置24
任何的想法 ?
[{name: "mode", value: "1"},{name: "group", value: ""},{name: "from_date", value: ""},{name: "to_date", value: "2018-10-16"},{name: "action", value: "ac_filter_transactions"}
Run Code Online (Sandbox Code Playgroud)
这就是我的数组的样子.我想从数组中删除名称和值对,如果它value是空的.
我试过这个解决方案:但是这没用
formData.map((i) => {
(i.value == "") ? delete i: "";
});
Run Code Online (Sandbox Code Playgroud)
我知道这是一个简单的问题,但我找不到任何相关的例子来解决这个问题.我发现的所有示例和解决方案都是针对这种类型的对象
let obj = {"firstname": "XYZ", "lastname": "ABC"}
Run Code Online (Sandbox Code Playgroud)
两个对象有什么区别?
我需要将请求URL作为String参数提交给方法
@RequestMapping(value = "/test", method = RequestMethod.POST)
public void testItt(@RequestParam String requestParameter, @RequestURL String requestUrl) {
// Do something with requestUrl
}
Run Code Online (Sandbox Code Playgroud)
如何正确提交请求URL?
我试过了
@RequestMapping(value = "/test", method = RequestMethod.POST)
public void testItt(@RequestParam String requestParameter, @RequestURL String requestUrl) {
// Do something with requestUrl
}
Run Code Online (Sandbox Code Playgroud)
但我觉得必须有更好的方法
我工作的Java二叉搜索树,我试图使用这种方法findHelp()在find().我期待一个返回值rt.getValue()(这是C2-112,因为我在返回之前打印出来),但是findHelp()在帮助方法中打印输出null.
我在网上找不到类似的错误,所以有人可以帮我搞清楚,或者给出类似问题的链接吗?
这是我的代码
private E findHelp(BinaryNode<Key, E> rt, Key k) {
int compare = k.compareTo(rt.getKey());
if (compare==0) {
System.out.println(rt.getValue()); // I'm getting C2-112 here
return rt.getValue(); // so I expect a return of C2-112
} else if (compare >0 ) {
if (rt.getRight() == null) {
return null;
} else {
findHelp(rt.getRight(), k);
}
} else {
if (rt.getLeft() == null) {
return null;
} else {
findHelp(rt.getLeft(), …Run Code Online (Sandbox Code Playgroud) java ×5
angular ×2
osgi ×2
apache-felix ×1
apache-karaf ×1
arrays ×1
binary-tree ×1
class ×1
equals ×1
java-ee ×1
javascript ×1
jax-rs ×1
json ×1
lazy-loading ×1
maven ×1
methods ×1
object ×1
osgi-bundle ×1
return ×1
routes ×1
service ×1
spring ×1
spring-boot ×1
web-services ×1
webpack ×1