Re: Redirect on exception

2015-09-10 Thread Kalle Korhonen
On Thu, Sep 10, 2015 at 9:41 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> Ok so I added the library by adding this in my pom.xml:
> | org.tynamo
> tapestry-exceptionpage 0.1.2
> |
> Then added following in my AppModule:
> public void contributeExceptionHandler(MappedConfiguration,
> Class> configuration) {
> configuration.add(Exception.class, Error.class);
> }
> So I just added "throw new RuntimeException()" somewhere in a page to test
> it, but it is not going to the error page, still tapestry its default
> exception reporting.
> Anything else I have to configure?


No, that should be it. Are you sure the module is loaded ? You could use
@SubModule to make sure.

Kalle



> On 10/09/15 18:19, Kalle Korhonen wrote:
>
>> On Thu, Sep 10, 2015 at 8:47 AM, Nathan Quirynen <
>> nat...@pensionarchitects.be> wrote:
>>
>> I'm still on 5.3.7. Can't update to 5.4 yet sadly.
>>> Any options for 5.3.7?
>>>
>>
>> You can get the same functionality as an external module:
>> http://www.tynamo.org/tapestry-exceptionpage+guide/
>>
>> Kalle
>>
>>
>>
>>> On 10/09/15 17:45, Kalle Korhonen wrote:
>>>
>>> On Thu, Sep 10, 2015 at 7:56 AM, Nathan Quirynen <
 nat...@pensionarchitects.be> wrote:

 How can I set a redirect when an exception has been thrown?

> But this seems to only work for non-XHR requests? Or did I forget
> something here?
>
> If you are on T5.4, you can simply contribute an exception type ->
> error
>
 page map to the DefaultRequestExceptionHandler. It handles XHR requests
 as
 well. See


 http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.html
 .

 Kalle


 -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>>
>


Re: Redirect on exception

2015-09-10 Thread Nathan Quirynen

Ok so I added the library by adding this in my pom.xml:

| org.tynamo 
tapestry-exceptionpage 0.1.2 
|



Then added following in my AppModule:

public void 
contributeExceptionHandler(MappedConfiguration, Class> 
configuration) {

configuration.add(Exception.class, Error.class);
}

So I just added "throw new RuntimeException()" somewhere in a page to 
test it, but it is not going to the error page, still tapestry its 
default exception reporting.

Anything else I have to configure?

Nathan


On 10/09/15 18:19, Kalle Korhonen wrote:

On Thu, Sep 10, 2015 at 8:47 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:


I'm still on 5.3.7. Can't update to 5.4 yet sadly.
Any options for 5.3.7?


You can get the same functionality as an external module:
http://www.tynamo.org/tapestry-exceptionpage+guide/

Kalle




On 10/09/15 17:45, Kalle Korhonen wrote:


On Thu, Sep 10, 2015 at 7:56 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

How can I set a redirect when an exception has been thrown?

But this seems to only work for non-XHR requests? Or did I forget
something here?

If you are on T5.4, you can simply contribute an exception type -> error

page map to the DefaultRequestExceptionHandler. It handles XHR requests as
well. See

http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.html
.

Kalle



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org






Re: Redirect on exception

2015-09-10 Thread Kalle Korhonen
On Thu, Sep 10, 2015 at 8:47 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> I'm still on 5.3.7. Can't update to 5.4 yet sadly.
> Any options for 5.3.7?


You can get the same functionality as an external module:
http://www.tynamo.org/tapestry-exceptionpage+guide/

Kalle


>
>
> On 10/09/15 17:45, Kalle Korhonen wrote:
>
>> On Thu, Sep 10, 2015 at 7:56 AM, Nathan Quirynen <
>> nat...@pensionarchitects.be> wrote:
>>
>> How can I set a redirect when an exception has been thrown?
>>> But this seems to only work for non-XHR requests? Or did I forget
>>> something here?
>>>
>>> If you are on T5.4, you can simply contribute an exception type -> error
>> page map to the DefaultRequestExceptionHandler. It handles XHR requests as
>> well. See
>>
>> http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.html
>> .
>>
>> Kalle
>>
>>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Redirect on exception

2015-09-10 Thread Nathan Quirynen
Also when I follow this pages instructions: 
https://tapestry.apache.org/error-page-recipe.html
It is not showing my custom error page... but still the default 
exception report from Tapestry.


I did exactly as described. My application runs in development mode and 
uses maven jetty plugin (version 8+).


What can be the problem here?

On 10/09/15 16:56, Nathan Quirynen wrote:

Hi,

How can I set a redirect when an exception has been thrown?

I tried the following:

@Match("RequestExceptionHandler")
public static RequestExceptionHandler 
decorateRequestExceptionHandler(final Response response) {

return new RequestExceptionHandler() {

@Override
public void handleRequestException(Throwable exception) 
throws IOException {

response.sendRedirect("http://www.google.be";);
}

};
}

But this seems to only work for non-XHR requests? Or did I forget 
something here?


Nathan

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Redirect on exception

2015-09-10 Thread Nathan Quirynen

I'm still on 5.3.7. Can't update to 5.4 yet sadly.

Any options for 5.3.7?

On 10/09/15 17:45, Kalle Korhonen wrote:

On Thu, Sep 10, 2015 at 7:56 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:


How can I set a redirect when an exception has been thrown?
But this seems to only work for non-XHR requests? Or did I forget
something here?


If you are on T5.4, you can simply contribute an exception type -> error
page map to the DefaultRequestExceptionHandler. It handles XHR requests as
well. See
http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.html
.

Kalle



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Redirect on exception

2015-09-10 Thread Kalle Korhonen
On Thu, Sep 10, 2015 at 7:56 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> How can I set a redirect when an exception has been thrown?
> But this seems to only work for non-XHR requests? Or did I forget
> something here?
>

If you are on T5.4, you can simply contribute an exception type -> error
page map to the DefaultRequestExceptionHandler. It handles XHR requests as
well. See
http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.html
.

Kalle


Tapestry and ETags

2015-09-10 Thread Poggenpohl, Daniel
Hello everyone,

we're fighting a caching problem here using Tapestry 5.3.8. I know that 5.4 
will code urls with hashes so that you get the newest resource every time.

With 5.3.8, I am supposed to change versions or something like it. But I'd 
rather just serve resources with ETags and cache-control to check if new 
versions should be requested and are present.

How do we do that?
We're using the combination of Apache Webserver and Tomcat.

We tried configuring the Expire module of both Tomcat and Apache and configure 
the Apache ETags. The static resources directly accessed in the context 
(context/css/*.css) have ETags, but page requests serve files from 
assets/ctx/... which do NOT have ETags or expire headers set.

What can we do?

Regards,
Daniel P.


Re: Redirect on exception

2015-09-10 Thread Ido Dovrat
The method you're decorating internally commits the response in case of an
XHR request. By the time your code runs the response can no longer be
modified.

[image: 5oosh_LOGO_FINAL_web-02]

*Ido Dovrat | CEO*

*T*: +972-77-5517453  *M*: +972-54-4264831

*F*: +972-77-5517454  *A*: 5 Kinneret St, Bnei Brak 5126237, Israel

On Thu, Sep 10, 2015 at 5:56 PM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> Hi,
>
> How can I set a redirect when an exception has been thrown?
>
> I tried the following:
>
> @Match("RequestExceptionHandler")
> public static RequestExceptionHandler
> decorateRequestExceptionHandler(final Response response) {
> return new RequestExceptionHandler() {
>
> @Override
> public void handleRequestException(Throwable exception) throws
> IOException {
> response.sendRedirect("http://www.google.be";);
> }
>
> };
> }
>
> But this seems to only work for non-XHR requests? Or did I forget
> something here?
>
> Nathan
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Redirect on exception

2015-09-10 Thread Nathan Quirynen
When creating a page that implements ExceptionReporter it works for both 
XHR and non-XHR, but I don't want it to be a popup on XHR requests, I 
want it to redirect to this page.


On 10/09/15 16:56, Nathan Quirynen wrote:

Hi,

How can I set a redirect when an exception has been thrown?

I tried the following:

@Match("RequestExceptionHandler")
public static RequestExceptionHandler 
decorateRequestExceptionHandler(final Response response) {

return new RequestExceptionHandler() {

@Override
public void handleRequestException(Throwable exception) 
throws IOException {

response.sendRedirect("http://www.google.be";);
}

};
}

But this seems to only work for non-XHR requests? Or did I forget 
something here?


Nathan

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Redirect on exception

2015-09-10 Thread Nathan Quirynen

Hi,

How can I set a redirect when an exception has been thrown?

I tried the following:

@Match("RequestExceptionHandler")
public static RequestExceptionHandler 
decorateRequestExceptionHandler(final Response response) {

return new RequestExceptionHandler() {

@Override
public void handleRequestException(Throwable exception) 
throws IOException {

response.sendRedirect("http://www.google.be";);
}

};
}

But this seems to only work for non-XHR requests? Or did I forget 
something here?


Nathan

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org