小编kli*_*ind的帖子

JBoss ShrinkWrap.从其他模块添加文件.

多模块项目.

在此输入图像描述

在我的ejb模块中,我有突出显示的文件.我想在Web模块中使用运行arquillian测试的相同文件.

在web模块的pom.xml文件中,我依赖于ejb模块,但提供了范围,因为我不希望从ejb模块获取"真正的"persistence.xml.

<dependency>
        <groupId>com.comp</groupId>
        <artifactId>g4tc-ejb</artifactId>
        <type>ejb</type>
        <!-- Use scope provided as we are creating an ear file, and we do not want the packaged jar file in test, as we want the test-persistence.xml -->
        <scope>provided</scope>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

所以在RestTest类中我想要包含ejb模块中的文件.

@Deployment
public static WebArchive getDeployment() {

    File[] files = Maven.resolver().loadPomFromFile("pom.xml")
            .importRuntimeAndTestDependencies().resolve().withTransitivity().asFile();

    WebArchive war = ShrinkWrap.create(WebArchive.class, "g4tcRestWebservice.war")
            .addAsLibraries(files)
            .addPackages(true, "com.comp.g4tc.web")
            .addPackages(true, "com.comp.g4tc.ejb") /* Load the classes from the ejb module instead of through dependency to avoid getting
                                                    the g4tc-ejb/src/java/resources/META-INF/persistence.xml, we want the one …
Run Code Online (Sandbox Code Playgroud)

jboss dependencies shrinkwrap

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

Codility:方括号确定给定的括号字符串是否正确嵌套

编码问题描述:

如果满足以下任一条件,则认为由N个字符组成的字符串S已正确嵌套:

S为空;S的形式为“(U)”或“ [U]”或“ {U}”,其中U是正确嵌套的字符串;S的形式为“ VW”,其中V和W是正确嵌套的字符串。例如,字符串“ {[()()]}”已正确嵌套,而“([]()]”则未正确嵌套。

编写一个函数:

类Solution {public int solution(String S); }

给定一个包含N个字符的字符串S,如果正确嵌套了S,则返回1,否则返回0。

例如,如上所述,给定S =“ {[(((((())]})”),该函数应返回1,给定S =“([]()]]”,该函数应返回0。

假使,假设:

N是[0..200,000]范围内的整数;字符串S仅由以下字符组成:“(”,“ {”,“ [”,“]”,“}”和/或“)”。复杂:

预期最坏情况下的时间复杂度为O(N);预期的最坏情况下的空间复杂度为O(N)(不计算输入参数所需的存储空间)。

我有87%的人似乎无法找出问题所在。

在此处输入图片说明

这是我的代码:

   // you can also use imports, for example:
// import java.util.*;
import java.util.Stack;
// you can use System.out.println for debugging purposes, e.g.
// System.out.println("this is a debug message");

class Solution {
   public int solution(String s) {

        if (s.length() % 2 != 0) {
            return 0;
        }

        Character openingBrace = new Character('{');
        Character openingBracket = …
Run Code Online (Sandbox Code Playgroud)

java stack brackets

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

JBoss Wildfly - 数据库登录模块

JBoss Wildfly 8.0.0-最终
JSF 2.2.4

首先,我使用application-users.properties和application-roles.properties创建了登录.使用add-user.bat添加了用户

在web.xml

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Admin Resource</web-resource-name>
        <url-pattern>/admin/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>admin</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>

<login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
        <form-login-page>/login.xhtml</form-login-page>
        <form-error-page>/error.xhtml</form-error-page>
    </form-login-config>
</login-config>

<security-role>
    <role-name>admin</role-name>
</security-role>
Run Code Online (Sandbox Code Playgroud)

Standalone.xml

<login-module code="Remoting" flag="optional">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
<login-module code="RealmDirect" flag="required">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
Run Code Online (Sandbox Code Playgroud)

login.xhtml

    <?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:p="http://primefaces.org/ui">
    <div class="center">
        <form method="POST" action="j_security_check" id="">
            <h:panelGrid id="panel" columns="2" border="1" cellpadding="4" cellspacing="4">
                <h:outputLabel for="j_username" value="Username:" />
                <input type="text" name="j_username" />
                <h:outputLabel for="j_password" value="Password:" />
                <input …
Run Code Online (Sandbox Code Playgroud)

jboss login wildfly

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

postgres sql 选择两列的组合

用户可以选择选项组合列表,然后搜索它们。

sql 可能看起来像这样。

select * from p where (option_type = 'X' and value = 'A') 
or (option_type = 'X' and value = 'B')
or (option_type = 'Y' and value = 'D')
Run Code Online (Sandbox Code Playgroud)

但当然我不想有 n 个 or 的

一个好的 sql 看起来如何执行???用户可以选择多种选项组合。

谢谢。

sql

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

标签 统计

jboss ×2

brackets ×1

dependencies ×1

java ×1

login ×1

shrinkwrap ×1

sql ×1

stack ×1

wildfly ×1