Re: DefaultErrorView

2012-06-25 Thread Gerhard Petracek
hi jose,

exceptions during the rendering process are always special.
-> everything which could lead to an exception should be done before the
rendering process.
in this case you can't switch to an error-view, if you are in the middle of
the rendering process of a page.

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/6/26 José Luis Cetina 

> Sorry, but i dont understand, i only set my @Secured in my managed bean.
>
> Do you mean with: "your secured bean should always get accessed before the
> rendering starts" that i have to call the checkPermission method in a
> PreRenderView method in my managedbean?
>
> like this:
>
> @Named
> @ViewAccessScoped
> @SecurityModule(codigoModulo = ModuloPantallaEnum.CURSOS)
> public class CursosMBean implements Serializable{
>
> }
>
>
>
> 2012/6/25 Gerhard Petracek 
>
> > hi jose,
> >
> > your secured bean should always get accessed before the rendering starts
> > (e.g. via a PreRenderView callback).
> > otherwise you get the exception during the rendering process.
> >
> > regards,
> > gerhard
> >
> > http://www.irian.at
> >
> > Your JSF/JavaEE powerhouse -
> > JavaEE Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
> >
> >
> > 2012/6/25 José Luis Cetina 
> >
> > > My denied page never shown, i always get Cannot set content type.
> > Response
> > > already committed.
> > >
> > >
> > > I have this:
> > >
> > > @Page
> > > public class Denegado extends DefaultErrorView{
> > >
> > > }
> > >
> > > @Stereotype
> > > @Target(value = {ElementType.TYPE})
> > > @Retention(value = RetentionPolicy.RUNTIME)
> > >
> > >
> >
> @Secured(value=PermissionAccessDecisionVoter.class,errorView=Denegado.class)
> > > public @interface SecurityModule {
> > >ModuloPantallaEnum codigoModulo();
> > > }
> > >
> > > my bean:
> > > @Named
> > > @ViewAccessScoped
> > > @SecurityModule(codigoModulo = ModuloPantallaEnum.CURSOS)
> > > public class CursosMBean implements Serializable{
> > > }
> > >
> > > THEN I ADD SecurityViolation
> > > @Override
> > >protected void checkPermission(InvocationContext ic,
> > > Set violations) {
> > >  violations.add(newSecurityViolation("DENIED."));
> > > }
> > >
> > > But i always see in my page this:
> > >
> > > An Error Occurred:
> > >
> > >
> org.apache.myfaces.extensions.cdi.core.api.security.AccessDeniedException
> > >
> > > viewId=/web/portal_academico/control_escolar/cursos.xhtml
> > >
> > >
> >
> location=/home/maxtorzito/repositorio/grupo_kx/project-rhino/trunk/project-rhino/target/project-rhino-0.9-SNAPSHOT/web/portal_academico/control_escolar/cursos.xhtml
> > > phaseId=RENDER_RESPONSE(6)
> > >
> > > Caused by:
> > >
> org.apache.myfaces.extensions.cdi.core.api.security.AccessDeniedException
> > > at
> > >
> > >
> >
> org.apache.myfaces.extensions.cdi.core.impl.util.SecurityUtils.invokeVoters(SecurityUtils.java:95)
> > >
> > >
> > >
> > > And in the log:
> > >
> > > org.apache.myfaces.context.servlet.ServletExternalContextImpl
> > > setResponseContentType
> > > SEVERE: Cannot set content type. Response already committed
> > >
> > > What is wrong?
> > >
> > > --
> > > ---
> > > *SCJA. José Luis Cetina*
> > > ---
> > >
> >
>
>
>
> --
> ---
> *SCJA. José Luis Cetina*
> ---
>


Re: DefaultErrorView

2012-06-25 Thread José Luis Cetina
Sorry, but i dont understand, i only set my @Secured in my managed bean.

Do you mean with: "your secured bean should always get accessed before the
rendering starts" that i have to call the checkPermission method in a
PreRenderView method in my managedbean?

like this:

@Named
@ViewAccessScoped
@SecurityModule(codigoModulo = ModuloPantallaEnum.CURSOS)
public class CursosMBean implements Serializable{

}



2012/6/25 Gerhard Petracek 

> hi jose,
>
> your secured bean should always get accessed before the rendering starts
> (e.g. via a PreRenderView callback).
> otherwise you get the exception during the rendering process.
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JSF/JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2012/6/25 José Luis Cetina 
>
> > My denied page never shown, i always get Cannot set content type.
> Response
> > already committed.
> >
> >
> > I have this:
> >
> > @Page
> > public class Denegado extends DefaultErrorView{
> >
> > }
> >
> > @Stereotype
> > @Target(value = {ElementType.TYPE})
> > @Retention(value = RetentionPolicy.RUNTIME)
> >
> >
> @Secured(value=PermissionAccessDecisionVoter.class,errorView=Denegado.class)
> > public @interface SecurityModule {
> >ModuloPantallaEnum codigoModulo();
> > }
> >
> > my bean:
> > @Named
> > @ViewAccessScoped
> > @SecurityModule(codigoModulo = ModuloPantallaEnum.CURSOS)
> > public class CursosMBean implements Serializable{
> > }
> >
> > THEN I ADD SecurityViolation
> > @Override
> >protected void checkPermission(InvocationContext ic,
> > Set violations) {
> >  violations.add(newSecurityViolation("DENIED."));
> > }
> >
> > But i always see in my page this:
> >
> > An Error Occurred:
> >
> > org.apache.myfaces.extensions.cdi.core.api.security.AccessDeniedException
> >
> > viewId=/web/portal_academico/control_escolar/cursos.xhtml
> >
> >
> location=/home/maxtorzito/repositorio/grupo_kx/project-rhino/trunk/project-rhino/target/project-rhino-0.9-SNAPSHOT/web/portal_academico/control_escolar/cursos.xhtml
> > phaseId=RENDER_RESPONSE(6)
> >
> > Caused by:
> > org.apache.myfaces.extensions.cdi.core.api.security.AccessDeniedException
> > at
> >
> >
> org.apache.myfaces.extensions.cdi.core.impl.util.SecurityUtils.invokeVoters(SecurityUtils.java:95)
> >
> >
> >
> > And in the log:
> >
> > org.apache.myfaces.context.servlet.ServletExternalContextImpl
> > setResponseContentType
> > SEVERE: Cannot set content type. Response already committed
> >
> > What is wrong?
> >
> > --
> > ---
> > *SCJA. José Luis Cetina*
> > ---
> >
>



-- 
---
*SCJA. José Luis Cetina*
---


Re: DefaultErrorView

2012-06-25 Thread Gerhard Petracek
hi jose,

your secured bean should always get accessed before the rendering starts
(e.g. via a PreRenderView callback).
otherwise you get the exception during the rendering process.

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/6/25 José Luis Cetina 

> My denied page never shown, i always get Cannot set content type. Response
> already committed.
>
>
> I have this:
>
> @Page
> public class Denegado extends DefaultErrorView{
>
> }
>
> @Stereotype
> @Target(value = {ElementType.TYPE})
> @Retention(value = RetentionPolicy.RUNTIME)
>
> @Secured(value=PermissionAccessDecisionVoter.class,errorView=Denegado.class)
> public @interface SecurityModule {
>ModuloPantallaEnum codigoModulo();
> }
>
> my bean:
> @Named
> @ViewAccessScoped
> @SecurityModule(codigoModulo = ModuloPantallaEnum.CURSOS)
> public class CursosMBean implements Serializable{
> }
>
> THEN I ADD SecurityViolation
> @Override
>protected void checkPermission(InvocationContext ic,
> Set violations) {
>  violations.add(newSecurityViolation("DENIED."));
> }
>
> But i always see in my page this:
>
> An Error Occurred:
>
> org.apache.myfaces.extensions.cdi.core.api.security.AccessDeniedException
>
> viewId=/web/portal_academico/control_escolar/cursos.xhtml
>
> location=/home/maxtorzito/repositorio/grupo_kx/project-rhino/trunk/project-rhino/target/project-rhino-0.9-SNAPSHOT/web/portal_academico/control_escolar/cursos.xhtml
> phaseId=RENDER_RESPONSE(6)
>
> Caused by:
> org.apache.myfaces.extensions.cdi.core.api.security.AccessDeniedException
> at
>
> org.apache.myfaces.extensions.cdi.core.impl.util.SecurityUtils.invokeVoters(SecurityUtils.java:95)
>
>
>
> And in the log:
>
> org.apache.myfaces.context.servlet.ServletExternalContextImpl
> setResponseContentType
> SEVERE: Cannot set content type. Response already committed
>
> What is wrong?
>
> --
> ---
> *SCJA. José Luis Cetina*
> ---
>


Re: @Secured CODI

2012-06-25 Thread Gerhard Petracek
hi jose,

we wrap ViewHandler#createView -> if your config is correct, it should work
(you can check e.g. [1]).

regards,
gerhard

[1] http://s.apache.org/SBP

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/6/25 José Luis Cetina 

> In the CODI Wiki page says:
>
> https://cwiki.apache.org/confluence/display/EXTCDI/Core+Usage#CoreUsage-SecurityViolation
>
> The rest is done by CODI. Please note that there is a natural overhead if
> the @Secured annotation is used as interceptor. In combination with the JSF
> module, we recommend to us it for the ViewConfig instead of beans because
> the performance overhead is minimal compared to an interceptor.
>
> But if i set the @Secured annotation in ViewConfig and i enter directly to
> the URL (without a navigation link, of course i dont use CODI if i access
> in this way) the checkPermission method was never invoked, as i can see the
> only way you can use @Secured annotation in a viewconfig is when you never
> expected the user can access to your page with the URL in a  directly way,
> am i right?
>
>
> --
> ---
> *SCJA. José Luis Cetina*
> ---
>


Re: HTML5 Doctype

2012-06-25 Thread Ted
I do... I think

if I'm not mistaken the doc type for html5 is just


Note you only asked about the doc type, not the actual tags... or JSF tag
equivalents.

I'm using 2.1.6 as well and 1.1.11 as well.
jdk1.6 and tomcat7.

I didn't have to do anything special, it just works.

On Tue, Jun 26, 2012 at 5:25 AM, Dennis Hörsch  wrote:

> Hi,
>
> has anybody experiences with using a HTML5 Doctype declaration within
> facelets? It is possible?
> If I write it to my xhtml files I get exceptions from the SAXParser...
>
> Environment
> MyFaces 2.1.6, Tomahawk20 1.1.11
>
> Greetings and thanks
> dennis
>
> --
> HIS-SignaturNEU Signatur
>
> HIS Hochschul-Informations-System GmbH
> Goseriede9| 30159 Hannover | _www.his.de_ 
>
> Dennis Hörsch
> Unternehmensbereich Hochschul-IT
> Arbeitsbereich Personalmanagement
> Telefon +49 (0)511 1220-403 | Fax +49 (0)511 1220-250
> E-Mail hoer...@his.de 
>
> Registergericht: Amtsgericht Hannover, HRB 6489
> Geschäftsführer: Prof. Dr. Martin Leitner
> Vorsitzender des Aufsichtsrats: Prof. Dr. Andreas Geiger
>
>


-- 
Ted.


DefaultErrorView

2012-06-25 Thread José Luis Cetina
My denied page never shown, i always get Cannot set content type. Response
already committed.


I have this:

@Page
public class Denegado extends DefaultErrorView{

}

@Stereotype
@Target(value = {ElementType.TYPE})
@Retention(value = RetentionPolicy.RUNTIME)
@Secured(value=PermissionAccessDecisionVoter.class,errorView=Denegado.class)
public @interface SecurityModule {
ModuloPantallaEnum codigoModulo();
}

my bean:
@Named
@ViewAccessScoped
@SecurityModule(codigoModulo = ModuloPantallaEnum.CURSOS)
public class CursosMBean implements Serializable{
}

THEN I ADD SecurityViolation
@Override
protected void checkPermission(InvocationContext ic,
Set violations) {
  violations.add(newSecurityViolation("DENIED."));
}

But i always see in my page this:

An Error Occurred:

org.apache.myfaces.extensions.cdi.core.api.security.AccessDeniedException

viewId=/web/portal_academico/control_escolar/cursos.xhtml
location=/home/maxtorzito/repositorio/grupo_kx/project-rhino/trunk/project-rhino/target/project-rhino-0.9-SNAPSHOT/web/portal_academico/control_escolar/cursos.xhtml
phaseId=RENDER_RESPONSE(6)

Caused by:
org.apache.myfaces.extensions.cdi.core.api.security.AccessDeniedException
at
org.apache.myfaces.extensions.cdi.core.impl.util.SecurityUtils.invokeVoters(SecurityUtils.java:95)



And in the log:

org.apache.myfaces.context.servlet.ServletExternalContextImpl
setResponseContentType
SEVERE: Cannot set content type. Response already committed

What is wrong?

-- 
---
*SCJA. José Luis Cetina*
---


@Secured CODI

2012-06-25 Thread José Luis Cetina
In the CODI Wiki page says:
https://cwiki.apache.org/confluence/display/EXTCDI/Core+Usage#CoreUsage-SecurityViolation

The rest is done by CODI. Please note that there is a natural overhead if
the @Secured annotation is used as interceptor. In combination with the JSF
module, we recommend to us it for the ViewConfig instead of beans because
the performance overhead is minimal compared to an interceptor.

But if i set the @Secured annotation in ViewConfig and i enter directly to
the URL (without a navigation link, of course i dont use CODI if i access
in this way) the checkPermission method was never invoked, as i can see the
only way you can use @Secured annotation in a viewconfig is when you never
expected the user can access to your page with the URL in a  directly way,
am i right?


-- 
---
*SCJA. José Luis Cetina*
---


HTML5 Doctype

2012-06-25 Thread Dennis Hörsch

Hi,

has anybody experiences with using a HTML5 Doctype declaration within 
facelets? It is possible?

If I write it to my xhtml files I get exceptions from the SAXParser...

Environment
MyFaces 2.1.6, Tomahawk20 1.1.11

Greetings and thanks
dennis

--
HIS-SignaturNEU Signatur

HIS Hochschul-Informations-System GmbH
Goseriede9| 30159 Hannover | _www.his.de_ 

Dennis Hörsch
Unternehmensbereich Hochschul-IT
Arbeitsbereich Personalmanagement
Telefon +49 (0)511 1220-403 | Fax +49 (0)511 1220-250
E-Mail hoer...@his.de 

Registergericht: Amtsgericht Hannover, HRB 6489
Geschäftsführer: Prof. Dr. Martin Leitner
Vorsitzender des Aufsichtsrats: Prof. Dr. Andreas Geiger



Re: [EXTVAL] @Column.lenght -> h:inputText

2012-06-25 Thread Gerhard Petracek
hi thomas,

+1 for adding it -> please create a jira ticket (improvement).

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/6/25 Thomas Andraschko 

> Hi Gerhard,
>
> i implemented this in my app but without an custom ComponentInitializer.
>
> I just overwritten the AbstractHtmlCoreComponentsComponentInitializer.
> If a maxlenght attribute is defined (and greater than 0), ExtVal does not
> override it.
> Could this be a part of ExtVal?
>
> Regards,
> Thomas
>
> 2012/4/12 Thomas Andraschko 
>
> > Hi,
> >
> > ok cool - i will try it!
> >
> > Thanks!
> >
> >
> > 2012/4/12 Gerhard Petracek 
> >
> >> hi thomas,
> >>
> >> that isn't supported by default (intentionally).
> >>
> >> however, you can provide a custom ComponentInitializer.
> >> (implement the interface or extend
> HtmlCoreComponentsComponentInitializer
> >> and override #configureMaxLengthAttribute)
> >> -> register it via an extval startup listener.
> >>
> >> regards,
> >> gerhard
> >>
> >> http://www.irian.at
> >>
> >> Your JSF/JavaEE powerhouse -
> >> JavaEE Consulting, Development and
> >> Courses in English and German
> >>
> >> Professional Support for Apache MyFaces
> >>
> >>
> >>
> >> 2012/4/12 Thomas Andraschko 
> >>
> >> > Hi Gerhard,
> >> >
> >> > yep i could but the value depends on the current logged in user/user
> >> > groups. So it can't use a static value -> ValueBinding on maxlenght
> >> > attribute would be an easy solution.
> >> > Ok, so there is no possiblity to disable this behavior?
> >> >
> >> > Why ExtVal does override the default attributes? IMO the component
> >> > attributes should have a higher prio.
> >> >
> >> > Thanks!
> >> >
> >> > Best regards,
> >> > Thomas
> >> >
> >> > 2012/4/12 Gerhard Petracek 
> >> >
> >> > > hi thomas,
> >> > >
> >> > > you can use Column#length with the correct value or a different
> >> property
> >> > > for your value-binding (without @Column) .
> >> > >
> >> > > regards,
> >> > > gerhard
> >> > >
> >> > > http://www.irian.at
> >> > >
> >> > > Your JSF/JavaEE powerhouse -
> >> > > JavaEE Consulting, Development and
> >> > > Courses in English and German
> >> > >
> >> > > Professional Support for Apache MyFaces
> >> > >
> >> > >
> >> > >
> >> > > 2012/4/12 Thomas Andraschko 
> >> > >
> >> > > > Hi,
> >> > > >
> >> > > > we have a value binding on an h:inputText. The binded variable has
> >> > > @Column
> >> > > > and the default value of length is 255.
> >> > > > I try to overwrite this via "maxlength" attribute on the
> h:inputText
> >> > but
> >> > > > the rendered maxlenght is 255.
> >> > > >
> >> > > > How can disable this behavior for a single input field?
> >> > > >
> >> > > > Best regards,
> >> > > > Thomas
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>


Re: [EXTVAL] @Column.lenght -> h:inputText

2012-06-25 Thread Thomas Andraschko
Hi Gerhard,

i implemented this in my app but without an custom ComponentInitializer.

I just overwritten the AbstractHtmlCoreComponentsComponentInitializer.
If a maxlenght attribute is defined (and greater than 0), ExtVal does not
override it.
Could this be a part of ExtVal?

Regards,
Thomas

2012/4/12 Thomas Andraschko 

> Hi,
>
> ok cool - i will try it!
>
> Thanks!
>
>
> 2012/4/12 Gerhard Petracek 
>
>> hi thomas,
>>
>> that isn't supported by default (intentionally).
>>
>> however, you can provide a custom ComponentInitializer.
>> (implement the interface or extend HtmlCoreComponentsComponentInitializer
>> and override #configureMaxLengthAttribute)
>> -> register it via an extval startup listener.
>>
>> regards,
>> gerhard
>>
>> http://www.irian.at
>>
>> Your JSF/JavaEE powerhouse -
>> JavaEE Consulting, Development and
>> Courses in English and German
>>
>> Professional Support for Apache MyFaces
>>
>>
>>
>> 2012/4/12 Thomas Andraschko 
>>
>> > Hi Gerhard,
>> >
>> > yep i could but the value depends on the current logged in user/user
>> > groups. So it can't use a static value -> ValueBinding on maxlenght
>> > attribute would be an easy solution.
>> > Ok, so there is no possiblity to disable this behavior?
>> >
>> > Why ExtVal does override the default attributes? IMO the component
>> > attributes should have a higher prio.
>> >
>> > Thanks!
>> >
>> > Best regards,
>> > Thomas
>> >
>> > 2012/4/12 Gerhard Petracek 
>> >
>> > > hi thomas,
>> > >
>> > > you can use Column#length with the correct value or a different
>> property
>> > > for your value-binding (without @Column) .
>> > >
>> > > regards,
>> > > gerhard
>> > >
>> > > http://www.irian.at
>> > >
>> > > Your JSF/JavaEE powerhouse -
>> > > JavaEE Consulting, Development and
>> > > Courses in English and German
>> > >
>> > > Professional Support for Apache MyFaces
>> > >
>> > >
>> > >
>> > > 2012/4/12 Thomas Andraschko 
>> > >
>> > > > Hi,
>> > > >
>> > > > we have a value binding on an h:inputText. The binded variable has
>> > > @Column
>> > > > and the default value of length is 255.
>> > > > I try to overwrite this via "maxlength" attribute on the h:inputText
>> > but
>> > > > the rendered maxlenght is 255.
>> > > >
>> > > > How can disable this behavior for a single input field?
>> > > >
>> > > > Best regards,
>> > > > Thomas
>> > > >
>> > >
>> >
>>
>
>