public static String toMysqlDateStr(Date date){
if (date==null)
return "NULL";
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return '\''+sdf.format(date)+'\'';
}
Java Talks , Tips Tutorials and sample codes.
public static String toMysqlDateStr(Date date){
if (date==null)
return "NULL";
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return '\''+sdf.format(date)+'\'';
}
File file = new File("foo.jpg");
String mimeType = new MimetypesFileTypeMap().getContentType(file)); // image/jpeg
alternatively , you can use filename to detech the mime type :String mimeType = new MimetypesFileTypeMap().getContentType("foo.jpg")); // image/jpeg
grep * &> allout.txt
import javax.servlet.http.HttpServletRequest;
import org.apache.axis.MessageContext;
import org.apache.axis.transport.http.HTTPConstants;
public static String getSOAPRemoteIP() {
MessageContext context = MessageContext.getCurrentContext();
String address = null;
if(context!=null &&
context.containsProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST))
{
HttpServletRequest servletReq = (HttpServletRequest)
context.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
if (servletReq != null)
address = servletReq.getRemoteAddr();
}
return address;
}