I was trying to update my Jhipster 4.0 project (which used Angular 4) to Jhipster 6.0 (which used Angular 9). There was such a difference in the Angular version and Typescript version, that I instead just created a Jhipster 6.0 project, and then I replaced all of the following files in this Jhipster 6.0 project. These files were replaced with the files from the Jhipster 4.0 project, so I could get the front-end working again - src/main/webapp - src/test - package.json - webpack - tsconfig.json
In essence this makes it use angular 4 again ... makes it use the old typescript ... and lets it have all of the old front-end code. I can bring the application app just fine (using ./mvnw and npm start). But only http://localhost:9061
I'm attempting to serve the old angular code through port 8080. Currently only the index.html file gets served there, and it is the nearly empty html file with a jhipster needle.
When I attempt other url paths, this page is still served up.
For example, the following urls both serve up the root index.html file:
http://localhost:8080/#/dashboard
http://localhost:8080/app/dashboard
But, if I try to serve up static content from similar urls, that does work. For example, this does return the .css file correctly:
http://localhost:8080/app/dashboard/dashboard.css
So, in short, I'm trying to find a way to serve up slightly older Angular (v4) from an updated JHipster app, but the angular components are not being served. Thanks!
Make sure you have this in your webpack.dev.js - contentBase: './target/classes/static', ... and that you do NOT have this - contentBase: './target/www',
Related
Ok, I developed a small spring boot website using thymleaf and now realized that I can't use the webapp folder if I want to package everything with the maven plugin.
To fix this I moved all my resources to src/main/resources. However, I keep getting FileNotFoundExceptions when I try to display any site (simple RequestMapping returning a String):
This is the error I get:
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/index.html]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:157) ~[spring-web-5.0.0.BUILD-SNAPSHOT.jar:5.0.0.BUILD-SNAPSHOT]
at org.thymeleaf.spring5.templateresource.SpringResourceTemplateResource.reader(SpringResourceTemplateResource.java:103) ~[thymeleaf-spring5-3.0.3.M1.jar:3.0.3.M1]
at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:223) ~[thymeleaf-3.0.3.RELEASE.jar:3.0.3.RELEASE]
... 75 common frames omitted
And then I get the same error again when Spring tries to load my error page.
Full http://pastebin.com/raw/Csw5akHJ
Explorer
(Yes I know that only the static folder is available. Good enough for testing.)
Can anyone help me? This is getting a bit frustrating.
If you are using Thymleaf as Template Engine you should add all .html files inside resources/templates
i am not sure if this is your problem but normally i would put all the html pages inside templates directory under resources and all js and css files under static directory.
by doing so js and css files can easily accessed. for eg if i have css directory and test.css inside it. i can simply access it doing
so coming to your problem on my controller i will return pages like this.
#RequestMapping(value="/viewusers",method = RequestMethod.GET)
public String viewUsers(){
return "users/viewusers";
}
in above sample i have viewusers.html under users directory. my users directory is inside templates directory.
OK, I made some headway. While it works fine if I use the default template Engine It stops working as soon as I start using the Thymeleaf one. Apparently the default template Engine can handle classpaths automatically while I needed to switch from SpringResourceTemplateResolver to ClassLoaderTemplateResolver if I want to use thymeleaf.
So far it looks like everything is working fine. Halleluja!
I'm learning to make Java MVC project using Spring Tool Suite tool.
The path to make new project is:
File->New->SpringLegacyProject->Spring MVC Project.
My question is: which directory I have to use to add additional not-Spring files and where and what do I have to type for Spring files to see them?
For example:
css files - where to put and how to make jsp views see them, will 'link rel="" 'tag be enough?
properties files used to specify database connection or to specify messages for ReloadableResourceBundleMessageSource. In this case, do I have to create bean for this class in root-context.xml?
Thanks.
You should probably use Spring Boot (i.e. use File->New->Spring Starter Project and select Web as a starter. Place your web resources under src/main/resources/static folder. They are picked up automatically from that folder.
You should try an example project: File -> New -> Import Spring Getting Started Content and then pick "Serving Web Content" from the list.
Try some DB getting started content example to get the answer for the second part of your question.
I have found similar Stack Overflow posts for configuring Swagger + SwaggerUI + Jersey, but almost all of these use Spring and I have not been able to find a solution for what I am trying to do.
I have Swagger + Jersey working, and have copied the swagger-ui/dist folder from: https://github.com/swagger-api/swagger-ui to my webapp directory, and have edited swagger-ui/dist/index.html file to point to my swagger.json output. I can properly access Swagger UI at http://localhost:{port}/{base-path}/dist/index.html
However, I do not want to have to copy the pre-build dist files to my webapp directory every time I need to fetch updates. I would like to automate this with Maven (which I am new to as well as Jersey/Swagger), and found this dependency online: https://mvnrepository.com/artifact/org.webjars/swagger-ui/2.0.12
However, I do not understand how to configure the path from my webserver to this webjar dependency.
To recap, I have Swagger UI working on my local machine, but only by manually copying the pre-build files to my webapp directory and would like some way to automate this (I have found solutions using Spring, but I am not using this).
I am trying to creata a Domino OSGI plugin which exposes a simple Hello World servlet.
To do this I created in eclipse a plugin project(with web.xml and the servlet in place) , a feature project containing this plugin and an updated site project.
After this I created an application in Domino designer using the 'Eclipse Update Site' as template (name RestDemoUpdateSite.nsf).
With this application open in Domino administrator, I successfully imported my eclipse update site.
Finally I copied RestDemoUpdateSite.nsf to the folder -
C:\Program Files\IBM\Domino\data and added the line OSGI_HTTP_DYNAMIC_BUNDLES=RestDemoUpdateSite.nsf in notes.ini.
The link http://<>/RestDemoUpdateSite.nsf opens fine
A GET request to http://<>/RestDemoUpdateSite.nsf/api/ gives the json response
{
"services":[
{
"name":"Data",
"enabled":false,
"version":"9.0.1",
"href":"\/RestDemoUpdateSite.nsf\/api\/data"
},
{
"name":"Calendar",
"enabled":false,
"version":"9.0.1",
"href":"\/RestDemoUpdateSite.nsf\/api\/calendar"
},
{
"name":"Core",
"enabled":true,
"version":"9.0.1",
"href":"\/RestDemoUpdateSite.nsf\/api\/core"
}
]
}
A GET request to my servlet http://<>/RestDemoUpdateSite.nsf/serviceapi/student gives the error
HTTP Web Server: Couldn't find design note - serviceapi/student [/RestDemoUpdateSite.nsf/serviceapi/student] Anonymous
Any suggestion or hints as to what might be going wrong would be of great help.
Thank you
The first step is to make sure your plugin is being loaded by the OSGi framework. Execute the following server console command:
tell http osgi ss {bundle.name}
For example, tell http osgi ss com.ibm.domino.services lists all the plugins matching the given name. The listing tells you whether a plugin is ACTIVE, RESOLVED, INSTALLED, etc.
Assuming your plugin is being loaded, the next step is to make sure you are defining your servlet correctly. You said you included a web.xml file, but OSGi servlets are typically defined in plugin.xml. They implement the org.eclipse.equinox.http.registry.servlets extension. You can find more details in these slides. See the section starting with "Creating, deploying & debugging a simple servlet".
Currently, I use a Maven project. I don't have any Tomcat server. I use the local google appengine server to test my application.
I would like to use the spring tags, especially the 'form' tags.
On a forum(http://forum.spring.io/forum/spring-projects/web/74017-the-absolute-uri-http-www-springframework-org-tags-form-cannot-be-resolved), I heard that I had to copy the spring-form.tld file from the spring-webmvc-3.1.0.RELEASE.jar in src/main/webapp/WEB-INF. It's done.
But when I launch the appengine server and I go to this url : http://www.springsource.org/tags/form , I've a 404 error.
What does it happen ?
Do you have any solutions ?
Thank you
404 means that the specific path you are trying to access does not exist.
So either it did not deploy properly or it is not stored where you think it is
Add the spring-webmvc-3.1.x.RELEASE.jar to your application (lib folder), thats all you need.
In your jsp use: http://www.springframework.org/tags/form
The tld file itselfe is located inside spring-webmvc-3.1.x.RELEASE.jar : \META-INF\spring-form.tld