Added support for container interfaces in PHPRPC3.0.2forJava.

Source: Internet
Author: User
PHPRPC3.0.2forJava enhances support for container interfaces. PHPRPCforJava does not support container interfaces before 3.0.2. for example, the parameter types and return values of release methods cannot be declared as interface types such as List and Map, the proxy interface of the client does not work either. In 3.0.2, there is no such restriction. Both the parameter type and the return value type can be declared as List, Map, and s phprpc 3.0.2 for Java, enhancing support for container interfaces.
PHPRPC for Java does not support container interfaces before 3.0.2. for example, the parameter type and return value of the release method cannot be declared as List, Map, or other interface types, and the agent interface of the client is not supported.

In 3.0.2, there is no such restriction. Both the parameter type and the return value type can be declared as List, Map, Set, and Collection container types. When receiving data using these interface types, List and Collection are converted to the ArrayList type, Set is converted to the HashSet type, and Map is converted to the HashMap type. In addition, if a custom type inherits from an interface type, you can also use the interface type to declare such parameters and return values. Therefore, your existing business logic code can be released as a PHPRPC service without any modification!

1st floor long13168

public interface AuthoritiesManager {public Map
 
   getUrlAuthorities(String packCode);}public class AuthoritiesManagerImpl implements AuthoritiesManager {public Map
  
    getUrlAuthorities(String packCode) {Map
   
     urlAuthorities = new HashMap
    
     ();urlAuthorities.put("/index.gm*", "ROLE_USER");return urlAuthorities;}}
    
   
  
 


Excuse me, why did I use phprpc_spring to get the map string returned when getUrlAuthorities was called? it was a string of something like a reference address.
Normally it should be/index. gm * = ROLE_USER, but it returns/index. gm * = [B @ 9134db
I cannot explain it. Will the type be automatically converted if it is not interface-oriented?

Andot

PHPRPC processes strings in byte arrays, so Map cannot be used. This generic type (Java does not get the type in <> During execution, so it cannot be converted correctly). Therefore, although the key in Map is String, however, the value is byte [], so what you see is something like [B @ 9134db. In PHPRPC, you need to switch between them by yourself.

If you are in trouble, you can use the commercial version of PHPRPC hprose. the hprose string and byte array are separated, so this problem does not exist. The execution efficiency is 10 times higher than that of PHPRPC, and the ease of use and flexibility are greatly improved.

Third floor long13168


Thank you, andot.
Commercial applications are not considered for the moment. At present, a demo is provided to the bosses to let them feel the power of phprpc.

4 floor GRDJE 2009-12-08

Advertisement .....

Fifth Floor mathgl

Hprose... how is development now. I saw the website earlier, except for the price.

Andot

Written by mathgl

Hprose... how is development now. I saw the website earlier, except for the price.



We have released 1.0 and are now available for sale.

The following is an example of the manual:
Http://www.hprfc.com/doc/java.pdf

Andot

GRDJE writes

Advertisement .....



I'm just answering questions. Have you ever seen such a low-profile advertisement? Haha.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.