java - How to redirect user and pass a message to the destination page with Jersey and Dropwizard? -


i have pojo resource defines http endpoints , returns dropwizard views. of these endpoints perform action (eg. update db) , forward user endpoint. example, user @ location get /foo , submits form. directs them endpoint post /foo/submit, submission processed, , forwards them get /foo/done. prevents resubmission of form if refresh page, example. forwarding accomplished jersey's response.seeother() method (returning response instead of view).

what able is, when handling method handles submission, generate sort of message (error message, warning, successful, etc) , pass message page forward to. example, @ get /foo/done, @ top of page, "submission complete!" or "submission failed because...".

i've done searching around , lot of people suggesting throw webapplicationexception - except not of cases errors. i'd show confirmation of successful action. can't figure out how receiving method receive message. i've done before in python having handling method accept optional dictionary unfortunately i'm on java 7 don't have ability give methods optional parameters default values.

thanks help.

redirects send requests. request should not have body. send arbitrary data requests, send in query string (of course there should no confidential information here). example

@path("foo") public class fooresource {      @get     @path("done")     public string getdone(@queryparam("message") string message) {         return message;     }      @post     @path("submit")     public response postdata() {         string message = uricomponent.encode(                 "you have perefected submitting!",                  uricomponent.type.query_param_space_encoded);         return response.seeother(uri.create("/api/foo/done?message=" + message)).build();     } } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -