Got it

Summary of debugging web-controller interface

208 0 8 0 0

1.1 Summary of debugging web-controller interface


1. Classes transferred by web and controller must be serialized


Through XML serialization or Jason serialization, most of our current code is serialized through xml, using JAXB architecture.


2. Serialized classes must have default constructors. If there is no override constructor, the default constructor does not need to be displayed and written. If the constructor is overridden, the default constructor must be written.


This is achieved by adding the annotation to the class that needs to be serialized


The @XmlRootElement (name = getBackupDetailRsp) in which the name should be noted that there should be no renaming, typically using the first lowercase letter of the class name.


@XmlAccessorType (XmlAccessType.FIELD)


3. After creating a restservice, beanid of the corresponding implementation class of the service must be added to controller-content.xml


For example:


<beans profile= "persistence-enabled">


<! - REST server - >


<bean id="restServerFactoryBean" class="org.apache.cxf.jaxrs.JAXRS ServerFactoryBean"


Init-method= "create" depends-on= "persistence context">


<property name="address" value="${controller.rest.server.url}"/>


<property name="service beans">


<list> <! - @Cmponents should be placed in com.huawei.hadoop.om.controller.rest.resources-->


<ref bean="cluster resource"/>


</list>


</property>


</bean>


</beans>


<beans profile= "persistence-disabled">


<! - REST server - >


<bean id="restServerFactoryBean" class="org.apache.cxf.jaxrs.JAXRS ServerFactoryBean"


Init-method= "create">


<property name="address" value="${controller.rest.server.url}"/>


<property name="service beans">


<list> <! - @Cmponents should be placed in com.huawei.hadoop.om.controller.rest.resources-->


<ref bean="cluster resource"/>


</list>


</property>


</bean>


</beans>


4. If you have a GET interface, but you pass a parameter, which is a basic type, you need to add @PathParam ("clusterId") int clusterId or @QueryParam before the parameter.

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.