Brett Conoly | : | Hey All, |
|
|
|
|
|
|
|
| We have liferay deployed under a context root /admin and any wars we deploy into liferay need to have their own context path, /mywar. I just recently tried setting the context-root in my war's jboss-web.xml to /admin/mywar to server resources off of this context path but unfortunately whenever I use PortletRequest.getContextPath() it returns /mywar to me instead of /admin/mywar as expected. |
|
|
|
|
|
|
|
| Does anyone know why this would be? |
|
|
|
|
|
|
|
| Thanks in advance |
|
|
|
|
|
|
Sandeep Nair | : | Hi, |
|
|
|
|
|
|
|
| Set the following property in portal-ext.properties |
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
| Regards,
Sandeep |
|
|
|
|
|
|
Brett Conoly | : | Hmmm, I actually have that set to /admin already. Liferay is served off of that context path but I'm deploying another war with my portlet to the jboss server. In my jboss-web.xml I have my context root set as /admin/mywar but when i do PortletRequest.getContextPath() it returns /mywar. |
|
|
|
|
|
|
|
| Any ideas? |
|
|
|
|
|
|
Mazhar Anwar | : | Can you please confirm? Is your mywar.war file is getting deployed under /admin folder? |
|
|
|
|
|
|
|
| I think it is different application context and not inside the admin application(As admin is your liferay instance). |
|
|
|
|
|
|
Brett Conoly | : |
You're right, mywar is deployed along side the ROOT.war and has its own context but I'm setting the context-root to explicitly point to /admin/mywar. When making requests, the only way to retrieve my resources is to make a request to www.mydomain.com/admin/mywar/css/my.css but when using request.getContextPath()/css/my.css the path returns as www.mydomain.com/mywar/css/my.css and the content is not found there.
|
|
|
|
|
|
|
Mazhar Anwar | : | I had the same problem, so as a work around I moved all static contents to web-server to serve directly and made it available as in your case www.mydomain.com/mywar/css/my.css. |
|
|
|
|
|
|
|
| Can you give a try to some methods of ThemeDisplay Object such that themeDisplay.getPathMain() or themeDisplay.getPathContext() ? |
|
|
|
|
|
|
|
| I think themeDisplay.getPathMain() should return you "www.mydomain.com/admin/c" and themeDisplay.getPathContext() should return you "www.mydomain.com/admin" or "www.mydomain.com/admin/mywar" . Please let me know if you get the solution . |
|
|
|
|
|
|
|
| HTH |
|
|
|
|
|
|
|
| Regards,
Mazhar |
|
|
|
|
|
|
Brett Conoly | : |
Unfortunately it's not quite that simple, I'm using a third party library that runs off of the PortletRequest.getContextPath() and it can't be modified. If i just update the location of my static resources, the third party library still won't work. I just really need the context path from the PortletRequest to contain the /admin/mywar...
|
|
|
|
|
|
|
Mazhar Anwar | : | Don't change the location, but can you give a try to ThemeDisplay object? |
|
|
|
|
| Are you able to get themeDisplay object in your class using portletRequest? |
|
|
|
|
|
|
|
| m expecting you will be able to get required path from themeDisplay object. |
|
|
|
|
|
|
Mazhar Anwar | : | Hey, I got the solution... |
|
|
|
|
| I have written the code in process action method so here it is actionRequest object, but the same you can achieve with PortletRequest(RenderRequest / ResourceRequest). |
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
| Regards. |
|
|
|
|
|
|
Brett Conoly | : |
That sounds great for normal portlets but I need but I need this to work across multiple jsr-286 portals and I can't put a reference to liferay in my third party library anyway...thanks for the code share though, I may be able to use that in some future portlets.
|
No comments:
Post a Comment