Re: Application mapping - how do I know it from within the app?
You're wrong. Orion has implemented the 2.3 PFD spec several months ago. On Wed, 18 Apr 2001, Johan Fredriksson wrote: > My point is that the method IS included in servlet 2.3, but Orion seems to > be running servlet 2.2 where the method does not exist... > > Correct me if I'm wrong or tell me how to update orion to run servlet 2.3 > spec. > > > Johan > > - Original Message - > From: "Hani Suleiman" <[EMAIL PROTECTED]> > To: "Orion-Interest" <[EMAIL PROTECTED]> > Sent: Tuesday, April 17, 2001 3:45 PM > Subject: Re: Application mapping - how do I know it from within the app? > > > > Oops, a check of the API would have shown that it is > > request.getContextPath() anyways. > > > > PS All this is in the API, my suggestion was hastily written but should > > have pointed you in the right direction... > > > > On Tue, 17 Apr 2001, Johan Fredriksson wrote: > > > > > Nope, when doing just that I get... > > > > > > > > > 500 Internal Server Error > > > Error parsing JSP page /aller/Allas/subscriber.jsp > > > > > > Syntax error in source/Allas/subscriber.jsp.java:32: Method > getContextPath() > > > not found in interface javax.servlet.ServletContext. (JSP page line 8) > > > > > > String servletPath = pageContext.getServletContext().getContextPath(); > > >^ > > > 1 error > > > > > > > > > > > > > > > > > > > > > > > > - Original Message - > > > From: "Hani Suleiman" <[EMAIL PROTECTED]> > > > To: "Orion-Interest" <[EMAIL PROTECTED]> > > > Sent: Wednesday, April 11, 2001 5:30 PM > > > Subject: Re: Application mapping - how do I know it from within the app? > > > > > > > > > > pageContext.getServletContext().getContextPath() > > > > > > > > On Wed, 11 Apr 2001, Johan Fredriksson wrote: > > > > > > > > > I'm using virtual hosts in my development to make sure that all > links > > > are correctly set, that is I can access the same app in two ways, either > via > > > > > > > > > > appname.localhost > > > > > > > > > > or > > > > > > > > > > localhost/appname > > > > > > > > > > . > > > > > > > > > > The problem is that I'm not sure how to figure out on a jsp page > which > > > entry point was used, and this causes problem when I'm trying to map my > > > servlet, since relative paths to servlets does not seem to work... > > > > > > > > > > String parsing of request.getRequestURI() seems like a way to start, > but > > > I'm not sure what how to write it, since in the future the app might be > > > moved again to > > > > > > > > > > appname.serviceprovider.localhost > > > > > > > > > > vs > > > > > > > > > > localhost/serviceprovider/appname > > > > > > > > > > . > > > > > > > > > > Is there a way to get pageContext return application context? > > > > > > > > > > > > > > > > > > > > Johan > > > > > > > > > > > > > > > > > > > > > > >
Re: Application mapping - how do I know it from within the app?
My point is that the method IS included in servlet 2.3, but Orion seems to be running servlet 2.2 where the method does not exist... Correct me if I'm wrong or tell me how to update orion to run servlet 2.3 spec. Johan - Original Message - From: "Hani Suleiman" <[EMAIL PROTECTED]> To: "Orion-Interest" <[EMAIL PROTECTED]> Sent: Tuesday, April 17, 2001 3:45 PM Subject: Re: Application mapping - how do I know it from within the app? > Oops, a check of the API would have shown that it is > request.getContextPath() anyways. > > PS All this is in the API, my suggestion was hastily written but should > have pointed you in the right direction... > > On Tue, 17 Apr 2001, Johan Fredriksson wrote: > > > Nope, when doing just that I get... > > > > > > 500 Internal Server Error > > Error parsing JSP page /aller/Allas/subscriber.jsp > > > > Syntax error in source/Allas/subscriber.jsp.java:32: Method getContextPath() > > not found in interface javax.servlet.ServletContext. (JSP page line 8) > > > > String servletPath = pageContext.getServletContext().getContextPath(); > >^ > > 1 error > > > > > > > > > > > > > > > > - Original Message ----- > > From: "Hani Suleiman" <[EMAIL PROTECTED]> > > To: "Orion-Interest" <[EMAIL PROTECTED]> > > Sent: Wednesday, April 11, 2001 5:30 PM > > Subject: Re: Application mapping - how do I know it from within the app? > > > > > > > pageContext.getServletContext().getContextPath() > > > > > > On Wed, 11 Apr 2001, Johan Fredriksson wrote: > > > > > > > I'm using virtual hosts in my development to make sure that all links > > are correctly set, that is I can access the same app in two ways, either via > > > > > > > > appname.localhost > > > > > > > > or > > > > > > > > localhost/appname > > > > > > > > . > > > > > > > > The problem is that I'm not sure how to figure out on a jsp page which > > entry point was used, and this causes problem when I'm trying to map my > > servlet, since relative paths to servlets does not seem to work... > > > > > > > > String parsing of request.getRequestURI() seems like a way to start, but > > I'm not sure what how to write it, since in the future the app might be > > moved again to > > > > > > > > appname.serviceprovider.localhost > > > > > > > > vs > > > > > > > > localhost/serviceprovider/appname > > > > > > > > . > > > > > > > > Is there a way to get pageContext return application context? > > > > > > > > > > > > > > > > Johan > > > > > > > > > > > > > >
Re: Application mapping - how do I know it from within the app?
getContexstPath(), which is what you want, is a method of HttpServletRequest. tim. > Nope, when doing just that I get... > > > 500 Internal Server Error > Error parsing JSP page /aller/Allas/subscriber.jsp > > Syntax error in source/Allas/subscriber.jsp.java:32: Method getContextPath() > not found in interface javax.servlet.ServletContext. (JSP page line 8) > > String servletPath = pageContext.getServletContext().getContextPath(); > ^ > 1 error > > - Original Message - > From: "Hani Suleiman" <[EMAIL PROTECTED]> > To: "Orion-Interest" <[EMAIL PROTECTED]> > Sent: Wednesday, April 11, 2001 5:30 PM > Subject: Re: Application mapping - how do I know it from within the app? > > > > pageContext.getServletContext().getContextPath() > > > > On Wed, 11 Apr 2001, Johan Fredriksson wrote: > > > > > I'm using virtual hosts in my development to make sure that all links > are correctly set, that is I can access the same app in two ways, either via > > > > > > appname.localhost > > > > > > or > > > > > > localhost/appname > > > > > > . > > > > > > The problem is that I'm not sure how to figure out on a jsp page which > entry point was used, and this causes problem when I'm trying to map my > servlet, since relative paths to servlets does not seem to work... > > > > > > String parsing of request.getRequestURI() seems like a way to start, but > I'm not sure what how to write it, since in the future the app might be > moved again to > > > > > > appname.serviceprovider.localhost > > > > > > vs > > > > > > localhost/serviceprovider/appname > > > > > > . > > > > > > Is there a way to get pageContext return application context? > > > > > > > > > > > > Johan > > > > > > >
Re: Application mapping - how do I know it from within the app?
Oops, a check of the API would have shown that it is request.getContextPath() anyways. PS All this is in the API, my suggestion was hastily written but should have pointed you in the right direction... On Tue, 17 Apr 2001, Johan Fredriksson wrote: > Nope, when doing just that I get... > > > 500 Internal Server Error > Error parsing JSP page /aller/Allas/subscriber.jsp > > Syntax error in source/Allas/subscriber.jsp.java:32: Method getContextPath() > not found in interface javax.servlet.ServletContext. (JSP page line 8) > > String servletPath = pageContext.getServletContext().getContextPath(); > ^ > 1 error > > > > > > > > - Original Message - > From: "Hani Suleiman" <[EMAIL PROTECTED]> > To: "Orion-Interest" <[EMAIL PROTECTED]> > Sent: Wednesday, April 11, 2001 5:30 PM > Subject: Re: Application mapping - how do I know it from within the app? > > > > pageContext.getServletContext().getContextPath() > > > > On Wed, 11 Apr 2001, Johan Fredriksson wrote: > > > > > I'm using virtual hosts in my development to make sure that all links > are correctly set, that is I can access the same app in two ways, either via > > > > > > appname.localhost > > > > > > or > > > > > > localhost/appname > > > > > > . > > > > > > The problem is that I'm not sure how to figure out on a jsp page which > entry point was used, and this causes problem when I'm trying to map my > servlet, since relative paths to servlets does not seem to work... > > > > > > String parsing of request.getRequestURI() seems like a way to start, but > I'm not sure what how to write it, since in the future the app might be > moved again to > > > > > > appname.serviceprovider.localhost > > > > > > vs > > > > > > localhost/serviceprovider/appname > > > > > > . > > > > > > Is there a way to get pageContext return application context? > > > > > > > > > > > > Johan > > > > > > > >
Re: Application mapping - how do I know it from within the app?
Nope, when doing just that I get... 500 Internal Server Error Error parsing JSP page /aller/Allas/subscriber.jsp Syntax error in source/Allas/subscriber.jsp.java:32: Method getContextPath() not found in interface javax.servlet.ServletContext. (JSP page line 8) String servletPath = pageContext.getServletContext().getContextPath(); ^ 1 error - Original Message - From: "Hani Suleiman" <[EMAIL PROTECTED]> To: "Orion-Interest" <[EMAIL PROTECTED]> Sent: Wednesday, April 11, 2001 5:30 PM Subject: Re: Application mapping - how do I know it from within the app? > pageContext.getServletContext().getContextPath() > > On Wed, 11 Apr 2001, Johan Fredriksson wrote: > > > I'm using virtual hosts in my development to make sure that all links are correctly set, that is I can access the same app in two ways, either via > > > > appname.localhost > > > > or > > > > localhost/appname > > > > . > > > > The problem is that I'm not sure how to figure out on a jsp page which entry point was used, and this causes problem when I'm trying to map my servlet, since relative paths to servlets does not seem to work... > > > > String parsing of request.getRequestURI() seems like a way to start, but I'm not sure what how to write it, since in the future the app might be moved again to > > > > appname.serviceprovider.localhost > > > > vs > > > > localhost/serviceprovider/appname > > > > . > > > > Is there a way to get pageContext return application context? > > > > > > > > Johan > > >
RE: Application mapping - how do I know it from within the app?
I believe that the original servlet spec allowed direct access to root of the web site, but these methods were deprecated for security reasons. I have been having this problem myself, what a wonderful solution! Regards, The Elephantwalker -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Johan FredrikssonSent: Wednesday, April 11, 2001 9:50 AMTo: Orion-InterestSubject: Re: Application mapping - how do I know it from within the app? okey, I fígured it out... With a little help. I hope this function will appear in servlet 2.3 version ( and why isn't orion running 2.3?? ) anyways, if anyone else runs into this copy paste this line : String servletPath = request.getRequestURI().substring(0, request.getRequestURI().indexOf(request.getServletPath())); Which will return the mapping to the root of your application. Johan - Original Message - From: Johan Fredriksson To: Orion-Interest Sent: Wednesday, April 11, 2001 4:59 PM Subject: Application mapping - how do I know it from within the app? I'm using virtual hosts in my development to make sure that all links are correctly set, that is I can access the same app in two ways, either via appname.localhost or localhost/appname . The problem is that I'm not sure how to figure out on a jsp page which entry point was used, and this causes problem when I'm trying to map my servlet, since relative paths to servlets does not seem to work... String parsing of request.getRequestURI() seems like a way to start, but I'm not sure what how to write it, since in the future the app might be moved again to appname.serviceprovider.localhost vs localhost/serviceprovider/appname . Is there a way to get pageContext return application context? Johan
Re: Application mapping - how do I know it from within the app?
okey, I fígured it out... With a little help. I hope this function will appear in servlet 2.3 version ( and why isn't orion running 2.3?? ) anyways, if anyone else runs into this copy paste this line : String servletPath = request.getRequestURI().substring(0, request.getRequestURI().indexOf(request.getServletPath())); Which will return the mapping to the root of your application. Johan - Original Message - From: Johan Fredriksson To: Orion-Interest Sent: Wednesday, April 11, 2001 4:59 PM Subject: Application mapping - how do I know it from within the app? I'm using virtual hosts in my development to make sure that all links are correctly set, that is I can access the same app in two ways, either via appname.localhost or localhost/appname . The problem is that I'm not sure how to figure out on a jsp page which entry point was used, and this causes problem when I'm trying to map my servlet, since relative paths to servlets does not seem to work... String parsing of request.getRequestURI() seems like a way to start, but I'm not sure what how to write it, since in the future the app might be moved again to appname.serviceprovider.localhost vs localhost/serviceprovider/appname . Is there a way to get pageContext return application context? Johan
Re: Application mapping - how do I know it from within the app?
pageContext.getServletContext().getContextPath() On Wed, 11 Apr 2001, Johan Fredriksson wrote: > I'm using virtual hosts in my development to make sure that all links are correctly >set, that is I can access the same app in two ways, either via > > appname.localhost > > or > > localhost/appname > > . > > The problem is that I'm not sure how to figure out on a jsp page which entry point >was used, and this causes problem when I'm trying to map my servlet, since relative >paths to servlets does not seem to work... > > String parsing of request.getRequestURI() seems like a way to start, but I'm not >sure what how to write it, since in the future the app might be moved again to > > appname.serviceprovider.localhost > > vs > > localhost/serviceprovider/appname > > . > > Is there a way to get pageContext return application context? > > > > Johan >
Application mapping - how do I know it from within the app?
I'm using virtual hosts in my development to make sure that all links are correctly set, that is I can access the same app in two ways, either via appname.localhost or localhost/appname . The problem is that I'm not sure how to figure out on a jsp page which entry point was used, and this causes problem when I'm trying to map my servlet, since relative paths to servlets does not seem to work... String parsing of request.getRequestURI() seems like a way to start, but I'm not sure what how to write it, since in the future the app might be moved again to appname.serviceprovider.localhost vs localhost/serviceprovider/appname . Is there a way to get pageContext return application context? Johan