• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

I need help regarding getting the URL that is "http://localhost:9080/".

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I need help regarding getting the URL that is "http://localhost:9080/".

I am working on a JSF Application with RAD and websphere portal server. From one of my page when i clicked on PDF symbol a new window pops up which runs on Websphere App Server. It should have the url as "http://localhost:9080/.....". instead it shows
shows the portal server port number "http://locathost:10039".

as of now am hardcoding it in my Jsp but i need a way to get this url from Application Context instead of hardcoding.


any help in this regard will be appreciated.


Thank you
 
Ranch Hand
Posts: 88
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are looking for is:
request.getContextPath();

so say in portlet use: <img src="<%=request.getContextPath()>/images/test.jpg">

Also, in websphere portal the installation make two server instances:
1. server1 which runs at http port 9080 (default).
2. WebSphere_Portla which runs at http port 10040 (default).

Hope it solves your problem.
 
sana sultana
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no my provlem will not be solved with this.


i have 2 ear files deployed on 2 different servers

for example A on Portal and B on webApp Server

a jsp from A will pop up a new window when clicked on the PDF Icon by calling the Java Script

function open_report(commId, formName, thisEvent) {
<%String user = renderRequest.getRemoteUser();%>
var idUser = "<%= user %>";
var appUrl = "<%=ApplicationConstants.APP_SERVER_LOCALHOST%>"+"<%= MTPResources.getReportServletURL()%>";

window.open (""+appUrl+"?idReport="+commId+"&formName="+formName+"&idUser="+idUser,
"mywindow", "alwaysRaised=yes,toolbar=yes,scrollbars=yes,left=100,top=100,width=800,height=600,resizable=yes");
return false;
}

***********************************************************************************************************
ApplicationConstants.APP_SERVER_LOCALHOST gives http://localhost:9080 which is hardcoded
and MTPResources.getReportServletURL() gives /B/ReportServlet this reportServlet is in ws_mtp(deployed in websphere App Server) and renderRequest.getContextPath() will give ./A
************************************************************************************************************


since i have hardcoded it pop up window has the following Path in the address bar
http://localhost:9080/B/ReportServlet?idReport=396460402&formName=H3006&idUser=wpadmin

else it would have given

http://localhost:10039/B/ReportServlet?idReport=396460402&formName=H3006&idUser=wpadmin
and a Blank page will be displayed.

i want to get
http://localhost:9080/ without hard coding. Hope you have understood what i am trying to explain.

any help will be appreciated.

Thank you.
 
Shashank Ag
Ranch Hand
Posts: 88
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all this cannot be resolved by server through any standard api.
But hardcoding could be easily removed by:

1. One thing you can do is maintain a propery file containing:
SERVER_LOCALHOST=http://localhost:9080
and read the value from it upon server startup and store it in:
ApplicationConstants.APP_SERVER_LOCALHOST

2. you can put the value in Server A's Enviroment Varibales.
And read the value from server.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the remote servler host:port are required by one particular portlet, then you can also use portlet preferences (portlet.xml) instead of property files.
 
Is this the real life? Is this just fantasy? Is this a tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic