小编kun*_*gcc的帖子

ImageMagick:缩放具有最大文件大小的JPEG图像

我有一些JPEG图片,我想缩小.另一个要求是文件大小不应大于300kByte.

这是可能的,请帮我一个例子=)

imagemagick

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

Eclipselink 2.5使用Maven生成元模型

我想知道如何使用Maven和Eclipselink 2.5生成静态元模型.通过在运行Eclipselink 2.4时将这些行添加到pom.xml,它运行良好.

// Generate meta model for eclipselink 2.4 (does not work for 2.5)
    <plugin>
                    <groupId>org.bsc.maven</groupId>
                    <artifactId>maven-processor-plugin</artifactId>
                    <version>1.3.1</version>
                    <executions>
                        <execution>
                            <id>process</id>
                            <goals>
                                <goal>process</goal>
                            </goals>
                            <phase>generate-sources</phase>
                            <configuration>
                                <compilerArguments>-Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml</compilerArguments>
                                <processors>
                                    <processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
                                </processors>
                                <outputDirectory>${project.build.directory}/generated-sources/meta-model</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
Run Code Online (Sandbox Code Playgroud)

但似乎自2.4以来出现了一些变化,因为我得到了以下错误:

[INFO] javac option: -proc:only
[INFO] javac option: -Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml
[INFO] javac option: -processor
[INFO] javac option: org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
[INFO] javac option: -s
[INFO] javac option: /home/asdf/target/generated-sources/meta-model
[INFO] diagnostic error: Annotation processor 'org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor' not found
[INFO] diagnostic warning: Annotation processing without compilation requested but no processors …
Run Code Online (Sandbox Code Playgroud)

jpa eclipselink maven

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

Hibernate活动事务

在我的服务类中,我希望有类似的东西:

class ClientService {

  // Authorize
  // Returns true: Authorization successful
  // Returns false: Authorization failed
  public boolean authorize(String id, String password) {

  //Here I would like to check if an active transaction exists. 
  //If it exists, use that one, else create a new session and start 
  //a new transaction.
  //For example:
  Session session = HibernateUtil.getSessionFactory().getCurrentSession();
  if(!session.SOMEMETHOD_CHECK_IF_TRANSACTION_IS_ACTIVE) {
    session.beginTransaction();
  }

  Client client = clientDAO.get(id);

  if (client != null) {
    if (client.getPassword().equals(password)) {
      logger.debug("Authorization successful. ID: " + client.getId() + ", …
Run Code Online (Sandbox Code Playgroud)

hibernate

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

一个输入的多个验证器

在JSF 2.0中是否可以为一个输入提供多个验证器?例如,假设我将写一个用户名,用户名必须包含8个字符.如果确定,则检查数据库中是否存在用户名.

<ice:inputText id="username" value="#{createClient.username}" maxlength="15">
  <-- something like this -->
  <f:validator validatorId="usernameValidator" validatorId="usernameExistValidator" />
</ice:inputText> 
<ice:message for="username" />
Run Code Online (Sandbox Code Playgroud)

validation jsf jsf-2

6
推荐指数
1
解决办法
8193
查看次数

JSF 2.0在bean(或页面?)之间传递数据

我正在使用JSF 2.0

我的管理部分中有一个表单,我将在列表中选择一些用户.

表单(selectusers.xhtml)将这些用户添加到bean中的列表(SelectUsers.java).

在我选择了一些用户之后,我会将用户列表从SelectUsers.java传递到另一个bean(AddAddressBean.java)并继续以另一种形式添加信息(addadress.xhtml),其中设置了其他相关的属性为每个用户添加AddAddressBean.

我不知道如何实现它.我想AddAddressBean.java应该是独立的(所以我可以将它与其他bean一起使用),所以我更喜欢AddAddressBean.java不知道其他bean.

你能帮我么?=)

BR卡尔

jsf-2

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

Eclipselink元模型生成在Maven多模块项目中失败

我的Maven项目已经增长,所以我决定尝试制作一个Maven多模块项目.

我认为它似乎工作正常,除了Eclipselink元模型类生成.

这是运行时的输出,mvn clean generate-sources这是预期的:

[INFO] javac option: -proc:only
[INFO] javac option: -Aeclipselink.persistencexml=/home/glassfish/git/vehiclecms/vehiclecms-parent/vehiclecms-backend/src/main/resources/META-INF/persistence.xml
                                                                -Aeclipselink.persistenceunits=carcmsPU
                                                                -Aeclipselink.canonicalmodel.subpackage=metamodel
[INFO] javac option: -processor
[INFO] javac option: org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
[INFO] javac option: -d
[INFO] javac option: /home/glassfish/git/vehiclecms/vehiclecms-parent/vehiclecms-backend/target/classes
[INFO] javac option: -s
[INFO] javac option: /home/glassfish/git/vehiclecms/vehiclecms-parent/vehiclecms-backend/target/generated-sources
[INFO] diagnostic warning: Supported source version 'RELEASE_6' from annotation processor 'org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor' less than -source '1.7'
[INFO] diagnostic Note: Creating static metadata factory ...
[INFO] diagnostic Note: Found Option : eclipselink.persistencexml, with value: /home/glassfish/git/vehiclecms/vehiclecms-parent/vehiclecms-backend/src/main/resources/META-INF/persistence.xml
                                                                -Aeclipselink.persistenceunits=carcmsPU
                                                                -Aeclipselink.canonicalmodel.subpackage=metamodel
[INFO] diagnostic Note: The …
Run Code Online (Sandbox Code Playgroud)

jpa eclipselink maven jpa-2.0

5
推荐指数
0
解决办法
1623
查看次数

使用nginx反向代理部署K8S时ABP框架HttpApi.Host失败

我已经将ABP框架部署在Kubernetes集群中。

存在以下部署:

  • 雷迪斯
  • MSSql
  • 认证服务器
  • HttpApi.Host
  • Nginx 入口/反向代理带有 https 终止,集群内没有加密。

因此,AuthServer、HttpApi.Host 正在侦听端口 80 / http,而 nginx 正在侦听 https。配置/Helm 值如下:

use-forwarded-headers: "true"
use-proxy-protocol: "true"
use-gzip: "true"
Run Code Online (Sandbox Code Playgroud)

到目前为止一切顺利,部署后我可以进入 Swagger 并授权: 在此输入图像描述

通过检查 AuthServer 日志可以确认这一点:

[19:12:39 INF] CORS policy execution successful.
[19:12:39 INF] The request URI matched a server endpoint: Token.
[19:12:39 INF] The token request was successfully extracted: {
  "grant_type": "authorization_code",
  "code": "[redacted]",
  "client_id": "foobar_Swagger",
  "redirect_uri": "https://api.staging.foobar.io/swagger/oauth2-redirect.html"
}.
[19:12:39 INF] The token request was successfully validated.
Run Code Online (Sandbox Code Playgroud)

但是,现在我想使用 Swagger 来确保与端点的连接正常工作,因此我尝试第一个 GET 端点: 在此输入图像描述

如您所见,有 500 …

kubernetes openiddict nginx-reverse-proxy abp

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

请求的资源()不可用.(在下载JSF 2.0项目后运行Tomcat 7.0时)

我在eclipse 3.6中创建了一个新的Dynamic Web Project.

我添加了一个Tomcat 7.0服务器,并在jsf文件中选择"Run on server".工作正常!

我将它添加到SVN存储库以与其他人共享.

我关闭了Eclipse.

我创建了一个新的工作空间来检查一切是否正常工作.签出与上面相同的项目.

我添加了一个Tomcat 7.0服务器,并在与以前相同的文件中选择"在服务器上运行".这导致404:"HTTP状态404 .... - 描述所请求的资源()不可用."

这是为什么??这真奇怪!你不觉得吗?你能帮我么?

最好的祝福

eclipse svn tomcat

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

枚举列表与布尔类的列表

现在,我有一个有字段的课.

@Entity
public class Fuel {

    @Id @GeneratedValue
    private Long id;

    private boolean diesel;
    private boolean gasoline;
    private boolean etanhol;
    private boolean cng;
    private boolean electric;

    public Fuel() {
        // this form used by Hibernate
    }

    public List<String> getDeclaredFields() {
        List<String> fieldList = new ArrayList<String>();

        for(Field field : Fuel.class.getDeclaredFields()){
            if(!field.getName().contains("_") && !field.getName().equals("id") && !field.getName().equals("serialVersionUID") ) {
                fieldList.add(field.getName());

            }
            Collections.sort(fieldList);
        }
        return fieldList;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public …
Run Code Online (Sandbox Code Playgroud)

java

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

使用 JPA Criteria API 查询 Enum 的 ElementCollection

我正在为汽车经销商开发 Web 应用程序。我有一个包含一组安全枚举的字段的 Car 类。

public class Car {
    @Id
    @GeneratedValue
    private Long id;

    @NotNull(message = "{year}")
    @Min(value = 1950)
    @Max(value = 2020)
    @Column(nullable = false)
    private int year;

    @NotNull()
    @Column(nullable = false)
    private String make;

    @NotNull()
    @Column(nullable = false)
    private String model;

    @NotNull()
    @Min(value = 0)
    @Max(value = 1000000)
    @Column(nullable = false)
    private int kilometres;

    @Column(nullable = false)
    private int price;


    @NotNull()
    @Enumerated(EnumType.STRING)
    private Gearbox gearbox;

    @ElementCollection(fetch = FetchType.EAGER)
    @Enumerated(EnumType.STRING)
    @CollectionTable(name="SECURITY")
    @Column(name="TYPE")
    private Set<Security> securityList = new HashSet<Security>();

    @NotNull() …
Run Code Online (Sandbox Code Playgroud)

java jpa criteria-api jpa-2.0

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