This page is not yet available in Spanish. We are working on its translation. If you have any questions or feedback about our current translation project, feel free to reach out to us!
classCompliant{@OverridepublicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{response.setContentType("text/html;charset=UTF-8");StringqueryString=request.getQueryString();Stringparamval="BenchmarkTest01683"+"=";intparamLoc=-1;if(queryString!=null)paramLoc=queryString.indexOf(paramval);if(paramLoc==-1){response.getWriter().println("getQueryString() couldn't find expected parameter '"+"BenchmarkTest01683"+"' in query string.");return;}Stringparam=queryString.substring(paramLoc+paramval.length());// 1st assume "BenchmarkTest01683" param is last// parameter in query string.// And then check to see if its in the middle of the query string and if so, trim off what// comes after.intampersandLoc=queryString.indexOf("&",paramLoc);if(ampersandLoc!=-1){param=queryString.substring(paramLoc+paramval.length(),ampersandLoc);}param=java.net.URLDecoder.decode(param,"UTF-8");Stringbar=newTest().doSomething(request,param);byte[]input=newbyte[1000];Stringstr="?";ObjectinputParam=param;if(inputParaminstanceofString)str=((String)inputParam);if(inputParaminstanceofjava.io.InputStream){inti=((java.io.InputStream)inputParam).read(input);if(i==-1){response.getWriter().println("This input source requires a POST, not a GET. Incompatible UI for the InputStream source.");return;}str=newString(input,0,i);}if("".equals(str))str="No cookie value supplied";javax.servlet.http.Cookiecookie=newjavax.servlet.http.Cookie("SomeCookie",str);cookie.setSecure(false);cookie.setHttpOnly(true);cookie.setPath(request.getRequestURI());// i.e., set path to JUST this servlet// e.g., /benchmark/sql-01/BenchmarkTest01001response.addCookie(cookie);response.getWriter().println("Created cookie: 'SomeCookie': with value: '"+org.owasp.esapi.ESAPI.encoder().encodeForHTML(str)+"' and secure flag set to: false");}}