框架相关
原生JS虽能实现绝大部分功能,但要么就是过于繁琐,要么就是存在缺陷,故绝大多数开发者都会首选框架开发方案。现阶段较热门是React、Vue两大框架,两者工作原理上存在共通点,也存在一些不同点,对于校招来说,不需要两个框架都学得特别熟,一般面试官会针对你简历中写的框架进行提问。
在框架方面,生命周期、钩子函数、虚拟DOM这些基本知识是必须要掌握的,在学习的过程可以结合框架的官方文档
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
Vue框架
知识要点:
1. vue-cli工程
2. vue核心知识点
3. vue-router
4. vuex
5. http请求
6. UI样式
7. 常用功能
8. MVVM设计模式
React框架
知识要点:
1. 基本知识
2. React 组件
3. React Redux
4. React 路由
客户端配置方式:
JAXRSClientFactoryBean factory = new JAXRSClientFactoryBean();
factory.setServiceClass(RestService.class);
factory.setAddress(url);
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
RestService ser = factory.create(RestService.class);
ser.get();
输出日志形式如下:客户端:
[INFO ] 03-22 22:33:39 org.apache.cxf.interceptor.AbstractLoggingInterceptor.log(AbstractLoggingInterceptor.java:250) Outbound Message
---------------------------
ID: 1
Address: http://localhost:8080/webapp/ws/cxf/rest
Http-Method: GET
Content-Type: application/xml
Headers: {Content-Type=[application/xml], Accept=[text/plain]}
--------------------------------------
[INFO ] 03-22 22:33:39 org.apache.cxf.interceptor.AbstractLoggingInterceptor.log(AbstractLoggingInterceptor.java:250) Inbound Message
----------------------------
ID: 1
Response-Code: 200
Encoding: ISO-8859-1
Content-Type: text/plain
Headers: {content-type=[text/plain], Date=[Wed, 22 Mar 2017 14:33:39 GMT], transfer-encoding=[chunked]}
Payload: this is default get plain
--------------------------------------
服务端:
[INFO ] 03-22 22:33:39 org.apache.cxf.interceptor.AbstractLoggingInterceptor.log(AbstractLoggingInterceptor.java:250) Inbound Message
----------------------------
ID: 4
Address: http://localhost:8080/webapp/ws/cxf/rest
Encoding: UTF-8
Http-Method: GET
Content-Type: application/xml
Headers: {Accept=[text/plain], cache-control=[no-cache], connection=[keep-alive], content-type=[application/xml], host=[localhost:8080], pragma=[no-cache], user-agent=[Apache CXF 3.0.3]}
--------------------------------------
[INFO ] 03-22 22:33:39 org.apache.cxf.interceptor.AbstractLoggingInterceptor.log(AbstractLoggingInterceptor.java:250) Outbound Message
---------------------------
ID: 4
Response-Code: 200
Content-Type: text/plain
Headers: {Content-Type=[text/plain], Date=[Wed, 22 Mar 2017 14:33:39 GMT]}
Payload: this is default get plain
--------------------------------------
自定义拦截器
CXF中也可以自定义拦截器,CXF中实现自定义拦截器需要继承AbstractPhaseInterceptor或者其子类如AbstractSoapInterceptor。
一个简单的拦截器:
/**
* CXF 自定义拦截器
*/
public class MyInterceptor extends AbstractPhaseInterceptor{
//必需提供一个带参数的构造函数
public MyInterceptor(String phase){
super(phase);
}
//覆写拦截后的动作
@Override
public void handleMessage(Message message) throws Fault{
Q.p(“~~~~~~~~~~~~~~~~~~”);
if (message.getDestination() != null) {
Q.p(message.getDestination().getAddress());
}
if (message.getExchange() != null) {
Q.p(message.getExchange().getInMessage());
Q.p(message.getExchange().getOutMessage());
}
Q.p(message.getContent(String.class));
Q.p(“~~~~~~~~~~~~~~~~~~~”);
}
}
—
添加到客户端拦截器链:
JAXRSClientFactoryBean factory = new JAXRSClientFactoryBean();
factory.setServiceClass(RestService.class);
factory.setAddress(url);
factory.getInInterceptors().add(new MyInterceptor(Phase.RECEIVE));
factory.getOutInterceptors().add(new MyInterceptor(Phase.SEND));
ser = factory.create(RestService.class);
ser.get();
—
输出:
[DEBUG] 03-22 23:07:38 org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:304) Invoking handleMessage on interceptor cn.lg.ws.MyInterceptor@58cbafc2
~~~~~~~~~~~~~~~~~~
null
{org.apache.cxf.message.Message.PROTOCOL_HEADERS={Content-Type=[application/xml], Accept=[text/plain]}, org.apache.cxf.transport.Conduit=conduit: class org.apache.cxf.transport.http.URLConnectionHTTPConduit1715248762target: http://localhost:8080/webapp/ws/cxf/rest, org.apache.cxf.request.uri=http://localhost:8080/webapp/ws/cxf/rest, jaxrs.template.parameters=null, org.apache.cxf.message.Message.ENDPOINT_ADDRESS=http://localhost:8080/webapp/ws/cxf/rest, jaxrs.proxy=true, org.apache.cxf.request.method=GET, org.apache.cxf.transport.processOneWayResponse=true, http.connection=sun.net.www.protocol.http.HttpURLConnection:http://localhost:8080/webapp/ws/cxf/rest, org.apache.cxf.message.Message.BASE_PATH=http://localhost:8080/webapp/ws/cxf/, org.apache.cxf.client=true, org.apache.cxf.invocation.context={ResponseContext={}, RequestContext={org.apache.cxf.message.Message.PROTOCOL_HEADERS={Content-Type=[application/xml], Accept=[text/plain]}, org.apache.cxf.request.uri=http://localhost:8080/webapp/ws/cxf/rest, BODY_INDEX=-1, org.apache.cxf.message.Message.ENDPOINT_ADDRESS=http://localhost:8080/webapp/ws/cxf/rest, jaxrs.proxy=true, org.apache.cxf.jaxrs.model.OperationResourceInfo=org.apache.cxf.jaxrs.model.OperationResourceInfo@117159c0}}, java.lang.annotation.Annotation=[Ljava.lang.annotation.Annotation;@19e4653c, org.apache.cxf.message.inbound=false, http.scheme=http, Content-Type=application/xml, org.apache.cxf.empty.request=true}
null
[![复制代码](https://i-blog.csdnimg.cn/blog_migrate/968e8d69679fa1557fd600f03280f162.gif)](https://blog.csdn.net/swazer_z/article/details/72902721 "复制代码")
\---
[![复制代码](https://img-blog.csdnimg.cn/img_convert/448080abf90ce4758b4dd79d75e77a74.gif)](https://blog.csdn.net/swazer_z/article/details/72902721 "复制代码")
### ajax
1)ajax请求的原理/ 手写一个ajax请求?
2)readyState?
3)ajax异步与同步的区别?
4)ajax传递中文用什么方法?
![ajax.PNG](https://img-blog.csdnimg.cn/img_convert/71030cbfd6aca6085d4df8bebcf979c0.webp?x-oss-process=image/format,png)
![前12.PNG](https://img-blog.csdnimg.cn/img_convert/edff5557d3612be3a982cfaa42a2118e.webp?x-oss-process=image/format,png)
**[开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】](https://bbs.csdn.net/topics/618166371)**
15018899004)]](https://blog.csdn.net/swazer_z/article/details/72902721 "复制代码")
### ajax
1)ajax请求的原理/ 手写一个ajax请求?
2)readyState?
3)ajax异步与同步的区别?
4)ajax传递中文用什么方法?
[外链图片转存中...(img-B9IsH4rZ-1715018899004)]
[外链图片转存中...(img-4diP9wDr-1715018899005)]
**[开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】](https://bbs.csdn.net/topics/618166371)**