Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8411291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:23:40+00:00 2026-06-10T00:23:40+00:00

I made myproject.com (for example) to be as http://localhost:8080/MyProject/ using Nginx’s proxy_pass option. All

  • 0

I made “myproject.com” (for example) to be as “http://localhost:8080/MyProject/” using Nginx’s proxy_pass option. All works ok, but PrimeFaces stylesheets and scripts tries to go to “/MyProject/file”, what isn’t good because of proxing to nonexistent “http://localhost:8080/MyProject/MyProject/file”.
How can I made PF use ./file instead of /MyProject/file? Making Nginx’s location block or link to MyProject folder is bad variant.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:23:41+00:00Added an answer on June 10, 2026 at 12:23 am

    Even though I have the strong impression that this problem really needs to be solved in the Ngnix proxy side, I’ll explain how you could “workaround” it from the JSF side on.

    JSF resources are represented by the Resource class wherein the getRequestPath() method is responsible for returning the resource URL. You could create a custom Resource implementation wherein the getRequestPath() is implemented/overridden accordingly.

    public class MyResource extends ResourceWrapper {
    
        private Resource wrapped;
    
        public MyResource(Resource wrapped) {
            this.wrapped = wrapped; 
        }
    
        @Override
        public String getRequestPath() {
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            return "." + wrapped.getRequestPath().substring(contextPath.length());
        }
    
        @Override
        public Resource getWrapped() {
            return wrapped;
        }
    
    }
    

    Now, to override the default JSF Resource by this custom implementation, you need to create a custom ResourceHandler implementation wherein you return the custom Resource implementation instead in the createResource() method.

    public class MyResourceHandler extends ResourceHandlerWrapper {
    
        private ResourceHandler wrapped;
    
        public MyResourceHandler(ResourceHandler wrapped) {
            this.wrapped = wrapped;
        }
    
        @Override
        public Resource createResource(String resourceName, String libraryName) {
            return new MyResource(wrapped.createResource(resourceName, libraryName));
        }
    
        @Override
        public ResourceHandler getWrapped() {
            return wrapped;
        }
    
    }
    

    Finally, to get it to run, register it as <resource-handler> in the faces-config.xml.

    <application>
        <resource-handler>com.example.MyResourceHandler</resource-handler>
    </application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to load my project using a self-made .asd file, but somehow
I followed the guide here http://www.hackido.com/2010/01/installing-git-on-server-ubuntu-or.html but I cannot find the proper way to
I'm using sorl thumbnail with Django. On my local setup it works fine, but
I've made an interface called ApprovalEvent in a separate file with the namespace myproject
I am doing NDK profiling for my project using android-ndk-profiler-3.1. I have made changes
Made this nice little loop for hiding and showing div's, works as a charm
I made a dll in c# but i need to export the functions. Is
The Problem I made a DB model using EF 4 in VS 2010. I
I have used org.reflections (http://code.google.com/p/reflections/) in my project for loading classes with certain annotations.
I'm making attempts to install multiple JCarousels onto my project. http://natesmithen.com/wired/test/test.html as you can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.