How to deploy my hosting site without losing the links?

0

I deployed my Java site with JSF and Primefaces in DailyRazor using the tomcat Manager but it remains in a folder behind the context and I can not make it look direct from the main domain www.misitio.com.

I must use www.misitio.com/contexto/faces/Front/index.xhtml .. Using the web.xml with the tag:

 <welcome-file>faces/Front/index.xhtml</welcome-file>
</welcome-file-list>

I can do that by checking www.misitio.com/contexto take me to the index, but the user will never know how to get into context!

Also, I do not know why I always have to use "faces"! ... without that it does not show me anything graphic.

I appreciate all the help you can give me.

    
asked by user3123446 23.10.2017 в 05:00
source

1 answer

1

Your question is basically divided into 2 parts:

  • How to replace Tomcat's ROOT (root) application?
  • How do I remove the prefix faces from my urls?
  • The first part is adapted from How to change the ROOT application? :

    There are three methods (excluding):

  • First turn off your Tomcat server from the bin folder ( sh shutdown.sh or running shutdown.bat). Then, delete all the contents of the Tomcat webapps folder ( rm -fr * ). Then, copy your WAR file into this folder and rename it to ROOT.war , and finally start Tomcar again ( sh startup.sh or running startup.bat ).

  • Leave your war file in $CATALINA_BASE/webapps with its original name. Turn off the autoDeploy and deployOnStartup options on your server in the server.xml file. Define a context ( <Context> ) in server.xml explicitly, specify the attributes path and docBase . You must do this because you have disabled the Tomcat self-deployment mechanisms, and Tomcat will not deploy your applications anymore unless you find their contexts in server.xml . You must restart Tomcat for the changes to take effect.

  • Place your WAR file outside of the $CATALINA_BASE/webapps folder (it must be outside to prevent a double display). Place a context file called ROOT.xml in $CATALINA_BASE/conf/ . The only element in this file MUST have a docBase attribute pointing to the location of your WAR file. The path element must not be set (it is derived from the file name .xml , in this case ROOT.xml ). See the documentation for the context container for more details.

  • Reference

    In my opinion, I would choose the first alternative.

    About the second part, check in your web.xml file how you have configured the urls mapping for FacesServlet . I imagine you must have something like this:

    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    

    There are many tutorials that do not explain this part well. The best thing is to change it to a more useful form:

    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    
        
    answered by 23.10.2017 в 09:44