自学几个月前端,为什么感觉什么都没学到??
这种现象在很多的初学者和自学前端的同学中是比较的常见的。
因为自学走的弯路是比较的多的,会踩很多的坑,学习的过程中是比较的迷茫的。
最重要的是,在学习的过程中,不知道每个部分该学哪些知识点,学到什么程度才算好,学了能做什么。
很多自学的朋友往往都是自己去找资料学习的,资料上有的或许就学到了,资料上没有的或许就没有学到。
这就会给人一个错误的信息就是,我把资料上的学完了,估计也-就差不多的了。
但是真的是这样的吗?非也,因为很多人找的资料就是很基础的。学完了也就是掌握一点基础的东西。分享给你一份前端分析路线,你可以参考。
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
还有很多的同学在学习的过程中一味的追求学的速度,很快速的刷视频,写了后面忘了前面,最后什么都没有学到,什么都知道,但是什么都不懂,要具体说,也说不出个所以然。
所以学习编程一定要注重实践操作,练习敲代码的时间一定要多余看视频的时间。
<jaxrs:server id=“restServiceContainer” address=“/cxf”>
jaxrs:inInterceptors
</jaxrs:inInterceptors>
jaxrs:outInterceptors
</jaxrs:outInterceptors>
jaxrs:serviceBeans
</jaxrs:serviceBeans>
</jaxrs:server>
API方式:
JAXRSServerFactoryBean jrf = new JAXRSServerFactoryBean();
jrf.setResourceClasses(RestServiceImpl.class);
jrf.setResourceProvider(RestServiceImpl.class, new SingletonResourceProvider(new RestServiceImpl()));
jrf.setAddress(url);
jrf.getInInterceptors().add(new LoggingInInterceptor());
jrf.getOutInterceptors().add(new LoggingOutInterceptor());
jrf.create();
客户端配置方式:
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(“~~~~~~~~~~~~~~~~~~~”);
}
}
—
分享
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
blog.csdn.net/swazer_z/article/details/72902721 “复制代码”)
—