Jan Bartel | 1 Oct 2008 05:31

Re: [jetty-user] CGI Servlet Autoflush

Bill,

Hhhmm. Difficult to see how this could be done,
although someone else may have more insight than
me.

The CGI servlet hooks up the output stream from
the exec'd script to the servlet output stream.

That stream would then get flushed to the client
in 3 circumstances:

1) someone calls response.getOutputStream().flush()
2) the amount of output exceeds the internal buffer
   size (6k for headers and 32k for content)
3) someone calls response.getOutputStream().close()

So, as you are writing only a very few bytes, 2)
won't apply. 3) only happens when the exec'd process
finishes. Leaving us with 1). Currently, the output
from the exec'd script is copied directly to the 
servlet's output stream and the internal buffering
mechanism. There is no opportunity to insert a flush().
We could of course change the CGI servlet so it
arbitrarily inserts a flush() after copying a 
configurable number of bytes. However, usually you don't 
want to call flush() as this puts the servlet's
io into a synchronous mode - meaning it has to wait for
those bytes to reach the other end and be acknowledged.
For throughput reasons, you generally don't want to do
(Continue reading)

Tribley William-cwt010 | 1 Oct 2008 16:00

RE: [jetty-user] CGI Servlet Autoflush

Hi Jan,
Based on your response I looked at the javadocs. I see that there is a
flush() method, but no property like autoflush that could be set true.
Since both Jetty and Tomcat exhibit the same behavior, it looks like a
dead end. 

The problem I have is that I am using a servlet engine to fire a cgi
that launches either an ant script or a shell script to do a software
release. The release takes anywhere from 10 to 150 seconds. During that
time, the screen looks as if nothing is happening at all beyond the
little dotted-box around the text in the submit button. 

I think I will add an animated marquee to the user interface that is
started when the request is sent and stops when it comes back. That way
people will know that something is happening.

Apache autoflushes by default, problem is I don't have root on the
servers and our sysadmins wrongly think that Apache or other web servers
are resource hogs, so I am restricted to some kind of Java-based web
server. 

Your help is appreciated.

Best regards,
Bill 

-----Original Message-----
From: Jan Bartel [mailto:janb <at> webtide.com] 
Sent: Tuesday, September 30, 2008 10:31 PM
To: user <at> jetty.codehaus.org
(Continue reading)

Tony Thompson | 1 Oct 2008 21:50
Favicon

[jetty-user] RE: Filter Question

Anyone willing to offer a suggestion to resolve this?
 
 
I am not sure if this is really a Jetty question or not but I thought someone may have an answer for this.  For a given web application, I have an error page configured in the web.xml for a 403 error code.  In this web application I also have a servlet filter configured that could send a 403 response.  When the filter sends a 403 error response, Jetty will not return the error page.  The servlet filter is my code so, do I need to do something differently in the filter to make it return the 403 error page?  Or is there an issue in Jetty that is preventing the error page from being returned (I am still using Jetty 5)?
 
Any pointers on a way to debug this would be appreciated.
Tony
 
This message (and any associated files) is intended only for the
use of the individual or entity to which it is addressed and may
contain information that is confidential, subject to copyright or
constitutes a trade secret. If you are not the intended recipient
you are hereby notified that any dissemination, copying or
distribution of this message, or files associated with this message,
is strictly prohibited. If you have received this message in error,
please notify us immediately by replying to the message and deleting
it from your computer. Messages sent to and from Stoneware, Inc.
may be monitored.

Athena Yao | 2 Oct 2008 13:47

Re: [jetty-user] RE: Filter Question

Tom,

Not familiar with Jetty 5, but I'm seeing this behavior as well on Jetty
6 when I call response.sendError() from a filter, and that filter
applies to the error page.

What I'm seeing is that the request cycles through:

error-throwing filter -> ErrorPageErrorHandler.handle -> dispatch ->
ServletHandler.handle -> chain.doFilter ( ->
ErrorPageErrorHandler.handle...), changing the stored value of the error
page.

If you break the cycle, then the error page you set in your web.xml will
show up. Try making sure that your filter is not being applied to the
path/servlet for the error page. 

Cheers,
Athena

On Wed, 2008-10-01 at 15:50 -0400, Tony Thompson wrote:
> Anyone willing to offer a suggestion to resolve this?
>  
>  
> 
> I am not sure if this is really a Jetty question or not but I thought
> someone may have an answer for this.  For a given web application, I
> have an error page configured in the web.xml for a 403 error code.  In
> this web application I also have a servlet filter configured that
> could send a 403 response.  When the filter sends a 403 error
> response, Jetty will not return the error page.  The servlet filter is
> my code so, do I need to do something differently in the filter to
> make it return the 403 error page?  Or is there an issue in Jetty that
> is preventing the error page from being returned (I am still using
> Jetty 5)?
>  
> Any pointers on a way to debug this would be appreciated.
> Tony
>  
> This message (and any associated files) is intended only for the 
> use of the individual or entity to which it is addressed and may 
> contain information that is confidential, subject to copyright or
> constitutes a trade secret. If you are not the intended recipient 
> you are hereby notified that any dissemination, copying or 
> distribution of this message, or files associated with this message, 
> is strictly prohibited. If you have received this message in error, 
> please notify us immediately by replying to the message and deleting 
> it from your computer. Messages sent to and from Stoneware, Inc.
> may be monitored. 
> 
> 

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Tony Thompson | 2 Oct 2008 16:37
Favicon

RE: [jetty-user] RE: Filter Question

That was it.  I had it dispatching for "all" and my filter was being
called twice for the request.

Thanks for the help.
Tony 

-----Original Message-----
From: Athena Yao [mailto:athena <at> webtide.com] 
Sent: Thursday, October 02, 2008 7:48 AM
To: user <at> jetty.codehaus.org
Subject: Re: [jetty-user] RE: Filter Question

Tom,

Not familiar with Jetty 5, but I'm seeing this behavior as well on Jetty
6 when I call response.sendError() from a filter, and that filter
applies to the error page.

What I'm seeing is that the request cycles through:

error-throwing filter -> ErrorPageErrorHandler.handle -> dispatch ->
ServletHandler.handle -> chain.doFilter ( ->
ErrorPageErrorHandler.handle...), changing the stored value of the error
page.

If you break the cycle, then the error page you set in your web.xml will
show up. Try making sure that your filter is not being applied to the
path/servlet for the error page. 

Cheers,
Athena

On Wed, 2008-10-01 at 15:50 -0400, Tony Thompson wrote:
> Anyone willing to offer a suggestion to resolve this?
>  
>  
> 
> I am not sure if this is really a Jetty question or not but I thought 
> someone may have an answer for this.  For a given web application, I 
> have an error page configured in the web.xml for a 403 error code.  In

> this web application I also have a servlet filter configured that 
> could send a 403 response.  When the filter sends a 403 error 
> response, Jetty will not return the error page.  The servlet filter is

> my code so, do I need to do something differently in the filter to 
> make it return the 403 error page?  Or is there an issue in Jetty that

> is preventing the error page from being returned (I am still using 
> Jetty 5)?
>  
> Any pointers on a way to debug this would be appreciated.
> Tony
>  
> This message (and any associated files) is intended only for the use 
> of the individual or entity to which it is addressed and may contain 
> information that is confidential, subject to copyright or constitutes 
> a trade secret. If you are not the intended recipient you are hereby 
> notified that any dissemination, copying or distribution of this 
> message, or files associated with this message, is strictly 
> prohibited. If you have received this message in error, please notify 
> us immediately by replying to the message and deleting it from your 
> computer. Messages sent to and from Stoneware, Inc.
> may be monitored. 
> 
> 

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Fawzib H Rojas Romero | 2 Oct 2008 17:03
Favicon

[jetty-user] Jetty JDNI and data sources

I'm trying to setup a JDNI data source for a MS SQL server but I'm not sure if
the order/information is ok. Also I want to use JAASUserRealm to authenticate
the website. The first thing I'm trying to do is create the data source and
configure the JAASUserRealm, but that's not working. JAASUserRealm is looking
for the database source but it won't find it. I've placed the resource inside
the webcontext and outside of it. Nothing. Its my first time configuring this so
I'm sure it's something easy. 

jetty.xml:

<Configure id="Server" class="org.mortbay.jetty.Server">

   <Array id="plusConfig" type="java.lang.String">.....snip....</Array>

   <!-- this is created ok -->
   <New id="my_msim" class="org.mortbay.jetty.plus.naming.Resource">
     <Arg>jdbc/msim_db</Arg>
     <Arg>
        <New class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
          <Set name="ServerName">x.x.x.x</Set>                     
          <Set name="DatabaseName">catalog</Set>                         
          <Set name="User">xxx</Set>
          <Set name="Password">xxx</Set>
       </New>
     </Arg>
   </New>        

   <Call name="addHandler">
     <Arg>
     <New class="org.mortbay.jetty.webapp.WebAppContext">
     ....snip....
     <Set name="configurationClasses"><Ref id="plusConfig"/></Set>
     </New>
     </Arg>
   </Call>

   <Set name="UserRealms">
     <Array type="org.mortbay.jetty.security.UserRealm">
     <!--  this works ok, but I want the JNDI datasource
     <Item>
       <New class="org.mortbay.jetty.security.JDBCUserRealm">
         <Set name="name">Spectron Realm</Set>
         <Set name="config">config/jdbcRealm.properties</Set>
         <Set name="refreshInterval">0</Set>
       </New>
     </Item>
     -->
     <Item>
       <New class="org.mortbay.jetty.plus.jaas.JAASUserRealm">
         <Set name="Name">Spectron Realm</Set>
         <Set name="LoginModuleName">msim_ds</Set>
       </New>
     </Item>
     </Array>
   </Set>

login.conf (in dbJNDIName I've used full name and "jdbc/msimdb"):

msim_ds {
    org.mortbay.jetty.plus.jaas.spi.DataSourceLoginModule required
    debug="true"
    dbJNDIName="java:comp/env/jdbc/msim_db"
    userTable="NoLockUsers"
    userField="userName"
    credentialField="password"
    userRoleTable="NoLockRoles"
    userRoleUserField="userName"
    userRoleRoleField="roleName";
   };

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Serge Fonville | 2 Oct 2008 20:05
Picon

[jetty-user] Fwd: Auto loading taglib

Currently I am researching moving from Tomcat 6.0.18 to Jetty 6.1.11

Although configuring has taken quite some time (1-2 hours), I managed to get it working.

While looking through the javadocs, I could not determince if it is possible to automatically load tag libraries (for example by defining them in WEB-INF/web.xml
I want to use a custom tag without the need to reference the corresponsing jar containing the tag library on every jsp page.

Is this at all possible in Jetty and if yes, how should I do that

Thanks a lot in advance

Jan Bartel | 2 Oct 2008 23:34

Re: [jetty-user] Jetty JDNI and data sources

Fawzib,

Change

dbJNDIName="java:comp/env/jdbc/msim_db"

to be

dbJNDIName="jdbc/msim_db"

And ensure you have a <resource-ref> set up in your web.xml
for that jndi name.

cheers
Jan

Fawzib H Rojas Romero wrote:
> I'm trying to setup a JDNI data source for a MS SQL server but I'm not sure if
> the order/information is ok. Also I want to use JAASUserRealm to authenticate
> the website. The first thing I'm trying to do is create the data source and
> configure the JAASUserRealm, but that's not working. JAASUserRealm is looking
> for the database source but it won't find it. I've placed the resource inside
> the webcontext and outside of it. Nothing. Its my first time configuring this so
> I'm sure it's something easy. 
> 
> jetty.xml:
> 
> <Configure id="Server" class="org.mortbay.jetty.Server">
> 
>    <Array id="plusConfig" type="java.lang.String">.....snip....</Array>
> 
>    <!-- this is created ok -->
>    <New id="my_msim" class="org.mortbay.jetty.plus.naming.Resource">
>      <Arg>jdbc/msim_db</Arg>
>      <Arg>
>         <New class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
>           <Set name="ServerName">x.x.x.x</Set>                     
>           <Set name="DatabaseName">catalog</Set>                         
>           <Set name="User">xxx</Set>
>           <Set name="Password">xxx</Set>
>        </New>
>      </Arg>
>    </New>        
> 
>    <Call name="addHandler">
>      <Arg>
>      <New class="org.mortbay.jetty.webapp.WebAppContext">
>      ....snip....
>      <Set name="configurationClasses"><Ref id="plusConfig"/></Set>
>      </New>
>      </Arg>
>    </Call>
> 
>    <Set name="UserRealms">
>      <Array type="org.mortbay.jetty.security.UserRealm">
>      <!--  this works ok, but I want the JNDI datasource
>      <Item>
>        <New class="org.mortbay.jetty.security.JDBCUserRealm">
>          <Set name="name">Spectron Realm</Set>
>          <Set name="config">config/jdbcRealm.properties</Set>
>          <Set name="refreshInterval">0</Set>
>        </New>
>      </Item>
>      -->
>      <Item>
>        <New class="org.mortbay.jetty.plus.jaas.JAASUserRealm">
>          <Set name="Name">Spectron Realm</Set>
>          <Set name="LoginModuleName">msim_ds</Set>
>        </New>
>      </Item>
>      </Array>
>    </Set>
> 
> login.conf (in dbJNDIName I've used full name and "jdbc/msimdb"):
> 
> msim_ds {
>     org.mortbay.jetty.plus.jaas.spi.DataSourceLoginModule required
>     debug="true"
>     dbJNDIName="java:comp/env/jdbc/msim_db"
>     userTable="NoLockUsers"
>     userField="userName"
>     credentialField="password"
>     userRoleTable="NoLockRoles"
>     userRoleUserField="userName"
>     userRoleRoleField="roleName";
>    };
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 

--

-- 
Jan Bartel, Webtide LLC | janb <at> webtide.com | http://www.webtide.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

David Yu | 3 Oct 2008 05:36

Re: [jetty-user] Fwd: Auto loading taglib

Serge,

The taglibs will be auto-loaded.
So I assume you have your own tag-library and packaged everything in a jar.
So in your jar's META-INF, your .tld files should be there.
I'd also assume that in your .tld file, you declared a uri.
E.g
<uri>http://example.com/tags/foo</uri>

So if this jar is available in the webapp's classpath, the tag will be 
loaded on any jsp that declares:
<% <at>  taglib uri="http://example.com/tags/foo" prefix="foo" %>

In short, simply put the jar on the lib.

Hope that helps,
dyu

Serge Fonville wrote:
> Currently I am researching moving from Tomcat 6.0.18 to Jetty 6.1.11
>
> Although configuring has taken quite some time (1-2 hours), I managed 
> to get it working.
>
> While looking through the javadocs, I could not determince if it is 
> possible to automatically load tag libraries (for example by defining 
> them in WEB-INF/web.xml
> I want to use a custom tag without the need to reference the 
> corresponsing jar containing the tag library on every jsp page.
>
> Is this at all possible in Jetty and if yes, how should I do that
>
> Thanks a lot in advance
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Serge Fonville | 3 Oct 2008 08:25
Picon

Re: [jetty-user] Fwd: Auto loading taglib

David,

That is what I already have, what I was hoping is, that I can define taglibraries in (for example) WEB-INF/web.xml) and not have to add <% <at> taglib uri="http://example.com/tags/foo" prefix="foo" %> on every jsp page.
With php I can use auto_prepend_file, that way a php file is added to every page (either through .htaccess or php.ini).
Is this also possible using Jetty?

Thanks a lot all so far

On Fri, Oct 3, 2008 at 5:36 AM, David Yu <dyu <at> webtide.com> wrote:
Serge,

The taglibs will be auto-loaded.
So I assume you have your own tag-library and packaged everything in a jar.
So in your jar's META-INF, your .tld files should be there.
I'd also assume that in your .tld file, you declared a uri.
E.g
<uri>http://example.com/tags/foo</uri>

So if this jar is available in the webapp's classpath, the tag will be loaded on any jsp that declares:
<% <at> taglib uri="http://example.com/tags/foo" prefix="foo" %>

In short, simply put the jar on the lib.

Hope that helps,
dyu



Serge Fonville wrote:
Currently I am researching moving from Tomcat 6.0.18 to Jetty 6.1.11

Although configuring has taken quite some time (1-2 hours), I managed to get it working.

While looking through the javadocs, I could not determince if it is possible to automatically load tag libraries (for example by defining them in WEB-INF/web.xml
I want to use a custom tag without the need to reference the corresponsing jar containing the tag library on every jsp page.

Is this at all possible in Jetty and if yes, how should I do that

Thanks a lot in advance



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email




Gmane