-2

This is what my project look like :

src/main/java
-- main.java
src/main/resources
-- webapp
-- -- css
-- -- js
-- -- images
-- -- pages
-- -- -- home.html

Actually my maven project works with jersey and grizzly. I can call my services (Rest) and call html static pages (clstatichttphandler). The problem is when then file "home.html" is loaded, there is no css or images. I tried to set the path to the css relatively from the "home.html" file but it's not working.

I think my css / images are not visible.

EDIT

Here is the file which start the server grizzly - Main.java

    public static HttpServer startServer() {
    // create a resource config that scans for JAX-RS resources and providers
    // in com.application.easyshow package
    final ResourceConfig rc = new ResourceConfig().packages("com.application.app", "com.businessLogic");
    // create and start a new instance of grizzly http server
    // exposing the Jersey application at BASE_URI
    HttpServer server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);

    server.getServerConfiguration().addHttpHandler(
            new org.glassfish.grizzly.http.server.CLStaticHttpHandler(Main.class.getClassLoader(), "/webapp/pages/"), "/app");

    return server;
}

And this is the <head> where I try to load my css and js - home.html

<head>
<meta charset="UTF-8">
<title>Soundbyte Template</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="../css/responsive.css">
<link rel="stylesheet" href="../Player/css/progression-player.css" />
<link href="../Player/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href='//fonts.googleapis.com/css?family=Poppins:400,600,700%7cRoboto:400,300,700,900' rel='stylesheet' type='text/css'>    
<script src="../js/libs/jquery-1.11.3.js"></script> 
<script src="../js/libs/jquery-migrate.min.js"></script>
<script src="../js/libs/modernizr-2.6.2.min.js"></script>
</head>

What my project looks like

My Project

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Skulker
  • 87
  • 3
  • 9

1 Answers1

0

Problem can be that the path of the css files is not proper. If you write directly css/images. It starts from the base directory of HTML, you can either put your css/folder there. Or start from say, project_name/main/resources/css/images.

Hope it helps. :)

Aakash Parashar
  • 386
  • 1
  • 2
  • 14