struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: login interceptor and a servlet
Date Mon, 04 May 2009 14:34:06 GMT

yes the key is to specify the correct contentType param (in this case image/jpeg)
and the correct contentDisposition (in this case filename)
inline can be used for small file transfers (under 4k)

<result name="success" type="stream">
  <param name="contentType">image/jpeg</param>
  <param name="inputName">imageStream</param>
  <param name="contentDisposition">filename="document.pdf"</param>
  <param name="bufferSize">1024</param>
</result>
http://struts.apache.org/2.0.14/struts2-core/apidocs/org/apache/struts2/dispatcher/StreamResult.html

HTH
Martin 
______________________________________________ 
Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de
confidentialité 
This message is confidential. If you should not be the intended receiver, then we ask politely
to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message
serves only for the exchange of information and has no legal binding effect. Due to the easy
manipulation of emails we cannot take responsibility over the the contents.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.






> Date: Sun, 3 May 2009 21:20:47 -0700
> Subject: Re: login interceptor and a servlet
> From: thechrispratt@gmail.com
> To: user@struts.apache.org
> 
> Sure, you can either implement ServletResponseAware and write directly to
> the stream, then return null from execute() to tell struts that there is no
> additional result required.  Or, even better, you can use the Stream result
> type and let Struts write it to the stream for you.
>   (*Chris*)
> 
> On Sun, May 3, 2009 at 8:45 PM, Kate Fox <kfox@anchorintelligence.com>wrote:
> 
> > Hi Chris,
> >
> > Thanks for the quick response.  Unfortunately my servlet is a true servlet.
> >  I need to write directly to the OutputStream.  Is there a way to do that
> > with an image action?
> >
> > Thanks,
> >
> > Kate
> >
> >
> > Chris Pratt wrote:
> >
> >> If your image servlet is a true servlet acting outside of struts, it won't
> >> be subject to the interceptor stack.  If it's actually an image action,
> >> just
> >> assign it a different interceptor stack that doesn't contain your
> >> LoginInterceptor and you'll be good to go.
> >>  (*Chris*)
> >>
> >> On Sun, May 3, 2009 at 8:28 PM, Kate Fox <kfox@anchorintelligence.com
> >> >wrote:
> >>
> >>
> >>
> >>> I have a login interceptor to check login on all my pages.  I also have
a
> >>> servlet that serves up images.  The servlet does not go through the login
> >>> interceptor.  Is there a way to force it that way?
> >>>
> >>> Here is my login interceptor definition:
> >>>
> >>>      <interceptors>
> >>>          <interceptor name="login" class="LoginInterceptor" />
> >>>          <interceptor-stack name="defaultLoginStack">
> >>>              <interceptor-ref name="servlet-config" />
> >>>              <interceptor-ref name="params" />
> >>>              <interceptor-ref name="login" />
> >>>              <interceptor-ref name="prepare" />
> >>>              <interceptor-ref name="i18n"/>
> >>>              <interceptor-ref name="chain" />
> >>>          </interceptor-stack>
> >>>      </interceptors>
> >>>
> >>> Thanks for your help,
> >>>
> >>> Kate
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>> For additional commands, e-mail: user-help@struts.apache.org
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >

_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage1_052009
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message