java ee - jsp request/response timeout implementation -
i calling web service (jsp page) returns data me. have timeout because takes long time respond. proper way achieve that? how can set both request timeout , response timeout? these achieved session.setmaxinactiveinterval()
?
my jsp page looks `public jsonobject performlogic(jsonobject state, map additionalparams) throws exception {
string callingsystem = state.getstring("caller"); string cli = state.getstring("cli"); string taxnumber = state.getstring("taxnumber"); posdatareaderservice posservice = new posdatareaderservice(); posdatareader pos = posservice.getposdatareadersoapport(); orderdatarequest orderdatarequest = new orderdatarequest(); orderdatarequest.settaxnumber(taxnumber); caller caller = new caller(); caller.setcallingsystem(callingsystem); orderdataresponse orderdataresponse = pos.getorderdata(orderdatarequest, caller); jsonobject result = new jsonobject(); result.put("var_ws_passportstatuscode", orderdataresponse.getpasportstatuscode()); return result;
};`
the answer question here how timeout thread use java.util.concurrent.executorservice
, create task class implements java.util.concurrent.callable
, put code want interrupt in there, etc.
i have attempted port solution jsp myself, ran error i'm asking question on https://stackoverflow.com/questions/22388069/error-porting-thread-timeout-solution-to-jsp
but have make servlet , use solution in servlet. seems jsp not allow override superclass method inside class define in jsp. better use servlet anyway.
Comments
Post a Comment