Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource name composition #923

Open
andvisk opened this issue Nov 10, 2022 · 0 comments
Open

resource name composition #923

andvisk opened this issue Nov 10, 2022 · 0 comments

Comments

@andvisk
Copy link

andvisk commented Nov 10, 2022

Thymeleaf 3.1.0.RC2

Environment:
Java(TM) SE Runtime Environment (build 17.0.4.1+1-LTS-2)
Wildfly 27.0.1 Beta1
CentOS 9 Stream

Libraries:
jakarta.jakartaee-api version: 10.0.0
jakarta.mvc-api version: 2.1.0
org.eclipse.krazo:krazo-core:3.0.1
org.eclipse.krazo:krazo-resteasy:3.0.1
org.eclipse.krazo.ext:krazo-thymeleaf:3.0.0

In case when prefix and suffix values are present, also the parameter "forceSuffix" is false, computing resource name is in mismatch - adds prefix to unaliasedName, where unaliasedName already has prefix, so the prefix dublicates in returning resource name.

I already made pull request on this bug #922

Source:

package thymeleaf;

import org.apache.logging.log4j.Logger;

import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.mvc.Controller;
import jakarta.mvc.Models;
import jakarta.mvc.MvcContext;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;

@Path("locale")
@Controller
@RequestScoped
public class LocaleController {

    @Inject
    MvcContext mvc;

    @Inject
    Models models;

    @Inject
    Logger log;

    @GET
    public String get() {
        models.put("locale", "test locale");
        return "locale.html";
    }

}
import java.util.HashMap;
import java.util.Map;

import org.apache.logging.log4j.Logger;

import jakarta.inject.Inject;
import jakarta.mvc.engine.ViewEngine;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;

@ApplicationPath("mvc")
public class MvcConfig extends Application {

    @Inject
    Logger log;

    @Override
    public Map<String, Object> getProperties() {

        final Map<String, Object> map = new HashMap<>();
        map.put(ViewEngine.VIEW_FOLDER, "/thymeleafViews/");
        return map;
    }
}

build.gradle:

plugins {
    id 'java'
    id 'war'
}

java {
  toolchain {
    languageVersion.set(JavaLanguageVersion.of(17))
  }
}

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.1'
    implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.1'

    providedCompile group: 'jakarta.platform', name: 'jakarta.jakartaee-api', version: '10.0.0'
    
    implementation group: 'org.hibernate.orm', name: 'hibernate-core', version: '6.1.5.Final'
    implementation 'org.primefaces:primefaces:12.0.0:jakarta'

    implementation 'org.thymeleaf:thymeleaf:3.1.0.RC2'
    implementation 'jakarta.mvc:jakarta.mvc-api:2.1.0'
    implementation 'org.eclipse.krazo:krazo-core:3.0.1'
    implementation 'org.eclipse.krazo:krazo-resteasy:3.0.1'
    implementation 'org.eclipse.krazo.ext:krazo-thymeleaf:3.0.0'
    
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'   
}

def archiveName_ = 'testMe.war'
def wildflyDeployDir = '/home/ksivdna/Downloads/wildfly-27.0.0.Beta1/standalone/deployments'

task undeploy(type:Exec) {
    workingDir wildflyDeployDir
    if(file(wildflyDeployDir + '/' + archiveName_ + '.deployed').exists()){
        commandLine 'rm', archiveName_ + '.deployed'
    }else{
            //do nothing
        commandLine 'pwd'
    }
}

task wait(dependsOn: undeploy){
    sleep(3 * 1000)
}

war {
    dependsOn(wait)
    archiveName archiveName_
}

task copyWar(type: Copy) {
    dependsOn(war)
    from 'build/libs'
    into wildflyDeployDir
}

task deploy(type: Exec) {
    dependsOn(copyWar)
    workingDir wildflyDeployDir
    commandLine 'touch', archiveName_ + '.dodeploy'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant