Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » URGENT: configure Jetty to load index.html when http://localhost is given
URGENT: configure Jetty to load index.html when http://localhost is given [message #124182] Sat, 10 January 2009 14:57 Go to next message
Walter Mising name is currently offline Walter Mising nameFriend
Messages: 128
Registered: July 2009
Senior Member
How to configure jetty to load index.html by default when hitting
http://localhost

Thanks
- Walter.
Re: URGENT: configure Jetty to load index.html when http://localhost is given [message #124375 is a reply to message #124182] Tue, 13 January 2009 14:48 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
The OSGI Http Service does not directly support "welcome files". If you want
to support this you can do this yourself by taking and customizing the
ResourceServlet. See org.eclipse.equinox.http.helpers in the Equinox
Incubator (Currently in /cvsroot/eclipse/equinox-incubator but will
eventually be moving to the RT incubator).

-Simon

"Walter Prabhakar" <kwchess@gmail.com> wrote in message
news:gkact4$l5l$1@build.eclipse.org...
> How to configure jetty to load index.html by default when hitting
> http://localhost
>
> Thanks
> - Walter.
>
>
Re: URGENT: configure Jetty to load index.html when http://localhost is given [message #124471 is a reply to message #124375] Wed, 14 January 2009 15:08 Go to previous messageGo to next message
Walter Mising name is currently offline Walter Mising nameFriend
Messages: 128
Registered: July 2009
Senior Member
Thanks Simon. It works.

"Simon Kaegi" <simon_kaegi@ca.ibm.com> wrote in message
news:gki9k0$jkk$1@build.eclipse.org...
> The OSGI Http Service does not directly support "welcome files". If you
> want to support this you can do this yourself by taking and customizing
> the ResourceServlet. See org.eclipse.equinox.http.helpers in the Equinox
> Incubator (Currently in /cvsroot/eclipse/equinox-incubator but will
> eventually be moving to the RT incubator).
>
> -Simon
>
> "Walter Prabhakar" <kwchess@gmail.com> wrote in message
> news:gkact4$l5l$1@build.eclipse.org...
>> How to configure jetty to load index.html by default when hitting
>> http://localhost
>>
>> Thanks
>> - Walter.
>>
>>
>
>
Re: URGENT: configure Jetty to load index.html when http://localhost is given [message #124484 is a reply to message #124471] Wed, 14 January 2009 16:21 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Walter,

If you have a decent implementation of WelcomeServlet would you consider
sharing it.
It would be good to iterate on a solution here and I'd like to help to get
one canonical solution that's bug-free for this problem and then add it back
into org.eclipse.equinox.http.helpers.

-Simon


"Walter Prabhakar" <kwchess@gmail.com> wrote in message
news:gkkv33$1vo$1@build.eclipse.org...
> Thanks Simon. It works.
>
> "Simon Kaegi" <simon_kaegi@ca.ibm.com> wrote in message
> news:gki9k0$jkk$1@build.eclipse.org...
>> The OSGI Http Service does not directly support "welcome files". If you
>> want to support this you can do this yourself by taking and customizing
>> the ResourceServlet. See org.eclipse.equinox.http.helpers in the Equinox
>> Incubator (Currently in /cvsroot/eclipse/equinox-incubator but will
>> eventually be moving to the RT incubator).
>>
>> -Simon
>>
>> "Walter Prabhakar" <kwchess@gmail.com> wrote in message
>> news:gkact4$l5l$1@build.eclipse.org...
>>> How to configure jetty to load index.html by default when hitting
>>> http://localhost
>>>
>>> Thanks
>>> - Walter.
>>>
>>>
>>
>>
>
Re: URGENT: configure Jetty to load index.html when http://localhost is given [message #124595 is a reply to message #124484] Thu, 15 January 2009 13:54 Go to previous message
Walter Mising name is currently offline Walter Mising nameFriend
Messages: 128
Registered: July 2009
Senior Member
Simon, I had just copied ResourceServlet to my project and added the 2
lines as shown below between <Walter> .
Basically the default page could be retrieved from init params of servlet
definition from plugin.xml and can be used instead of "/index.html".
I am not sure if this is the right solution. However, it worked for my web
page http://www.propertymapz.com

public void service(ServletRequest req, ServletResponse resp) throws
ServletException, IOException {
HttpServletRequest httpRequest = (HttpServletRequest) req;
HttpServletResponse httpResponse = (HttpServletResponse) resp;

String method = httpRequest.getMethod();
if (method.equals("GET") || method.equals("POST") ||
method.equals("HEAD")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
String resourcePath = internalName + httpRequest.getPathInfo();
// <Walter>
if ( "/".equals ( resourcePath ) )
resourcePath = "/index.html" ;
// <Walter>
if (!writeResource(httpRequest, httpResponse, resourcePath)) {
httpResponse.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
} else
httpResponse.setStatus(HttpServletResponse.SC_METHOD_NOT_ALL OWED);
}



"Simon Kaegi" <simon_kaegi@ca.ibm.com> wrote in message
news:gkl3de$a50$1@build.eclipse.org...
> Walter,
>
> If you have a decent implementation of WelcomeServlet would you consider
> sharing it.
> It would be good to iterate on a solution here and I'd like to help to get
> one canonical solution that's bug-free for this problem and then add it
> back into org.eclipse.equinox.http.helpers.
>
> -Simon
>
>
> "Walter Prabhakar" <kwchess@gmail.com> wrote in message
> news:gkkv33$1vo$1@build.eclipse.org...
>> Thanks Simon. It works.
>>
>> "Simon Kaegi" <simon_kaegi@ca.ibm.com> wrote in message
>> news:gki9k0$jkk$1@build.eclipse.org...
>>> The OSGI Http Service does not directly support "welcome files". If you
>>> want to support this you can do this yourself by taking and customizing
>>> the ResourceServlet. See org.eclipse.equinox.http.helpers in the Equinox
>>> Incubator (Currently in /cvsroot/eclipse/equinox-incubator but will
>>> eventually be moving to the RT incubator).
>>>
>>> -Simon
>>>
>>> "Walter Prabhakar" <kwchess@gmail.com> wrote in message
>>> news:gkact4$l5l$1@build.eclipse.org...
>>>> How to configure jetty to load index.html by default when hitting
>>>> http://localhost
>>>>
>>>> Thanks
>>>> - Walter.
>>>>
>>>>
>>>
>>>
>>
>
>
Previous Topic:p2 does not display installed dependency plugins.
Next Topic:Native Libraries for Mac: dylib instead of jnilib
Goto Forum:
  


Current Time: Fri Apr 26 09:13:11 GMT 2024

Powered by FUDForum. Page generated in 0.03570 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top