You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul Benedict <pb...@apache.org> on 2013/05/18 01:17:21 UTC

How to process HTTP HEAD requests?

In one particular action, I need to handle HTTP HEAD requests. Is this
possible using Struts 2? What must I customize if it doesn't work out of
the box?

PS: I am not using the REST plugin. This isn't a web service either. :-)

Paul

Re: How to process HTTP HEAD requests?

Posted by Lukasz Lenart <lu...@apache.org>.
2013/5/18 Paul Benedict <pb...@apache.org>:
> In one particular action, I need to handle HTTP HEAD requests. Is this
> possible using Struts 2? What must I customize if it doesn't work out of
> the box?

Check this out [1] or maybe Struts filter just do the job ;-) If not,
please request an improvement :-)

[1] http://axelfontaine.com/blog/http-head.html


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: How to process HTTP HEAD requests?

Posted by Martin Gainty <mg...@hotmail.com>.
last summer i did a demo for someone and didnt have access to ServletRequestAware
 
so i used the context to get the request e.g.
javax.servlet.http.HttpServletRequest req=org.apache.struts2.ServletActionContext.getRequest();

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

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.

 
> From: kaunain.ahmad2000@gmail.com
> Date: Sat, 18 May 2013 17:29:57 +0530
> Subject: Re: How to process HTTP HEAD requests?
> To: user@struts.apache.org
> 
> Hi,
> 
> implement ServletRequestAware interface in your action class
> and override
> 
> public void setServletRequest(HttpServletRequest arg0) {
>         // TODO Auto-generated method stub
> 
>     }
> 
> and use as usual
> 
> 
> 
> On Sat, May 18, 2013 at 4:47 AM, Paul Benedict <pb...@apache.org> wrote:
> 
> > In one particular action, I need to handle HTTP HEAD requests. Is this
> > possible using Struts 2? What must I customize if it doesn't work out of
> > the box?
> >
> > PS: I am not using the REST plugin. This isn't a web service either. :-)
> >
> > Paul
> >
> 
> 
> 
> -- 
> Regards
> Kaunain Ahmad
> 9015435286
 		 	   		  

Re: How to process HTTP HEAD requests?

Posted by Kaunain Ahmad <ka...@gmail.com>.
Hi,

implement ServletRequestAware interface in your action class
and override

public void setServletRequest(HttpServletRequest arg0) {
        // TODO Auto-generated method stub

    }

and use as usual



On Sat, May 18, 2013 at 4:47 AM, Paul Benedict <pb...@apache.org> wrote:

> In one particular action, I need to handle HTTP HEAD requests. Is this
> possible using Struts 2? What must I customize if it doesn't work out of
> the box?
>
> PS: I am not using the REST plugin. This isn't a web service either. :-)
>
> Paul
>



-- 
Regards
Kaunain Ahmad
9015435286