Hi Georg,

in ServletContext you can use HttpServletRequest.getMethod():
  ((HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext().getRequest()).getMethod()

regards,

    Volker




2015-03-18 15:46 GMT+01:00 Georg Füchsle <giofy...@googlemail.com>:

> Hallo Max,
>
> Thanks for replying. My attempt did not work:
>
> I want distinguish GET and POST inside a PhaseListener.
>
> In the PhaseListener I receive the FacesContext from the PhaseEvent. I also
> tried to receive the FacesContext from static:
>
>     public void beforePhase(PhaseEvent event)
>     {
>        if (event.getPhaseId() == PhaseId.RESTORE_VIEW)
>         {
>
>         ExternalContext extCtx =
> event.getFacesContext().getExternalContext();
>
>         boolean post1 = FacesContext.getCurrentInstance().isPostback();
>
>         boolean post2 = event.getFacesContext().isPostback();
>
>         logger.info("post1: " + post1 + "   - post2: " + post2);
>
>
>
> Called With Get:
> http://localhost:8080/TextTool/pages/start/texttool.jsf?BEDIENER=Gio
> 15:41:04,609 INFO  [jsf.StartPhaseListener] (default task-60)
> *post1: false   - post2: false*
>
> Called with POST from a form:
> 15:42:09,045 INFO  [jsf.StartPhaseListener] (default task-69) *post1:
> false   - post2: false*
>
>
> What do I do wrong?
>
> Gio
>
> 2015-03-18 15:18 GMT+01:00 Max Starets <max.star...@oracle.com>:
>
> > Georg,
> >
> > Have you tried isPostback() on FacesContext? If you are not including
> view
> > state as one of the parameters, it will return false for GET requests.
> >
> > Max
> >
> >
> > On 3/18/2015 9:19 AM, Georg Füchsle wrote:
> >
> >> Hallo!
> >>
> >> Is it possible to see if a parameter read in my jsf-app was sent by post
> >> or
> >> by get?
> >>
> >> My webapp should be startet calling a starturl with some post
> parameters.
> >> I
> >> would like to forebid the use of get parameters. is it possible?
> >>
> >> thanks
> >>
> >> Gio
> >>
> >>
> >
>



-- 
inexso - information exchange solutions GmbH
Ofener Straße 30 | 26121 Oldenburg
www.inexso.de

Reply via email to