Hi Cemo,
Note that clients, such as browsers, when receiving a response to a
POST request, do not automatically redirect to the Location URI for a
redirection-based response.
It seems the right thing to do here is to return the error data in the
POST response. That response can contain a link to return the the page
to POST again. However, I would expect in browser-based cases to use
AJAX such that original page can be updated accordingly without having
to go back and forth.
Paul.
On Dec 22, 2009, at 8:43 PM, Cemo Koc wrote:
>
> Hi all,
>
> I am struggling with something made me crazy. I wanted to actually
> add this
> behaviour:
>
> 1) User gets resource A ==> It renders page A
> 2) User posts values for resource postA ==> Validation problem occurs
> 3) I want to forward posted values and errors and render page A
> again with
> problems.
>
>
> @POST
> @ValidationEnabled
> public Response postA(...){
>
> }
>
> @GET
> public Response getA(@PathParam("ad") int ad){
> //
> return Response...build();
> }
>
>
> ------
>
> My validation code is like this. I commented necessary place and
> note that
> switch case...
>
>
>
> @Around("@annotation(valAnno)")
> public Response check(ProceedingJoinPoint jp,ValidationEnabled
> valAnno)
> {
>
>
> // validation ---> JSR 303
> Map map = validate(jp,valAnno);
>
> //problem occurs
> if (!map.isEmpty()) {
>
> switch(valAnno.redirectType()){
>
> case HOMEPAGE:{
> URI uri = new URI(getHomePage());
> return Response.status(302).location(uri).build();
> }
>
> case VALIDATE:{
> /// ?????????????????????????????
> /// Call getA with errors and other posted values
> /// But URL should be change... It should be
> like
> redirection
> ///?????????????????????????????
> }
> }
> }
> try {
> return (Response) jp.proceed();
> } catch (Throwable throwable) {
> return
> Response.serverError().entity(throwable.getMessage()).build();
> }
>
> }
>
>
>
>
> 1) I am not sure about the things I have done....After validation
> error,
> what should I do?
>
> 2) I know that I am trying to make something redirect in server side
> like
> servlets. What should I write in empty blocks after validation in my
> aspect.
>
> I am not sure that I could successfully explain my aim but it is
> simply like
> this :(
>
> Thanks
>
>
>
>
> --
> View this message in context: http://n2.nabble.com/Call-another-Resource-with-some-other-values-tp4205347p4205347.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>