Question regarding jetty 6.0

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Question regarding jetty 6.0

Ikonne, Ike

Hi all,

 

I am just migrating to Jetty 6.0  from jetty 4.* and I am have some issues making jetty 4.0 code work

with jetty 6.0.  Below is a sample code that I had working in Jetty 4.0; but I have not been able to

make it work in 6.0.

 

 

 Here is what I had working in jetty 4.0

 

HttpContext context = server.getContext(config.getContext());

 

            if (this.config.getDocRoot() != null) context

                    .setResourceBase(this.config.getDocRoot());

            else

                context.setResourceBase(JettyConfigDef.DEFAULT_DOCROOT);

 

            context.addHandler(new ResourceHandler());

 

            // Add lib context to Jetty Server

            HttpContext libContext = server.getContext("/lib");

            libContext.setResourceBase(config.getLibRoot());

            libContext.addHandler(new ResourceHandler());

            server.addContext(libContext);

 

 Here  is what I think it should be in jetty 6.0:

 

 

            Context context = new Context();

            context.setContextPath(config.getContext() + "*");

            context.setResourceBase(this.config.getDocRoot());

            if (this.config.getDocRoot() != null) context

                    .setResourceBase(this.config.getDocRoot());

            else

                context.setResourceBase(JettyConfigDef.DEFAULT_DOCROOT);

           

            // Add lib context to Jetty Server

            Context libContext = new Context();

            libContext.setContextPath("/lib");

            libContext.setResourceBase(config.getLibRoot());

            //libContext.addHandler(new ResourceHandler());

            // server.addHandler(libContext);

            context.addServlet("org.mortbay.jetty.servlet.DefaultServlet",

                    "/lib");

 

            HandlerList handlers = new HandlerList();

            handlers.setHandlers(new Handler[]{context, libContext});

            server.setHandler(handlers);

 

Any suggestions and direction will be highly appreciated.

 

Thanks,

 

Ike

 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding jetty 6.0

Nik Gonzalez
Hi Ike,

You should specify at least one handler (the DefaultHandler) for your
Contexts.

Thanks!
Nik

Ikonne, Ike wrote:

>
> Hi all,
>
>  
>
> I am just migrating to Jetty 6.0  from jetty 4.* and I am have some
> issues making jetty 4.0 code work
>
> with jetty 6.0.  Below is a sample code that I had working in Jetty
> 4.0; but I have not been able to
>
> make it work in 6.0.
>
>  
>
>  
>
>  Here is what I had working in jetty 4.0
>
>  
>
> HttpContext context = server .getContext( config .getContext());
>
>  
>
>             * if * ( * this * . config .getDocRoot() != * null * )
> context
>
>                     .setResourceBase( * this * . config .getDocRoot());
>
>             * else *
>
>                 context.setResourceBase(JettyConfigDef. /
> DEFAULT_DOCROOT / );
>
>  
>
>             context.addHandler( * new * ResourceHandler());
>
>  
>
>             // Add lib context to Jetty Server
>
>             HttpContext libContext = server .getContext( "/lib" );
>
>             libContext.setResourceBase( config .getLibRoot());
>
>             libContext.addHandler( * new * ResourceHandler());
>
>             server .addContext(libContext);
>
>  
>
>  Here  is what I think it should be in jetty 6.0:
>
>  
>
>  
>
>             Context context = * new * Context();
>
>             context.setContextPath( config .getContext() + "*" );
>
>             context.setResourceBase( * this * . config .getDocRoot());
>
>             * if * ( * this * . config .getDocRoot() != * null * )
> context
>
>                     .setResourceBase( * this * . config .getDocRoot());
>
>             * else *
>
>                 context.setResourceBase(JettyConfigDef. /
> DEFAULT_DOCROOT / );
>
>            
>
>             // Add lib context to Jetty Server
>
>             Context libContext = * new * Context();
>
>             libContext.setContextPath( "/lib" );
>
>             libContext.setResourceBase( config .getLibRoot());
>
>             //libContext.addHandler(new ResourceHandler());
>
>             // server.addHandler(libContext);
>
>             context.addServlet(
> "org.mortbay.jetty.servlet.DefaultServlet" ,
>
>                     "/lib" );
>
>  
>
>             HandlerList handlers = * new * HandlerList();
>
>             handlers.setHandlers( * new * Handler[]{context,
> libContext});
>
>             server .setHandler(handlers);
>
>  
>
> Any suggestions and direction will be highly appreciated.
>
>  
>
> Thanks,
>
>  
>
> Ike
>
>  
>
> !DSPAM:599,461eeacd268589182317745!
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> !DSPAM:599,461eeacd268589182317745!
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
>
> !DSPAM:599,461eeacd268589182317745!
>  


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding jetty 6.0

Ikonne, Ike
Hi Nick,

I added the change as you suggested:

ContextHandler context = new ContextHandler();
context.setContextPath(config.getContext());
context.setResourceBase(this.config.getDocRoot());
context.addHandler(new DefaultHandler());
server.addHandler(context);


// Add lib context to Jetty Server
ContextHandler libContext = new ContextHandler();
libContext.setContextPath("/lib");
lbContext.setResourceBase(config.getLibRoot());
libContext.addHandler(new DefaultHandler());
server.addHandler(libContext);


when I  try to access the index.html, http://localhost:8080/
I get the following error message;

Error 404 - Not Found.
No context on this server matched or handled this request.
Contexts known to this server are:
/ --->
org.mortbay.jetty.handler.ContextHandler@1ad0839{/,file:/C:/development/
myconfig-04122007/dist/conf/jetty/docroot/}

/lib --->
org.mortbay.jetty.handler.ContextHandler@6576d5{/lib,file:/C:/developmen
t/myconfig-04122007/dist/lib/}

Do you have an idea of what I am doing wrong?  Thanks.

Ike

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Nik
Gonzalez
Sent: Thursday, April 12, 2007 11:24 PM
To: Jetty usage, help & informal support
Subject: Re: [Jetty-support] Question regarding jetty 6.0

Hi Ike,

You should specify at least one handler (the DefaultHandler) for your
Contexts.

Thanks!
Nik

Ikonne, Ike wrote:

>
> Hi all,
>
>  
>
> I am just migrating to Jetty 6.0  from jetty 4.* and I am have some
> issues making jetty 4.0 code work
>
> with jetty 6.0.  Below is a sample code that I had working in Jetty
> 4.0; but I have not been able to
>
> make it work in 6.0.
>
>  
>
>  
>
>  Here is what I had working in jetty 4.0
>
>  
>
> HttpContext context = server .getContext( config .getContext());
>
>  
>
>             * if * ( * this * . config .getDocRoot() != * null * )
> context
>
>                     .setResourceBase( * this * . config
.getDocRoot());

>
>             * else *
>
>                 context.setResourceBase(JettyConfigDef. /
> DEFAULT_DOCROOT / );
>
>  
>
>             context.addHandler( * new * ResourceHandler());
>
>  
>
>             // Add lib context to Jetty Server
>
>             HttpContext libContext = server .getContext( "/lib" );
>
>             libContext.setResourceBase( config .getLibRoot());
>
>             libContext.addHandler( * new * ResourceHandler());
>
>             server .addContext(libContext);
>
>  
>
>  Here  is what I think it should be in jetty 6.0:
>
>  
>
>  
>
>             Context context = * new * Context();
>
>             context.setContextPath( config .getContext() + "*" );
>
>             context.setResourceBase( * this * . config .getDocRoot());
>
>             * if * ( * this * . config .getDocRoot() != * null * )
> context
>
>                     .setResourceBase( * this * . config
.getDocRoot());

>
>             * else *
>
>                 context.setResourceBase(JettyConfigDef. /
> DEFAULT_DOCROOT / );
>
>            
>
>             // Add lib context to Jetty Server
>
>             Context libContext = * new * Context();
>
>             libContext.setContextPath( "/lib" );
>
>             libContext.setResourceBase( config .getLibRoot());
>
>             //libContext.addHandler(new ResourceHandler());
>
>             // server.addHandler(libContext);
>
>             context.addServlet(
> "org.mortbay.jetty.servlet.DefaultServlet" ,
>
>                     "/lib" );
>
>  
>
>             HandlerList handlers = * new * HandlerList();
>
>             handlers.setHandlers( * new * Handler[]{context,
> libContext});
>
>             server .setHandler(handlers);
>
>  
>
> Any suggestions and direction will be highly appreciated.
>
>  
>
> Thanks,
>
>  
>
> Ike
>
>  
>
> !DSPAM:599,461eeacd268589182317745!
>
------------------------------------------------------------------------
>
>
------------------------------------------------------------------------
-
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
share your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
>
> !DSPAM:599,461eeacd268589182317745!
>  
>
------------------------------------------------------------------------
>
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
>
> !DSPAM:599,461eeacd268589182317745!
>  


------------------------------------------------------------------------
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding jetty 6.0

Nik Gonzalez
Hi Ike,

I'm sorry. I gave you the wrong code.

If what you want to do is serve static content on these contexts, here's
how to do it:

        org.mortbay.jetty.servlet.Context context = new
org.mortbay.jetty.servlet.Context(server,"/");
        context.setResourceBase("c:/apps");
        context.addServlet(DefaultServlet.class,"/*");

HTH,
Nik
Ikonne, Ike wrote:

> Hi Nick,
>
> I added the change as you suggested:
>
> ContextHandler context = new ContextHandler();
> context.setContextPath(config.getContext());
> context.setResourceBase(this.config.getDocRoot());
> context.addHandler(new DefaultHandler());
> server.addHandler(context);
>
>
> // Add lib context to Jetty Server
> ContextHandler libContext = new ContextHandler();
> libContext.setContextPath("/lib");
> lbContext.setResourceBase(config.getLibRoot());
> libContext.addHandler(new DefaultHandler());
> server.addHandler(libContext);
>
>
> when I  try to access the index.html, http://localhost:8080/
> I get the following error message;
>
> Error 404 - Not Found.
> No context on this server matched or handled this request.
> Contexts known to this server are:
> / --->
> org.mortbay.jetty.handler.ContextHandler@1ad0839{/,file:/C:/development/
> myconfig-04122007/dist/conf/jetty/docroot/}
>
> /lib --->
> org.mortbay.jetty.handler.ContextHandler@6576d5{/lib,file:/C:/developmen
> t/myconfig-04122007/dist/lib/}
>
> Do you have an idea of what I am doing wrong?  Thanks.
>
> Ike
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Nik
> Gonzalez
> Sent: Thursday, April 12, 2007 11:24 PM
> To: Jetty usage, help & informal support
> Subject: Re: [Jetty-support] Question regarding jetty 6.0
>
> Hi Ike,
>
> You should specify at least one handler (the DefaultHandler) for your
> Contexts.
>
> Thanks!
> Nik
>
> Ikonne, Ike wrote:
>  
>> Hi all,
>>
>>  
>>
>> I am just migrating to Jetty 6.0  from jetty 4.* and I am have some
>> issues making jetty 4.0 code work
>>
>> with jetty 6.0.  Below is a sample code that I had working in Jetty
>> 4.0; but I have not been able to
>>
>> make it work in 6.0.
>>
>>  
>>
>>  
>>
>>  Here is what I had working in jetty 4.0
>>
>>  
>>
>> HttpContext context = server .getContext( config .getContext());
>>
>>  
>>
>>             * if * ( * this * . config .getDocRoot() != * null * )
>> context
>>
>>                     .setResourceBase( * this * . config
>>    
> .getDocRoot());
>  
>>             * else *
>>
>>                 context.setResourceBase(JettyConfigDef. /
>> DEFAULT_DOCROOT / );
>>
>>  
>>
>>             context.addHandler( * new * ResourceHandler());
>>
>>  
>>
>>             // Add lib context to Jetty Server
>>
>>             HttpContext libContext = server .getContext( "/lib" );
>>
>>             libContext.setResourceBase( config .getLibRoot());
>>
>>             libContext.addHandler( * new * ResourceHandler());
>>
>>             server .addContext(libContext);
>>
>>  
>>
>>  Here  is what I think it should be in jetty 6.0:
>>
>>  
>>
>>  
>>
>>             Context context = * new * Context();
>>
>>             context.setContextPath( config .getContext() + "*" );
>>
>>             context.setResourceBase( * this * . config .getDocRoot());
>>
>>             * if * ( * this * . config .getDocRoot() != * null * )
>> context
>>
>>                     .setResourceBase( * this * . config
>>    
> .getDocRoot());
>  
>>             * else *
>>
>>                 context.setResourceBase(JettyConfigDef. /
>> DEFAULT_DOCROOT / );
>>
>>            
>>
>>             // Add lib context to Jetty Server
>>
>>             Context libContext = * new * Context();
>>
>>             libContext.setContextPath( "/lib" );
>>
>>             libContext.setResourceBase( config .getLibRoot());
>>
>>             //libContext.addHandler(new ResourceHandler());
>>
>>             // server.addHandler(libContext);
>>
>>             context.addServlet(
>> "org.mortbay.jetty.servlet.DefaultServlet" ,
>>
>>                     "/lib" );
>>
>>  
>>
>>             HandlerList handlers = * new * HandlerList();
>>
>>             handlers.setHandlers( * new * Handler[]{context,
>> libContext});
>>
>>             server .setHandler(handlers);
>>
>>  
>>
>> Any suggestions and direction will be highly appreciated.
>>
>>  
>>
>> Thanks,
>>
>>  
>>
>> Ike
>>
>>  
>>
>>
>>
>>    
> ------------------------------------------------------------------------
>  
>>    
> ------------------------------------------------------------------------
> -
>  
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>>    
> share your
>  
>> opinions on IT & business topics through brief surveys-and earn cash
>>
>>    
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
> V
>  
>> !DSPAM:599,461eeacd268589182317745!
>>  
>>
>>    
> ------------------------------------------------------------------------
>  
>> _______________________________________________
>> Jetty-support mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/jetty-support
>>
>>
>> !DSPAM:599,461eeacd268589182317745!
>>  
>>    
>
>
> ------------------------------------------------------------------------
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
> V
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
> !DSPAM:599,461f118e90046139781565!
>
>  


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding jetty 6.0

Ikonne, Ike
Hi Nik and HTH,

I tried your suggestions regarding this issue and I am
getting better response than before; however, I still
have a mapping issue.  Here is my scenario: I have three
contexts:

Context context = new Context(server, "/");
context.setResourceBase("../conf/jetty/docroot");
context.addServlet(DefaultServlet.class, "/*");
String []welcome = new String[] {"index.htm", "index.html",            
context.setWelcomeFiles(welcome);
server.addHandler(context);


Context context1 = new Context(server, "lib");
context1.setResourceBase("../lib");
context1.addServlet(DefaultServlet.class, "/lib/*");
server.addHandler(context1);

wac = new WebAppContext();
wac.setContextPath("/" + SspJsf + "/*");
wac.setWar(warPathFile.getAbsolutePath());


When I try to retirve
http://localhost:8080/lib/myfile.jar
http://localhost:8080/SspJsf/

Jetty could not find these resources because
it is looking for them starting from
http://localhost:8080/conf/jetty/docroot/lib/myfile.jar
http://localhost:8080/conf/jetty/docroot/SspJsf/

Why is this happening?  Any suggestions will help.

Thanks,

Ike







-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Nik
Gonzalez
Sent: Friday, April 13, 2007 12:49 AM
To: Jetty usage, help & informal support
Subject: Re: [Jetty-support] Question regarding jetty 6.0

Hi Ike,

I'm sorry. I gave you the wrong code.

If what you want to do is serve static content on these contexts, here's

how to do it:

        org.mortbay.jetty.servlet.Context context = new
org.mortbay.jetty.servlet.Context(server,"/");
        context.setResourceBase("c:/apps");
        context.addServlet(DefaultServlet.class,"/*");

HTH,
Nik
Ikonne, Ike wrote:

> Hi Nick,
>
> I added the change as you suggested:
>
> ContextHandler context = new ContextHandler();
> context.setContextPath(config.getContext());
> context.setResourceBase(this.config.getDocRoot());
> context.addHandler(new DefaultHandler());
> server.addHandler(context);
>
>
> // Add lib context to Jetty Server
> ContextHandler libContext = new ContextHandler();
> libContext.setContextPath("/lib");
> lbContext.setResourceBase(config.getLibRoot());
> libContext.addHandler(new DefaultHandler());
> server.addHandler(libContext);
>
>
> when I  try to access the index.html, http://localhost:8080/
> I get the following error message;
>
> Error 404 - Not Found.
> No context on this server matched or handled this request.
> Contexts known to this server are:
> / --->
>
org.mortbay.jetty.handler.ContextHandler@1ad0839{/,file:/C:/development/
> myconfig-04122007/dist/conf/jetty/docroot/}
>
> /lib --->
>
org.mortbay.jetty.handler.ContextHandler@6576d5{/lib,file:/C:/developmen

> t/myconfig-04122007/dist/lib/}
>
> Do you have an idea of what I am doing wrong?  Thanks.
>
> Ike
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Nik
> Gonzalez
> Sent: Thursday, April 12, 2007 11:24 PM
> To: Jetty usage, help & informal support
> Subject: Re: [Jetty-support] Question regarding jetty 6.0
>
> Hi Ike,
>
> You should specify at least one handler (the DefaultHandler) for your
> Contexts.
>
> Thanks!
> Nik
>
> Ikonne, Ike wrote:
>  
>> Hi all,
>>
>>  
>>
>> I am just migrating to Jetty 6.0  from jetty 4.* and I am have some
>> issues making jetty 4.0 code work
>>
>> with jetty 6.0.  Below is a sample code that I had working in Jetty
>> 4.0; but I have not been able to
>>
>> make it work in 6.0.
>>
>>  
>>
>>  
>>
>>  Here is what I had working in jetty 4.0
>>
>>  
>>
>> HttpContext context = server .getContext( config .getContext());
>>
>>  
>>
>>             * if * ( * this * . config .getDocRoot() != * null * )
>> context
>>
>>                     .setResourceBase( * this * . config
>>    
> .getDocRoot());
>  
>>             * else *
>>
>>                 context.setResourceBase(JettyConfigDef. /
>> DEFAULT_DOCROOT / );
>>
>>  
>>
>>             context.addHandler( * new * ResourceHandler());
>>
>>  
>>
>>             // Add lib context to Jetty Server
>>
>>             HttpContext libContext = server .getContext( "/lib" );
>>
>>             libContext.setResourceBase( config .getLibRoot());
>>
>>             libContext.addHandler( * new * ResourceHandler());
>>
>>             server .addContext(libContext);
>>
>>  
>>
>>  Here  is what I think it should be in jetty 6.0:
>>
>>  
>>
>>  
>>
>>             Context context = * new * Context();
>>
>>             context.setContextPath( config .getContext() + "*" );
>>
>>             context.setResourceBase( * this * . config
.getDocRoot());

>>
>>             * if * ( * this * . config .getDocRoot() != * null * )
>> context
>>
>>                     .setResourceBase( * this * . config
>>    
> .getDocRoot());
>  
>>             * else *
>>
>>                 context.setResourceBase(JettyConfigDef. /
>> DEFAULT_DOCROOT / );
>>
>>            
>>
>>             // Add lib context to Jetty Server
>>
>>             Context libContext = * new * Context();
>>
>>             libContext.setContextPath( "/lib" );
>>
>>             libContext.setResourceBase( config .getLibRoot());
>>
>>             //libContext.addHandler(new ResourceHandler());
>>
>>             // server.addHandler(libContext);
>>
>>             context.addServlet(
>> "org.mortbay.jetty.servlet.DefaultServlet" ,
>>
>>                     "/lib" );
>>
>>  
>>
>>             HandlerList handlers = * new * HandlerList();
>>
>>             handlers.setHandlers( * new * Handler[]{context,
>> libContext});
>>
>>             server .setHandler(handlers);
>>
>>  
>>
>> Any suggestions and direction will be highly appreciated.
>>
>>  
>>
>> Thanks,
>>
>>  
>>
>> Ike
>>
>>  
>>
>>
>>
>>    
>
------------------------------------------------------------------------
>  
>>    
>
------------------------------------------------------------------------

> -
>  
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>>    
> share your
>  
>> opinions on IT & business topics through brief surveys-and earn cash
>>
>>    
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
> V
>  
>> !DSPAM:599,461eeacd268589182317745!
>>  
>>
>>    
>
------------------------------------------------------------------------

>  
>> _______________________________________________
>> Jetty-support mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/jetty-support
>>
>>
>> !DSPAM:599,461eeacd268589182317745!
>>  
>>    
>
>
>
------------------------------------------------------------------------
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
share
> your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
> V
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
>
------------------------------------------------------------------------
-
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
share your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
> !DSPAM:599,461f118e90046139781565!
>
>  


------------------------------------------------------------------------
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding jetty 6.0

Ikonne, Ike

Hi Nik and HTH,

I tried your suggestions regarding this issue and I am getting better
response than before; however, I still have a mapping issue.  Here is my
scenario: I have three
contexts:

Context context = new Context(server, "/");
context.setResourceBase("../conf/jetty/docroot");
context.addServlet(DefaultServlet.class, "/*");
String []welcome = new String[] {"index.htm", "index.html",            
context.setWelcomeFiles(welcome);
server.addHandler(context);


Context context1 = new Context(server, "lib");
context1.setResourceBase("../lib");
context1.addServlet(DefaultServlet.class, "/lib/*");
server.addHandler(context1);

wac = new WebAppContext();
wac.setContextPath("/" + SspJsf + "/*");
wac.setWar(warPathFile.getAbsolutePath());


When I try to retirve
http://localhost:8080/lib/myfile.jar
http://localhost:8080/SspJsf/

Jetty could not find these resources because it is looking for them
starting from http://localhost:8080/conf/jetty/docroot/lib/myfile.jar
http://localhost:8080/conf/jetty/docroot/SspJsf/

Why is this happening?  Any suggestions will help.

Thanks,

Ike





-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
Ikonne, Ike
Sent: Friday, April 13, 2007 3:38 PM
To: Jetty usage, help & informal support
Subject: Re: [Jetty-support] Question regarding jetty 6.0

Hi Nik and HTH,

I tried your suggestions regarding this issue and I am
getting better response than before; however, I still
have a mapping issue.  Here is my scenario: I have three
contexts:

Context context = new Context(server, "/");
context.setResourceBase("../conf/jetty/docroot");
context.addServlet(DefaultServlet.class, "/*");
String []welcome = new String[] {"index.htm", "index.html",            
context.setWelcomeFiles(welcome);
server.addHandler(context);


Context context1 = new Context(server, "lib");
context1.setResourceBase("../lib");
context1.addServlet(DefaultServlet.class, "/lib/*");
server.addHandler(context1);

wac = new WebAppContext();
wac.setContextPath("/" + SspJsf + "/*");
wac.setWar(warPathFile.getAbsolutePath());


When I try to retirve
http://localhost:8080/lib/myfile.jar
http://localhost:8080/SspJsf/

Jetty could not find these resources because
it is looking for them starting from
http://localhost:8080/conf/jetty/docroot/lib/myfile.jar
http://localhost:8080/conf/jetty/docroot/SspJsf/

Why is this happening?  Any suggestions will help.

Thanks,

Ike







-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Nik
Gonzalez
Sent: Friday, April 13, 2007 12:49 AM
To: Jetty usage, help & informal support
Subject: Re: [Jetty-support] Question regarding jetty 6.0

Hi Ike,

I'm sorry. I gave you the wrong code.

If what you want to do is serve static content on these contexts, here's

how to do it:

        org.mortbay.jetty.servlet.Context context = new
org.mortbay.jetty.servlet.Context(server,"/");
        context.setResourceBase("c:/apps");
        context.addServlet(DefaultServlet.class,"/*");

HTH,
Nik
Ikonne, Ike wrote:

> Hi Nick,
>
> I added the change as you suggested:
>
> ContextHandler context = new ContextHandler();
> context.setContextPath(config.getContext());
> context.setResourceBase(this.config.getDocRoot());
> context.addHandler(new DefaultHandler());
> server.addHandler(context);
>
>
> // Add lib context to Jetty Server
> ContextHandler libContext = new ContextHandler();
> libContext.setContextPath("/lib");
> lbContext.setResourceBase(config.getLibRoot());
> libContext.addHandler(new DefaultHandler());
> server.addHandler(libContext);
>
>
> when I  try to access the index.html, http://localhost:8080/
> I get the following error message;
>
> Error 404 - Not Found.
> No context on this server matched or handled this request.
> Contexts known to this server are:
> / --->
>
org.mortbay.jetty.handler.ContextHandler@1ad0839{/,file:/C:/development/
> myconfig-04122007/dist/conf/jetty/docroot/}
>
> /lib --->
>
org.mortbay.jetty.handler.ContextHandler@6576d5{/lib,file:/C:/developmen

> t/myconfig-04122007/dist/lib/}
>
> Do you have an idea of what I am doing wrong?  Thanks.
>
> Ike
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Nik
> Gonzalez
> Sent: Thursday, April 12, 2007 11:24 PM
> To: Jetty usage, help & informal support
> Subject: Re: [Jetty-support] Question regarding jetty 6.0
>
> Hi Ike,
>
> You should specify at least one handler (the DefaultHandler) for your
> Contexts.
>
> Thanks!
> Nik
>
> Ikonne, Ike wrote:
>  
>> Hi all,
>>
>>  
>>
>> I am just migrating to Jetty 6.0  from jetty 4.* and I am have some
>> issues making jetty 4.0 code work
>>
>> with jetty 6.0.  Below is a sample code that I had working in Jetty
>> 4.0; but I have not been able to
>>
>> make it work in 6.0.
>>
>>  
>>
>>  
>>
>>  Here is what I had working in jetty 4.0
>>
>>  
>>
>> HttpContext context = server .getContext( config .getContext());
>>
>>  
>>
>>             * if * ( * this * . config .getDocRoot() != * null * )
>> context
>>
>>                     .setResourceBase( * this * . config
>>    
> .getDocRoot());
>  
>>             * else *
>>
>>                 context.setResourceBase(JettyConfigDef. /
>> DEFAULT_DOCROOT / );
>>
>>  
>>
>>             context.addHandler( * new * ResourceHandler());
>>
>>  
>>
>>             // Add lib context to Jetty Server
>>
>>             HttpContext libContext = server .getContext( "/lib" );
>>
>>             libContext.setResourceBase( config .getLibRoot());
>>
>>             libContext.addHandler( * new * ResourceHandler());
>>
>>             server .addContext(libContext);
>>
>>  
>>
>>  Here  is what I think it should be in jetty 6.0:
>>
>>  
>>
>>  
>>
>>             Context context = * new * Context();
>>
>>             context.setContextPath( config .getContext() + "*" );
>>
>>             context.setResourceBase( * this * . config
.getDocRoot());

>>
>>             * if * ( * this * . config .getDocRoot() != * null * )
>> context
>>
>>                     .setResourceBase( * this * . config
>>    
> .getDocRoot());
>  
>>             * else *
>>
>>                 context.setResourceBase(JettyConfigDef. /
>> DEFAULT_DOCROOT / );
>>
>>            
>>
>>             // Add lib context to Jetty Server
>>
>>             Context libContext = * new * Context();
>>
>>             libContext.setContextPath( "/lib" );
>>
>>             libContext.setResourceBase( config .getLibRoot());
>>
>>             //libContext.addHandler(new ResourceHandler());
>>
>>             // server.addHandler(libContext);
>>
>>             context.addServlet(
>> "org.mortbay.jetty.servlet.DefaultServlet" ,
>>
>>                     "/lib" );
>>
>>  
>>
>>             HandlerList handlers = * new * HandlerList();
>>
>>             handlers.setHandlers( * new * Handler[]{context,
>> libContext});
>>
>>             server .setHandler(handlers);
>>
>>  
>>
>> Any suggestions and direction will be highly appreciated.
>>
>>  
>>
>> Thanks,
>>
>>  
>>
>> Ike
>>
>>  
>>
>>
>>
>>    
>
------------------------------------------------------------------------
>  
>>    
>
------------------------------------------------------------------------

> -
>  
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to
>>    
> share your
>  
>> opinions on IT & business topics through brief surveys-and earn cash
>>
>>    
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
> V
>  
>> !DSPAM:599,461eeacd268589182317745!
>>  
>>
>>    
>
------------------------------------------------------------------------

>  
>> _______________________________________________
>> Jetty-support mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/jetty-support
>>
>>
>> !DSPAM:599,461eeacd268589182317745!
>>  
>>    
>
>
>
------------------------------------------------------------------------
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
share
> your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
> V
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
>
------------------------------------------------------------------------
-
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
share your
> opinions on IT & business topics through brief surveys-and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
> !DSPAM:599,461f118e90046139781565!
>
>  


------------------------------------------------------------------------
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support

------------------------------------------------------------------------
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support