jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.54k stars 4.02k forks source link

Servlet context path with more than one slash not working #19807

Closed TheRealHaui closed 1 year ago

TheRealHaui commented 2 years ago

Setting a servlet context path containing more than one slash leads the entire application to not work anymore.

When setting

server:
  servlet:
    context-path: /dir/subdir

in the application-dev.yaml file and setting

[        new HtmlWebpackPlugin({
          template: './src/main/webapp/index.html',
          chunksSortMode: 'auto',
          inject: 'body',
          base: '/dir/subdir',
        }),](url)

in the webpack.common.js file like described in the official documentation the entire application goes out of order. Currently React is in use for the web layer.

Obviously web resources like index.html do not get found by the Browser anymore because of obviously wrong directoy/path structures used then. I suspect it a problem with parsing because of the second slash in any internally used library.

JHipster info:

_Welcome to JHipster v7.8.1

Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
test@0.0.1-SNAPSHOT xxxxxxxxxxxxxxxxxxx
└── generator-jhipster@7.8.1
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "test",
    "blueprints": [],
    "buildTool": "maven",
    "cacheProvider": "no",
    "clientFramework": "react",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1663778902672,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 9060,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.8.1",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "languages": ["en", "fr"],
    "messageBroker": false,
    "nativeLanguage": "en",
    "otherModules": [],
    "packageName": "com.test",
    "pages": [],
    "prodDatabaseType": "postgresql",
    "reactive": true,
    "searchEngine": false,
    "serverPort": "8080",
    "serverSideOptions": [],
    "serviceDiscoveryType": "no",
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "skipUserManagement": false,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": true
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Environment and Tools

openjdk version "11.0.13" 2021-10-19 OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.18.04) OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)

git version 2.17.1

node: v16.14.2

npm: 8.5.0

Docker version 20.10.17, build 100c701

docker-compose version 1.17.1, build unknown

No change to package.json was detected. No package manager install will be executed._

mheidt commented 1 year ago

I can't confirm. It works with two slashes for 7.9.3 if you apply the following fix: https://github.com/jhipster/generator-jhipster/issues/21534

I am not talking about additional features like swagger though. But I couldn't make those work for one-slashed context-paths anyways.

DanielFran commented 1 year ago

Closing this issue since servlet context path have been fixed in main branch. Please reopen in case the issue remain