📄 abstractrequesthelper.java
字号:
package gov.gdlt.ssgly.taxcore.taxblh.gzda.service.xmlinterface.impl;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.Properties;
import java.math.BigDecimal;
import java.util.Enumeration;
import gov.gdlt.ssgly.taxcore.taxblh.gzda.service.xmlinterface.*;
public abstract class AbstractRequestHelper {
private HttpServletRequest request = null;
private HttpServletResponse response = null;
private Properties properties = null;
private String xml="";
/** Creates instance of me
* @param request servlet request
* @param response servlet response
*/
AbstractRequestHelper( HttpServletRequest request, HttpServletResponse response){
this.request = request;
this.response = response;
this.properties = getProperties( request );
}
/** Returns the servlet request for this session
*/
public HttpServletRequest getRequest() {
return request;
}
/** Returns the servlet response for this session
*/
public HttpServletResponse getResponse() {
return response;
}
public String getTaskId(){
return this.request.getParameter("ACTION");
}
/** Returns the command to exceute.
*/
public abstract Command getCommand();
public Properties getProperties( ) {
return properties;
}
/** Transulates servlet request properties to java properties.
*/
public abstract Properties getProperties(HttpServletRequest httpservletrequest);
/**
{
Properties properties = new Properties();
for( Enumeration enumeration =
httpservletrequest.getParameterNames();
enumeration.hasMoreElements();) {
Object obj = enumeration.nextElement();
String s = httpservletrequest.getParameterValues((String)obj)[0];
System.out.println( "Parameter name ="+ obj.toString() + ", Parameter value =" + s );
if( ! isAny(s)) {
try {
properties.put(obj, new BigDecimal(s));
} catch(NumberFormatException _ex) {
properties.put(obj, s);
}
}
}
return properties;
}
**/
public void setParaXml(String xml){
this.xml=xml;
}
public String getParaXml(){
//XmlGetter xmlGetter = new XmlGetter();
//String xml = XmlGetter.getData(this.request, "gb2312");
//if((xml.trim()=="")||(xml==null)){
String xml=this.xml;
//}
//System.out.println("xml="+xml);
return xml;
}
private static boolean isAny(String s) {
return s.equals("Any");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -