Home » Eclipse Projects » Equinox » Re: httpContext extension point not working, but servlet extension point is?
|
Re: httpContext extension point not working, but servlet extension point is? [message #113865 is a reply to message #113852] |
Thu, 10 July 2008 09:55   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_003F_01C8E273.22657510
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Relevant to my incorrect extension point usage - sorry - I originally =
went from the documented extension point reference, but then was messing =
around based on a clearly out-of-date posting somewhere else. Corrected =
plugin.xml below.
I had a hard time find decent documentation or examples, including =
looking that the OSGi spec and the org.osgi.* javadoc. I was about to =
start looking at internal source to see what was going on, but I then =
you (Gunner) responded...
What you are telling me (as I understand it) is surprising. I would =
have expected the implementation to proxy certain information - such as =
my query to get the containing web app context within the Servlet =
service via=20
=
HttpServletRequest.getSession().getServletContext().getServl etContextName=
();
Alas, this only returns null, either within the equinox embedded Jetty =
or a Tomcat container (even though the URL works correctly).
Would this be considered a bug in the implementation? If not, the osgi =
docs, nor the extension point documentation makes clear what you seem to =
be implying - that the context of the container is unknown to the =
extensions. Also, there is not clear communication that the =
servletContext is not fully proxied... or I am simply missing that =
explanation.
As for now, my approach is to pass in an init param on my servlet =
extension point to take care of identifying the container web app =
context (which i do not like too much, but at least it is specified in =
the same plugin.xml where I would have specified the httpcontext via the =
org.eclipse.equinox.http.registry.httpcontexts extension point). Any =
suggestions otherwise?
Thank you for any and all help!
plugin.xml
<plugin>
<extension
id=3D"cwinfocenter"
name=3D"cwinfocenter"
point=3D"org.eclipse.equinox.http.registry.httpcontexts">
<httpcontext
id=3D"cwinfocenter">
<resource-mapping path=3D"/web-content"/>
</httpcontext>
</extension>
<extension
id=3D"contextInfoServlet"
name=3D"contextInfoServlet"
point=3D"org.eclipse.equinox.http.registry.servlets">
<servlet
=
class=3D"com.compuware.frameworks.viz.help.cshprovider.CSHServlet "
alias=3D"/contextInfo"
httpcontextId=3D"cwinfocenter"
load-on-startup=3D"true">
<init-param
name=3D"webAppContext"
value=3D"cwinfocenter">
</init-param>
</servlet>
</extension>
</plugin>
Regards,=20
James=20
--=20
James Korotney
Technical Consultant, Technical Architecture
Compuware
One Campus Martius
Detroit, Michigan 48226
313-227-2395 Direct
248-760-8218 Mobile
313-227-7300
james.korotney@compuware.com
"Gunnar Wagenknecht" <gunnar@wagenknecht.org> wrote in message =
news:g54ie7$q3f$1@build.eclipse.org...
> Hi,
>=20
> Korotney, James schrieb:
>=20
>> I am using the servletbridge. I can see my=20
>> org.eclipse.equinox.http.registry.servlets registered servlets fine,=20
>> both in a jetty container as well as in Tomcat launched within =
eclipse=20
>> as a Java application. But, I can not see any httpContexts =
registered=20
>> under the extension point=20
>=20
>> [...] In jetty, I can only access my servlets directly.
>=20
> > This works:
> >
> > http://localhost/myServlet?foo=3Dbar
> >
> > ****This does not work:
> >
> > http://localhost/myWebAppContext/myServlet?foo=3Dbar
> >
>=20
> Although the OSGi HttpContext "maps" one-on-one onto a ServletContext =
it=20
> has no influence on the URL of the servlets like the ServletContext.
>=20
> In OSGi, every alias defined is applied to the root of the =
HttpService.=20
> Note, the root of the embedded Jetty based HttpService is the real =
root=20
> ("http://server/") whereas the root of the ServletBridge based=20
> HttpService is the web application root.
>=20
>=20
> > Plugin.xml:
> >
> > <plugin>
> > <extension =
point=3D"org.eclipse.equinox.http.registry.httpcontexts">
> > <httpcontext
> > name=3D"myWebAppContext"
> > path=3D"/myWebAppContext ">
> > </httpcontext>
> > </extension>
>=20
> Please check the documentation. There is no "path" element. Also the=20
> "name" element has never made it into API.
>=20
> =
http://help.eclipse.org/ganymede/index.jsp?topic=3D/org.ecli pse.platform.=
doc.isv/reference/extension-points/org_eclipse_equinox_http_ registry_http=
contexts.html
>=20
>=20
> -Gunnar
>=20
> --=20
> Gunnar Wagenknecht
> gunnar@wagenknecht.org
> http://wagenknecht.org/
------=_NextPart_000_003F_01C8E273.22657510
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16674" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff background=3D"">
<DIV><FONT face=3DArial size=3D2>Relevant to my incorrect extension =
point usage -=20
sorry - I originally went from the documented extension point reference, =
but=20
then was messing around based on a clearly out-of-date posting somewhere =
else. Corrected plugin.xml below.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I had a hard time find decent =
documentation or=20
examples, including looking that the OSGi spec and the org.osgi.* =
javadoc. =20
I was about to start looking at internal source to see what was going =
on, but I=20
then you (Gunner) responded...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>What you are telling me (as I =
understand it) is=20
surprising. I would have expected the implementation to proxy =
certain=20
information - such as my query to get the containing web app context =
within the=20
Servlet service via <FONT size=3D2></DIV>
<P> HttpServletRequest.<FONT=20
size=3D2>getSession().getServletContext().getServletContextName(); </FONT>=
</P>
<P><FONT size=3D2>Alas, this only returns null, either within the =
equinox=20
embedded Jetty or a Tomcat container (even though the URL works=20
correctly).</FONT></P>
<P><FONT size=3D2>Would this be considered a bug in the =
implementation? If=20
not, the osgi docs, nor the extension point documentation makes clear =
what you=20
seem to be implying - that the context of the container is unknown to =
the=20
extensions. Also, there is not clear communication that the =
servletContext=20
is not fully proxied... or I am simply missing that=20
explanation.</FONT></FONT></FONT></P>
<DIV><FONT face=3DArial size=3D2>As for now, my approach is to pass =
in an init=20
param on my servlet extension point to take care of identifying the =
container web app context (which i do not like too much, but at least it =
is=20
specified in the same plugin.xml where I would have specified the =
httpcontext=20
via the org.eclipse.equinox.http.registry.httpcontexts extension =
point). =20
Any suggestions otherwise?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for any and all =
help!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>plugin.xml</FONT></DIV>
<DIV>
<P align=3Dleft><FONT face=3DArial size=3D2> =20
<plugin></FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
<extension</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
id=3D"cwinfocenter"</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
name=3D"cwinfocenter"</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
=20
point=3D"org.eclipse.equinox.http.registry.httpcontexts"> </FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
<httpcontext</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
id=3D"cwinfocenter"></FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
<resource-mapping=20
path=3D"/web-content"/></FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
</httpcontext></FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
</extension></FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2></FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
<extension</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
id=3D"contextInfoServlet"</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
name=3D"contextInfoServlet"</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
=20
point=3D"org.eclipse.equinox.http.registry.servlets"> </FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
<servlet</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
=20
class=3D"com.compuware.frameworks.viz.help.cshprovider.CSHServlet "</FONT>=
</P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
alias=3D"/contextInfo"</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
=
httpcontextId=3D"cwinfocenter"</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
=
load-on-startup=3D"true"></FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
=20
<init-param</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
=
=20
name=3D"webAppContext"</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
=
=20
value=3D"cwinfocenter"></FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =
=20
=20
</init-param></FONT></P>
<P align=3Dleft><FONT face=3DArial=20
size=3D2> &nbs=
p;=20
</servlet></FONT></P>
<P align=3Dleft><FONT face=3DArial=20
size=3D2> </extension> </FONT></P=
>
<P><FONT face=3DArial size=3D2></plugin></FONT></P><FONT =
face=3DArial size=3D2>
<P class=3DMsoNormal=20
style=3D"MARGIN: 0in 0in 0pt; mso-margin-top-alt: auto; =
mso-margin-bottom-alt: auto"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; =
mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: =
minor-fareast; mso-no-proof: yes">Regards,</SPAN><SPAN=20
style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; =
mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: =
minor-fareast; mso-no-proof: yes">=20
<BR></SPAN><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; =
mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: =
minor-fareast; mso-no-proof: yes">James</SPAN><SPAN=20
style=3D"FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; =
mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: =
minor-fareast; mso-no-proof: yes">=20
<?xml:namespace prefix =3D o ns =3D =
"urn:schemas-microsoft-com:office:office"=20
/><o:p></o:p></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><I><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: =
'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'; =
mso-fareast-theme-font: minor-fareast; mso-no-proof: =
yes">--</SPAN></I><SPAN=20
style=3D"mso-fareast-font-family: 'Times New Roman'; =
mso-fareast-theme-font: minor-fareast; mso-no-proof: yes"><FONT=20
size=3D3><FONT face=3DCalibri> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><FONT =
face=3DCalibri><SPAN=20
style=3D"FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; =
mso-fareast-theme-font: minor-fareast; mso-no-proof: yes">James=20
Korotney<BR>Technical Consultant, Technical Architecture<BR></SPAN><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; =
mso-fareast-theme-font: minor-fareast; mso-no-proof: =
yes">Compuware</SPAN></B></FONT><SPAN=20
style=3D"FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; =
mso-fareast-theme-font: minor-fareast; mso-no-proof: yes"><BR><FONT=20
face=3DCalibri>One Campus Martius<BR>Detroit, Michigan =
48226<BR>313-227-2395=20
Direct<BR>248-760-8218 Mobile<BR>313-227-7300<BR></FONT><A=20
href=3D"mailto:john.smith@compuware.com"><SPAN=20
style=3D"COLOR: #4071b4; TEXT-DECORATION: none; mso-bidi-font-size: =
11.0pt; text-underline: none"><FONT=20
face=3DCalibri>james.korotney@compuware.com</FONT></SPAN></A></SPAN><SPAN=
=20
style=3D"mso-fareast-font-family: 'Times New Roman'; =
mso-fareast-theme-font: minor-fareast; mso-no-proof: =
yes"><o:p></o:p></SPAN></P><BR><BR>"Gunnar=20
Wagenknecht" <gunnar@wagenknecht.org> wrote in message=20
news:g54ie7$q3f$1@build.eclipse.org...<BR>> Hi,<BR>> <BR>> =
Korotney,=20
James schrieb:<BR>> <BR>>> I am using the servletbridge. =
I can=20
see my <BR>>> org.eclipse.equinox.http.registry.servlets =
registered=20
servlets fine, <BR>>> both in a jetty container as well as in =
Tomcat=20
launched within eclipse <BR>>> as a Java application. But, I =
can not=20
see any httpContexts registered <BR>>> under the extension point =
<BR>>=20
<BR>>> [...] In jetty, I can only access my servlets =
directly.<BR>>=20
<BR>> > This works:<BR>> ><BR>> >=20
http://localhost/myServlet?foo=3Dbar<BR>> ><BR>> > ****This =
does not=20
work:<BR>> ><BR>> =
> &a mp;nbsp; =20
http://localhost/myWebAppContext/myServlet?foo=3Dbar<BR>> =
><BR>> <BR>>=20
Although the OSGi HttpContext "maps" one-on-one onto a ServletContext it =
<BR>> has no influence on the URL of the servlets like the=20
ServletContext.<BR>> <BR>> In OSGi, every alias defined is applied =
to the=20
root of the HttpService. <BR>> Note, the root of the embedded Jetty =
based=20
HttpService is the real root <BR>> ("http://server/") whereas the =
root of the=20
ServletBridge based <BR>> HttpService is the web application =
root.<BR>>=20
<BR>> <BR>> > Plugin.xml:<BR>> ><BR>> >=20
<plugin><BR>> > <extension=20
point=3D"org.eclipse.equinox.http.registry.httpcontexts"> <BR>>=20
> &a mp;nbsp; &a mp;nb=
sp; =20
<httpcontext<BR>>=20
> &a mp;nbsp; &a mp;nb=
sp; &nb sp; &nb s=
p;=20
name=3D"myWebAppContext"<BR>>=20
> &a mp;nbsp; &a mp;nb=
sp; &nb sp; &nb s=
p;=20
path=3D"/myWebAppContext "><BR>>=20
> &a mp;nbsp; &a mp;nb=
sp; =20
</httpcontext><BR>>=20
> &a mp;nbsp; =
</extension><BR>>=20
<BR>> Please check the documentation. There is no "path" element. =
Also the=20
<BR>> "name" element has never made it into API.<BR>> <BR>>=20
http://help.eclipse.org/ganymede/index.jsp?topic=3D/org.ecli pse.platform.=
doc.isv/reference/extension-points/org_eclipse_equinox_http_ registry_http=
contexts.html<BR>>=20
<BR>> <BR>> -Gunnar<BR>> <BR>> -- <BR>> Gunnar=20
Wagenknecht<BR>> gunnar@wagenknecht.org<BR>>=20
http://wagenknecht.org/</FONT></DIV></BODY></HTML>
------=_NextPart_000_003F_01C8E273.22657510--
|
|
| | |
Goto Forum:
Current Time: Tue Jul 08 02:11:36 EDT 2025
Powered by FUDForum. Page generated in 0.07471 seconds
|