AWT virtual digital currency
taxi about 33 yuan | way: yuhangtang Road, Zijingang road
Wuchang (subway station)
yuhangtang road
3.7 km
Zijingang road
4.1 km
Xixi road
3 km
Lingyin road
285 m
Xihu Cultural Center
bus line: Metro Line 4 → Metro Line 1, the whole journey is about 9.6km
1. Take Metro Line 4 from the Civic Center, pass 2 stations, and reach Jinjiang station
2. Walk about 110m, then transfer to Metro Line 1
3. Take Metro Line 1, pass 7 stations, and reach Xihu Cultural Square Station
*/
public ActionForward submitAlipayUrl(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String orderNo = request.getParameter("orderNo");//订单编号
HashMap hm = new HashMap();
hm.put("_input_charset", "utf-8");// 采用相同的编码方式
hm.put("body", "企鹅个性化图书订单,订单号:" + orderNo);// 填写在跳到支付宝页面上显示的付款内容信息
hm.put("notify_url", "http://127.0.0.1:8888/mypenguin/orders.do?method=AlipayNotify");// 客户付款后,支付宝调用的页面
hm.put("out_trade_no", orderNo);// 外部交易号,最好具有唯一性,在获取支付宝发来的付款信息时使用.
hm.put("partner", "2088002302055380");// partnerId(合作伙伴ID)
//hm.put("agent", "2088002302055380");// partnerId(合作伙伴ID)
hm.put("payment_type", "1");// 支付类型 1=商品购买,2=服务购买,...
//hm.put("price", "178.00");// 订单金额信息
hm.put("total_fee", "178.00");// 订单金额和信息
//hm.put("quantity", "1");// 订单商品数量,一般都是写1,它是按照整个订单包来计算
hm.put(“return_url”, “http://127.0.0.1:8888/mypenguin/orders.do?method=AlipayReturn”);// 客户付款成功后,显示给客户的页面
hm.put("show_url", "http://127.0.0.1:8888/mypenguin/books.do?method=list&kindId=1");//展示地址,即在支付页面时,商品名称旁边的“详情”的链接地址
hm.put("seller_email", "[email protected]");// 你的支付宝账户email
hm.put("service", "create_direct_pay_by_user");// create_direct_pay_by_user=直接付款,trade_create_by_buyer=担保付款
hm.put("subject", "企鹅个性化图书订单号:" + orderNo);// 填写在跳到支付宝页面上显示的付款标题信息
String payGateway = "https://www.alipay.com/cooperate/gateway.do";// 跳转到支付宝的url头
String securityCode="";//securityCode(安全码);
String sign = makeUrl(hm,securityCode,"utf-8",payGateway);//securityCode(安全码);
hm.put("sign", sign);
hm.put("sign_type", "MD5");
PrintWriter out = response.getWriter();
out.println("<form name='alipaysubmit' method='post' action='https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8' >");
out.println("<input type='hidden' name='service' value='" + hm.get("service") + "'>");
out.println("<input type='hidden' name='partner' value='" + hm.get("partner") + "'>");
out.println("<input type='hidden' name='seller_email' value='" + hm.get("seller_email") + "'>");
out.println(““);
out.println("<input type='hidden' name='subject' value='" + hm.get("subject") + "'>");
out.println("<input type='hidden' name='body' value='" + hm.get("body") + "'>");
out.println("<input type='hidden' name='total_fee' value='" + hm.get("total_fee") + "'>");
out.println("<input type='hidden' name='show_url' value='" + hm.get("show_url") + "'>");
out.println("<input type='hidden' name='return_url' value='" + hm.get("return_url") + "'>");
out.println("<input type='hidden' name='notify_url' value='" + hm.get("notify_url") + "'>");
out.println("<input type='hidden' name='payment_type' value='1'>");
out.println("<input type='hidden' name='sign' value='" + hm.get("sign") + "'>");
out.println("<input type='hidden' name='sign_type' value='" + hm.get("sign_type") + "'>");
out.println("</form>");
out.println("<script>");
out.println(" document.alipaysubmit.submit()");
out.println("</script>");
return null;
}
/**
* 根据传入的参数生成Alipay的支付URL
* @param hm 参数值
* @param securityCode 安全码
* @param charset 编码
* @param payGateway 支付宝gateway
@return
*/
public static String makeUrl(HashMap hm,String securityCode,String charSet,String payGateway) throws Exception{
List keys = new ArrayList(hm.keySet());
Collections.sort(keys);//支付宝要求参数必须按字母排序
StringBuffer content = new StringBuffer();
for (int i = 0; i < keys.size(); i++) {
content.append((String) keys.get(i));
content.append("=");
content.append((String) hm.get((String) keys.get(i)));
if (i != keys.size() - 1) {
content.append("&");
}
}
content.append(securityCode);
String sign = DataUtil.MD5Encode(content.toString(), charSet); //MD5加密
return sign;
}
2、return_url的内容:
/**
* 支付宝支付完成以后,当前窗口会从支付宝的页面跳转回这个页面该页面称作“返回页”,
* 是同步被支付宝服务器所调用,可当作是支付完成后的提示信息页,如“您的某某某订单,多少金额已支付成功”
*/
public ActionForward AlipayReturn(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String alipayNotifyURL = "https://www.alipay.com/cooperate/gateway.do?service=notify_verify";
//String alipayNotifyURL = "http://notify.alipay.com/trade/notify_query.do?";//此路径是在上面链接地址无法起作用时替换使用
alipayNotifyURL = alipayNotifyURL+ "&partner=2088002302055380¬ify_id="+ request.getParameter("notify_id");
// 获取支付宝ATN返回结果,true是正确的订单信息,false 是无效的
String responseTxt = check(alipayNotifyURL);
// 获得POST 过来参数设置到新的requestParams中
Map requestParams = request.getParameterMap();
List keys = new ArrayList(requestParams.keySet());
Collections.sort(keys);
StringBuffer content = new StringBuffer();
for (int i = 0; i < keys.size(); i++) {
String key=(String) keys.get(i);
if(!key.equals("")&&!key.equals("sign")&&!key.equals("sign_type")){
content.append((String) keys.get(i));
content.append("=");
content.append((String)requestParams.get((String) keys.get(i)));
if (i != keys.size() - 1) {
content.append("&");
}
}
}
String securityCode="";//securityCode(安全码);
content.append(securityCode);
String mysign = DataUtil.MD5Encode(content.toString(), "utf-8");
System.out.println("--------------------------content="+content);
System.out.println("--------------------------mysign="+mysign);
System.out.println("--------------------------sign="+request.getParameter("sign"));
if (mysign.equals(request.getParameter("sign")) && responseTxt.equals("true") ){
if (request.getParameter("trade_status").equalsIgnoreCase("TRADE_FINISHED")){
// 可以做重定向,也可以用来虚拟物品发货
}
return mapping.findForward("payOK");//交易成功
}else{
return mapping.findForward("payFail");//交易失败
}
}
3、notify_url的内容:
/**
* 通知返回URL,仅适用于异步返回处理结果的接口有些服务是无法立即返回处理结果的,那么需要通过这个URL将处理结果异步返回给合作伙伴
*/
public ActionForward AlipayNotify(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String alipayNotifyURL = "https://www.alipay.com/cooperate/gateway.do?service=notify_verify";
//String alipayNotifyURL = "http://notify.alipay.com/trade/notify_query.do?";//此路径是在上面链接地址无法起作用时替换使用
alipayNotifyURL = alipayNotifyURL+ "&partner=2088002302055380¬ify_id="+ request.getParameter("notify_id");
// 获取支付宝ATN返回结果,true是正确的订单信息,false 是无效的
String responseTxt = check(alipayNotifyURL);
// 获得POST 过来参数设置到新的requestParams中
Map requestParams = request.getParameterMap();
List keys = new ArrayList(requestParams.keySet());
Collections.sort(keys);
StringBuffer content = new S
public class outofmemoryerror
extends virtualmachineererror
when memory overflow or no available memory is provided to the garbage collector, the Java virtual machine cannot allocate an object, and this exception is thrown
we know that vector uses an object array to store its elements (protected object [] elementdata;), When elementdata. Length() is too large, the JVM can't allocate so much memory space, and an error will occur. You can try to define int [] a = New Int [100000000] (381m), and the same problem will appear
The alphacomposite alphacomposite class implements some basic alpha synthesis rules. It combines the source color with the target color to achieve the blending and transparency effects in graphics and images. Awtevent is the root event class of all AWT events. Awteventmulticast implements the assignment of AWT events defined in java.awt.event package, which is an effective and thread safe multicast event assignment. Awtkeystroke awtkeystroke represents the key operation on the keyboard (or equivalent input device). The awtpermission class is used for AWT permissions. The basicstroke basicstroke class defines a basic set of rendering attributes for the outline of graphic elements. These elements are rendered using the graphics2d object, and the stroke attribute of the object is set to basicstroke. Borderlayout is a border layout for arranging containers. It can arrange container components and adjust their sizes to meet the following five areas: North, South, East, West and center. The capabilities and properties of the buffercapabilities buffer. Buffercapabilities. Flipcontents a type safe enumeration of the possible background buffer contents after page flipping. The button class creates a label button. The canvas component represents a blank rectangular area on the screen in which the application can draw or capture user input events. The CardLayout CardLayout object is the layout manager for the container. A checkbox check box is a graphic component that can be on (true) or off (false). The checkboxgroup checkboxgroup class is used to collect the checkbox button set. The checkboxmenuitem class represents a check box that can be included in a menu. The choice choice class represents a pop-up selection menu. The color color class is used to encapsulate colors in the default sRGB color space or any color space identified by colorspace. Component component is an object with graphic representation ability, which can be displayed on the screen and interact with users. The componentorientation componentorientation class encapsulates the language sensitive orientation used to sort components or text content. Container a general abstract window toolkit (AWT) container object is a component that can contain other AWT components. Cursor encapsulates the bitmap representation of the mouse cursor. Default keyboardfocusmanager is the default keyboardfocusmanager for AWT applications. The desktop desktop class allows Java applications to start associated applications that have been registered on the local desktop to process URIs or files. Dialog dialog is a top-level window with a title and boundary. The boundary is usually used to obtain some form of input from the user. The dimension dimension class encapsulates the width and height (to the nearest integer) of components in a single object. The displaymode displaymode class encapsulates the bit depth, height, width and refresh rate of the graphicsdevice. Event note: the event class is obsolete and can only be used for backward compatibility. Eventqueue eventqueue is a platform independent class that queues events from underlying peer classes and trusted application classes. The FileDialog FileDialog class displays a dialog window from which the user can select a file. Flowlayout flow layout is used to arrange components in a directed flow, much like lines of text in a paragraph. Focustraversalpolicy focustraversalpolicy defines an order in which components with a specific focus loop root are traversed. The font font class represents a font that can be used to render text visually. The fontmetrics fontmetrics class defines a font specification object that encapsulates information about a particular font that will be rendered on a particular screen. A frame frame is a top-level window with a title and a border. The gradientpaint gradientpaint class provides a way to fill a shape with a linear color gradient pattern. The graphics class is an abstract base class for all graphics contexts, allowing applications to draw on components (which have been implemented on various devices) and closed screen images. Graphics2d this graphics2d class extends the graphics class to provide more complex control over geometry, coordinate transformation, color management, and text layout. The graphicsconfigtemplate graphicsconfigtemplate class is used to get a valid graphicsconfiguration. The graphicsconfiguration graphicsconfiguration class describes the characteristics of a graphic object, such as a printer or monitor. The graphicsdevice graphicsdevice class describes a graphics device that can be used in a specific graphics environment. The graphicsenvironment graphicsenvironment class describes the collection of graphicsdevice objects and font objects that can be used by Java (TM) applications on a specific platform. The GridBagConstraints GridBagConstraints class specifies the constraints for components that are laid out using the gridbaglayout class. Gridbaglayout gridbaglayout class is a flexible layout manager. It does not require the same size of components to align them vertically, horizontally or along their baseline. Gridbaglayoutinfo gridbaglayoutinfo is a utility class of gridbaglayout layout manager. The GridLayout GridLayout class is a layout processor that arranges the components of a container in the form of a rectangular grid. Image abstract class image is the superclass of all classes representing graphics and images. Functions and properties of image capabilities. Insets an insets object is a representation of the container boundary. Jobattributes controls the set of attributes for a print job. Type safe enumeration of possible default selection states for jobattributes. Defaultselectiontype. Jobattributes.destinationtype type safe enumeration of possible job targets. Type safe enumeration of possible dialog boxes that jobattributes.dialogtype displays to the user. Type safe enumeration of possible multi processing states for jobattributes.multipledocumenthandlingtype. Type safe enumeration of possible multi page full pages of jobattributes.sidestype. Keyboardfocusmanager keyboardfocusmanager is responsible for managing the active focus window and the current focus owner. A label label object is a component that places text in a container. The lineargradientpaint lineargradientpaint class provides a way to fill a shape with a linear color gradient pattern. The list component provides users with a scrollable list of text items. The MediaTracker MediaTracker class is a utility class that tracks the state of multiple media objects. The menu menu object is a drop-down menu component deployed from the menu bar. The menubar menubar class encapsulates the platform concept of the menu bar bound to the framework. Menucomponent abstract class menucomponent is the superclass of all menu related components. All items in a MenuItem menu must belong to the class MenuItem or one of its subclasses. Menushhortcut represents the menushhortcut class of MenuItem keyboard accelerator. Mouseinfo mouseinfo provides methods to obtain information about the mouse, such as the position of the mouse pointer and the number of mouse buttons. Multiplegradientpaint, a superclass of paints, uses multiple color gradients to fill their gratings. Pageattributes is used to control the set of attributes for printing page output. Pageattributes. Colortype is a type safe enumeration of possible color states. Pageattributes.mediatype is a type safe enumeration of possible paper sizes. Pageattributes. Orientationrequestedtype is a type safe enumeration of possible print directions. Pageattributes. Origintype may be a type safe enumeration of the origin. Pageattributes.printqualitytype is a type safe enumeration of possible print quality. Panel panel is the simplest container class. Point represents a point of position in (x, y) coordinate space, specified with integer precision. Pointerinfo describes the class where the pointer is located. The polygon polygon class encapsulates the description of a closed two-dimensional region in coordinate space. PopupMenu this class implements the dynamic pop-up menu in the specified position of the component. Printjob starts and executes the abstract class of the print job. The radialgradientpaint radialgradientpaint class provides a way to fill a shape with a circular radiant color gradient pattern. Rectangle rectangle specifies an area in the coordinate space, which can be defined by the point (x, y), width and height at the top left of the rectangle object in the coordinate space. The renderinghints renderinghints class defines and manages a collection of keys and associated values that allow applications to provide input to algorithm choices used by other classes that perform rendering and image processing services. Renderinghints.key defines the basic types of all keys used with renderinghints to control the selection of various algorithms in rendering and image pipelines. Robot class is used to generate native system input events for test automation, self running demos, and other applications that need to control the mouse and keyboard. Scrollbar the scrollbar class describes a scroll bar, which is a familiar user interface object. Scrollpane implements container classes for automatic horizontal and / or vertical scrolling of a single subcomponent. The scrollpaneadjustable class represents the state of the horizontal or vertical scroll bar of the scrollpane. Before the Java virtual machine (JVM) starts, splash screen can create a flash screen when the application starts. Systemcolor encapsulates a class that represents the symbolic color of the native GUI object color in the system. The systemtray systemtray class represents the system tray of the desktop. Textarea a textarea object is a multiline area that displays text. The textcomponent textcomponent class is a superclass of all components that allow text editing. A textfield textfield object is a text component that allows you to edit a single line of text. The texturepaint texturepaint class provides a way to fill a shape with a texture specified as bufferedimage. The toolkit class is the abstract superclass of all the actual implementation of abstract window toolkit. The TrayIcon TrayIcon object represents the tray icon that can be added to the system tray. The window window object is a top-level window without borders and menu bars