Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update source code to work with OSGi environment #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Update source code to work with OSGi environment #5

wants to merge 5 commits into from

Conversation

Ryo51289
Copy link

@Ryo51289 Ryo51289 commented Apr 9, 2014

Hi bigpuritz ! The first , thanks for your public source code ,this very useful to my work .
I've been used this source code to implement the Netty + Servlet API in OSGi environment , it work greate for me with a litlte bit of changes .I will be show you what I need and what I changed with netty-servlet-brigde

  • What i need :
    • My project building on OSGi environment and I want to work with Netty + Servlet API , I need a servlet handler that have ability to dynamic adding servlet at runtime (after netty server start ,if you add a new servlet or modified ,it will be re-adding to servlet handler for serve request)
    • With the demo in your repository , I see that the servlet should be loaded and initialized before the server ,servlet brigde handler started ,and if i add new servlet at runtime ,the servlet still available to serve request ,but it come without init parameters or init() function to be invoked
  • What did i change ?
    • I change a litle of source code to make it work with my require ,detail is following:

      • Adding getter/setter for 'servlets' in net.javaforge.netty.servlet.bridge.config.WebappConfiguration

      • Update net.javaforge.netty.servlet.bridge.impl.ServletBridgeWebapp constructor visibility to public

        When the server started , if new servlet is added at runtime , you need to initialized it ,so I get the servlets and :

        1.Check if servlet handler contains a servlet which same as new servlet added then remove it
        2.Adding servlet to servlet handler . I'm using :

                WebappConfiguration#addHttpServlet(servletInstance,servletPath) )
        

        3.Initialized servlet using ServletBridgeWebapp

               ServletBridgeWebapp  webServlet = new ServletBridgeWebapp();
               webServlet.init(webapp, channel);
        

      Now ,when you adding new servlet or modified the existence , servlet handler will re-adding and initializing it for you

That's all i need to show you about my change , if you have the greater way to accomplished that ,please show me these
Please consider to this pull issue and sorry about my English
Many thanks !

Some thing you want to test netty-servlet-brigde with a short curl command like :

  curl -v --cookie "USER_TOKEN=Yes" http://127.0.0.1:5000/

 This request sent a cookie without domain specific ,you will get a NullPointerException error
@hkurohara
Copy link

Hi, I'm Kurohara.
To bigpuritz, Thank you for making open this project.

Let me add more comment about this pull reqeust.
He is a member of our "WiperDog"(www.wiperdog.org) development team, and we were looking for useful servlet aid module that works on OSGi + netty framework.
Though we found netty-servlet-bridge(this project), there are some mismatch with OSGi environment.
We choose to change those mismatch by ourselves.

So this pull request is not 'personal' as mentioned in the title.
And I think the changes in this pull request is not for just our project, it's generic enough.

Thanks.

@Ryo51289 Ryo51289 changed the title Update source code for personal purpose Update source code to work with OSGi environment May 8, 2014
@Ryo51289
Copy link
Author

Ryo51289 commented May 8, 2014

Thanks for your comment , Kurohara . I've changed the pull request title to make it more relate with our change .Sorry about my mistake

@bigpuritz
Copy link
Owner

Hi @nguyenxuanluong-luvina,

can you please review your pull request due to original sourcecode changes (migration to netty 4.1.x).

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants