mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-23 23:58:44 +08:00
fix some format
This commit is contained in:
commit
5d95f37235
@ -31,6 +31,7 @@ public class ApiTestModule implements Module {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T fromXml(Class<T> clazz, InputStream is) {
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
xstream.alias("xml", clazz);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.chanjar.weixin.mp.api.impl;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@ -9,8 +10,6 @@ import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.mp.api.ApiTestModule.WxXmlMpInMemoryConfigStorage;
|
||||
|
||||
import org.testng.Assert;
|
||||
|
||||
@Test
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxMpServiceImplTest {
|
||||
@ -110,11 +109,9 @@ public class WxMpServiceImplTest {
|
||||
|
||||
@Test
|
||||
public void testBuildQrConnectUrl() {
|
||||
String qrConnectUrl = this.wxService
|
||||
.buildQrConnectUrl(
|
||||
((WxXmlMpInMemoryConfigStorage) this.wxService
|
||||
.getWxMpConfigStorage()).getOauth2redirectUri(),
|
||||
WxConsts.QRCONNECT_SCOPE_SNSAPI_LOGIN, null);
|
||||
String qrconnectRedirectUrl = ((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getQrconnectRedirectUrl();
|
||||
String qrConnectUrl = this.wxService.buildQrConnectUrl(qrconnectRedirectUrl,
|
||||
WxConsts.QRCONNECT_SCOPE_SNSAPI_LOGIN, null);
|
||||
Assert.assertNotNull(qrConnectUrl);
|
||||
System.out.println(qrConnectUrl);
|
||||
}
|
||||
|
@ -1,5 +1,12 @@
|
||||
package me.chanjar.weixin.mp.demo;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import me.chanjar.weixin.common.util.StringUtils;
|
||||
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageRouter;
|
||||
@ -7,21 +14,12 @@ import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.WxMpXmlMessage;
|
||||
import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
public class WxMpEndpointServlet extends HttpServlet {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected WxMpConfigStorage wxMpConfigStorage;
|
||||
protected WxMpService wxMpService;
|
||||
protected WxMpMessageRouter wxMpMessageRouter;
|
||||
@ -33,7 +31,8 @@ public class WxMpEndpointServlet extends HttpServlet {
|
||||
this.wxMpMessageRouter = wxMpMessageRouter;
|
||||
}
|
||||
|
||||
@Override protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
|
@ -1,29 +1,28 @@
|
||||
package me.chanjar.weixin.mp.demo;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public class WxMpOAuth2Servlet extends HttpServlet {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected WxMpService wxMpService;
|
||||
|
||||
public WxMpOAuth2Servlet(WxMpService wxMpService) {
|
||||
this.wxMpService = wxMpService;
|
||||
}
|
||||
|
||||
@Override protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
|
Loading…
Reference in New Issue
Block a user