loklak / loklak_server

Distributed Open Source twitter and social media message search server that anonymously collects, shares, dumps and indexes data http://api.loklak.org
GNU Lesser General Public License v2.1
1.38k stars 222 forks source link

Registering missing servelets in loklakserver.java #813

Closed jigyasa-grover closed 8 years ago

jigyasa-grover commented 8 years ago

It has been observed that many services which have been successfully implemented as console services are not registered individually in loklakserver.java

shivenmian commented 8 years ago

Er, they are there on loklakserver.java. look closely

jigyasa-grover commented 8 years ago

@shivenmian Where to look closely ?

Edit: If you mean their classes were imported ? But their servlets were never added.

shivenmian commented 8 years ago

Check lines 490-526 and 535-593 in https://github.com/loklak/loklak_server/blob/development/src/org/loklak/LoklakServer.java. Servlets are registered here.

jigyasa-grover commented 8 years ago

@shivenmian I dont see any servletHandler.addServlet(..) for them

shivenmian commented 8 years ago

Check lines 527-532, they are added in a loop.

jigyasa-grover commented 8 years ago

Also, adding them in Class<? extends Servlet>[] services = new Class[]{...} is left, which I am pushing in the next commit.

shivenmian commented 8 years ago

No you're doing it wrong. That's not to be done. There are two ways of registering.

jigyasa-grover commented 8 years ago

@shivenmian

        for (Class<? extends Servlet> service: services)
            try {
                servletHandler.addServlet(service, ((APIHandler) (service.newInstance())).getAPIPath());
            } catch (InstantiationException | IllegalAccessException e) {
                e.printStackTrace();
            }

I get the point that they are being added in the loop. But I guess I need to add them in the list of services at least ?

jigyasa-grover commented 8 years ago

@shivenmian That's what I meant, rectifying in the next commit.

shivenmian commented 8 years ago

490-526 exactly is the list of services. Just add them there. The remaining five servlets.

jigyasa-grover commented 8 years ago

@shivenmian Got that already :) Thanks.

jigyasa-grover commented 8 years ago

@shivenmian A new PR has been opened https://github.com/loklak/loklak_server/pull/815/files