[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openmrs-dev
Subject:    Re: Using Swagger In module servlets does not work as expected but works through openmrs core servel
From:       Harsha Kumara <harsz89 () gmail ! com>
Date:       2015-04-10 18:25:22
Message-ID: CAEXeE2xZk6kaKoohARWY_GJNG_QshiZn5CfYEcRCbH4VeRhL9A () mail ! gmail ! com
[Download RAW message or body]

Hi Wyclif,

I did decompile and saw the code. Please refer [1]. There you can following
line in init method. That is the place where it read the params, Content of
the class is in [2].
        WebXMLReader webConfig = new WebXMLReader(servletConfig);

Got your point and If so I need to implement the getInitParameter in
the ModuleServlet
and check. I just checked it with 1.9.8 with modified getInitParameter
method. But it still gives a blank page. :(. I confirmed that method
is getInitParameter in ModuleServelet is calling at server start. But when
I request for the servelet, it's still giving blank page.

@Darius, Previously I checked defining the servelet in web.xml and it
worked. :). But I'm not sure whether swagger annotations which uses to
describe the API will work. Because we need to give the package of
servelets which reside the api through servelet init parameter. Even if it
worked, defining module packages in web.xml can't be done as it add
dependency from openmrs core to a module. For WebService rest module, I
think we no need of using swagger servelet based approach instead we can
focus on [3] which specify how swagger can integrate with Spring MVC.

AFAIR to use swagger with Spring annotated APIs which use request mapping
annotation, the spring version must be 3.2.5 or above. :).

[1] - http://pastebin.com/6fsLQ9ze
[2] - http://pastebin.com/7Yk8HwYf
[3] - https://github.com/springfox/springfox

Thanks,
Harsha


On Fri, Apr 10, 2015 at 8:56 PM, Wyclif Luyima <wyclif@openmrs.org> wrote:

> Hi Harsha,
> 
> I doubt if we are on the same page, i meant  init params are not read in
> for module servlets in OpenMRS, so they can't be working and that is for
> sure one primary reason your code fails when you put then in the config.xml
> file, can you try to run the module of master when you have implemented the
> getInitParameter..() methods in ModuleServlet class and see what happens?
> Can't you decompile the java class that was generated from the scala code?
> So you can look a the code
> 
> 
> Wyclif
> 
> On Fri, Apr 10, 2015 at 10:27 AM, Suranga Kasthurirathne <
> surangakas@gmail.com> wrote:
> 
> > 
> > Yikes.
> > 
> > It seems that our efforts to get this running using the (pretty) swagger
> > version is failing. Given that we're failing at getting this up, I think we
> > should fall back on a sketchier (but working) front end using plan old JSP.
> > A better swagger based UI can happen later, perhaps as part of GSoC 2016 ?
> > 
> > On Thu, Apr 9, 2015 at 11:32 PM, Harsha Kumara <harsz89@gmail.com> wrote:
> > 
> > > Hi Wyclif,
> > > 
> > > I tried to override the init parameters from many ways and couldn't do
> > > that. Actually parameters are read in the init method
> > > of DefaultServletReaderConfig. There WebXMLReader webConfig = new
> > > WebXMLReader(servletConfig). But the problem is it's not public.I could
> > > have take the source of the servelet and done the same. But the problem is
> > > that code was written in Scala.
> > > 
> > > So I might not have any option here :(
> > > 
> > > Thanks,
> > > Harsha
> > > 
> > > 
> > > 
> > > On Wed, Apr 8, 2015 at 10:39 PM, Wyclif Luyima <wyclif@openmrs.org>
> > > wrote:
> > > 
> > > > Hi Harsha,
> > > > 
> > > > I just talked with Suranga and this is what i imagine might be going
> > > > wrong. Those swagger servlets you are configuring are written in a standard
> > > > way and you expect them to be called in a standard way by the container but
> > > > their is a variation in how openmrs module servlets instances are
> > > > constructed and get called, therefore there are certain things that don't
> > > > work e.g calls to  getInitParameter() and getInitParameterNames() are not
> > > > supported as of now in our custom implementation of  ServletConfig class
> > > > for modules which means all those init params you are defining in the
> > > > module are not getting picked, this is why it works when you register
> > > > things in web.xml and fail when you define them in the config.xml file.
> > > > 
> > > > One possible solution would be to subclass those swagger servlet
> > > > classes, override getInitParameter(String) and getInitParameterNames()
> > > > methods, and read in those values as constants, see if that solves the
> > > > problem.
> > > > 
> > > > I have created TRUNK-4673
> > > > <https://issues.openmrs.org/browse/TRUNK-4673> to add support for
> > > > module servlet init paramaters.
> > > > 
> > > > Wyclif
> > > > 
> > > > On Wed, Apr 8, 2015 at 12:04 PM, Harsha Kumara <harsz89@gmail.com>
> > > > wrote:
> > > > 
> > > > > Hi Wyclif,
> > > > > 
> > > > > Please find code in branch[1]. I have follow the approach suggested in
> > > > > [2].
> > > > > 
> > > > > [1] - https://github.com/harsha89/openmrs-module-fhir/tree/swagger
> > > > > [2] -
> > > > > https://github.com/swagger-api/swagger-core/wiki/Servlet-Quickstart
> > > > > 
> > > > > Thanks,
> > > > > Harsha
> > > > > 
> > > > > On Wed, Apr 8, 2015 at 8:57 PM, Wyclif Luyima <wyclif@openmrs.org>
> > > > > wrote:
> > > > > 
> > > > > > Can you share your code?
> > > > > > 
> > > > > > Wyclif
> > > > > > 
> > > > > > On Tue, Apr 7, 2015 at 10:52 PM, Harsha Kumara <harsz89@gmail.com>
> > > > > > wrote:
> > > > > > 
> > > > > > > Hey Wyclif,
> > > > > > > 
> > > > > > > Yeas, the servelet is hitting. As I mentioned earlier, I have
> > > > > > > confirm it with extending provided servelet with my own servelet and
> > > > > > > debuging it.
> > > > > > > 
> > > > > > > Thanks,
> > > > > > > Harsha
> > > > > > > 
> > > > > > > On Wed, Apr 8, 2015 at 12:34 AM, Wyclif Luyima <wyclif@openmrs.org>
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Hi Harsha,
> > > > > > > > 
> > > > > > > > What URL are you entering to hit the servlet? Did you read this
> > > > > > > > <https://wiki.openmrs.org/display/docs/Module+Servlets>?
> > > > > > > > 
> > > > > > > > Wyclif
> > > > > > > > 
> > > > > > > > On Mon, Apr 6, 2015 at 3:44 PM, Harsha Kumara <harsz89@gmail.com>
> > > > > > > > wrote:
> > > > > > > > 
> > > > > > > > > Hi all,
> > > > > > > > > 
> > > > > > > > > I was following[1] to integrate swagger into the FHIR module.
> > > > > > > > > In[1], we have to add mappings as follow in web.xml
> > > > > > > > > 
> > > > > > > > > For finding the annotated APIs which uses by swagger internal
> > > > > > > > > 
> > > > > > > > > <!-- swagger servlet reader -->
> > > > > > > > > <servlet>
> > > > > > > > > <servlet-name>DefaultServletReaderConfig</servlet-name>
> > > > > > > > > <servlet-class>com.wordnik.swagger.servlet.config.DefaultServletReaderConfig</servlet-class>
> > > > > > > > >  <load-on-startup>2</load-on-startup>
> > > > > > > > > <init-param>
> > > > > > > > > <param-name>swagger.resource.package</param-name>
> > > > > > > > > <param-value>com.wordnik.swagger.sample.servlet</param-value>
> > > > > > > > > </init-param>
> > > > > > > > > <init-param>
> > > > > > > > > <param-name>swagger.api.basepath</param-name>
> > > > > > > > > <param-value>http://localhost:8002</param-value>
> > > > > > > > > </init-param>
> > > > > > > > > <init-param>
> > > > > > > > > <param-name>api.version</param-name>
> > > > > > > > > <param-value>1.0.0</param-value>
> > > > > > > > > </init-param>
> > > > > > > > > 
> > > > > > > > > </servlet>
> > > > > > > > > 
> > > > > > > > > And  swagger API servelet
> > > > > > > > > 
> > > > > > > > > <!-- swagger api declaration -->
> > > > > > > > > <servlet>
> > > > > > > > > <servlet-name>ApiDeclarationServlet</servlet-name>
> > > > > > > > > <servlet-class>com.wordnik.swagger.servlet.listing.ApiDeclarationServlet</servlet-class>
> > > > > > > > >  </servlet>
> > > > > > > > > <servlet-mapping>
> > > > > > > > > <servlet-name>ApiDeclarationServlet</servlet-name>
> > > > > > > > > <url-pattern>/api-docs/*</url-pattern>
> > > > > > > > > 
> > > > > > > > > </servlet-mapping>
> > > > > > > > > 
> > > > > > > > > When I specified that in openmrs web.xml. It will generate the api
> > > > > > > > > doc from selected servelets in http://
> > > > > > > > > localhost/openmrs/api-docs.
> > > > > > > > > 
> > > > > > > > > But when I declare the servelets in module config.xml I get no
> > > > > > > > > response.
> > > > > > > > > 
> > > > > > > > > I even extend above servelet and created one by own. GET requests
> > > > > > > > > are coming to the servelet which I confirmed through debugging. But \
> > > > > > > > > there is no response from the servelet declared in the module \
> > > > > > > > > config.xml even doGet function is called in the servelet.
> > > > > > > > > 
> > > > > > > > > Any thoughts about what can be going wrong here?
> > > > > > > > > 
> > > > > > > > > Thanks,
> > > > > > > > > Harsha
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > [1] -
> > > > > > > > > https://github.com/swagger-api/swagger-core/wiki/Servlet-Quickstart
> > > > > > > > > --
> > > > > > > > > *Harsha Kumara*
> > > > > > > > > *Software Engineer*
> > > > > > > > > *WSO2 Inc.*
> > > > > > > > > *Sri Lanka.*
> > > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > --
> > > > > > > > Wyclif Luyima
> > > > > > > > Regenstrief Institute Inc.
> > > > > > > > 
> > > > > > > > Confidentiality Notice: The contents of this message and any files
> > > > > > > > transmitted with it may contain confidential and/or privileged \
> > > > > > > > information and are intended solely for the use of the named \
> > > > > > > > addressee(s). Additionally, the information contained herein may have \
> > > > > > > > been disclosed to you from medical records with confidentiality \
> > > > > > > > protected by federal and state laws. Federal regulations and State \
> > > > > > > > laws prohibit you from making further disclosure of such information \
> > > > > > > > without the specific written consent of the person to whom the \
> > > > > > > > information pertains or as otherwise permitted by such regulations. A \
> > > > > > > > general authorization for the release of medical or other information \
> > > > > > > > is not sufficient for this purpose. 
> > > > > > > > If you have received this message in error, please notify the
> > > > > > > > sender by return e-mail and delete the original message. Any \
> > > > > > > > retention, disclosure, copying, distribution or use of this \
> > > > > > > > information by anyone other than the intended recipient is strictly \
> > > > > > > > prohibited. 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > --
> > > > > > > *Harsha Kumara*
> > > > > > > *Software Engineer*
> > > > > > > *WSO2 Inc.*
> > > > > > > *Sri Lanka.*
> > > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > --
> > > > > > Wyclif Luyima
> > > > > > Regenstrief Institute Inc.
> > > > > > 
> > > > > > Confidentiality Notice: The contents of this message and any files
> > > > > > transmitted with it may contain confidential and/or privileged \
> > > > > > information and are intended solely for the use of the named \
> > > > > > addressee(s). Additionally, the information contained herein may have \
> > > > > > been disclosed to you from medical records with confidentiality protected \
> > > > > > by federal and state laws. Federal regulations and State laws prohibit \
> > > > > > you from making further disclosure of such information without the \
> > > > > > specific written consent of the person to whom the information pertains \
> > > > > > or as otherwise permitted by such regulations. A general authorization \
> > > > > > for the release of medical or other information is not sufficient for \
> > > > > > this purpose. 
> > > > > > If you have received this message in error, please notify the sender
> > > > > > by return e-mail and delete the original message. Any retention,
> > > > > > disclosure, copying, distribution or use of this information by anyone
> > > > > > other than the intended recipient is strictly prohibited.
> > > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > --
> > > > > *Harsha Kumara*
> > > > > *Software Engineer*
> > > > > *WSO2 Inc.*
> > > > > *Sri Lanka.*
> > > > > 
> > > > 
> > > > 
> > > > 
> > > > --
> > > > Wyclif Luyima
> > > > Regenstrief Institute Inc.
> > > > 
> > > > Confidentiality Notice: The contents of this message and any files
> > > > transmitted with it may contain confidential and/or privileged information
> > > > and are intended solely for the use of the named addressee(s).
> > > > Additionally, the information contained herein may have been disclosed to
> > > > you from medical records with confidentiality protected by federal and
> > > > state laws. Federal regulations and State laws prohibit you from making
> > > > further disclosure of such information without the specific written consent
> > > > of the person to whom the information pertains or as otherwise permitted by
> > > > such regulations. A general authorization for the release of medical or
> > > > other information is not sufficient for this purpose.
> > > > 
> > > > If you have received this message in error, please notify the sender by
> > > > return e-mail and delete the original message. Any retention, disclosure,
> > > > copying, distribution or use of this information by anyone other than the
> > > > intended recipient is strictly prohibited.
> > > > 
> > > 
> > > 
> > > 
> > > --
> > > *Harsha Kumara*
> > > *Software Engineer*
> > > *WSO2 Inc.*
> > > *Sri Lanka.*
> > > 
> > 
> > 
> > 
> > --
> > Best Regards,
> > Suranga
> > 
> 
> 
> 
> --
> Wyclif Luyima
> Regenstrief Institute Inc.
> 
> Confidentiality Notice: The contents of this message and any files
> transmitted with it may contain confidential and/or privileged information
> and are intended solely for the use of the named addressee(s).
> Additionally, the information contained herein may have been disclosed to
> you from medical records with confidentiality protected by federal and
> state laws. Federal regulations and State laws prohibit you from making
> further disclosure of such information without the specific written consent
> of the person to whom the information pertains or as otherwise permitted by
> such regulations. A general authorization for the release of medical or
> other information is not sufficient for this purpose.
> 
> If you have received this message in error, please notify the sender by
> return e-mail and delete the original message. Any retention, disclosure,
> copying, distribution or use of this information by anyone other than the
> intended recipient is strictly prohibited.
> 



-- 
*Harsha Kumara*
*Software Engineer*
*WSO2 Inc.*
*Sri Lanka.*

-- 
OpenMRS Developers: http://om.rs/dev
Post: dev@openmrs.org | Unsubscribe: dev+unsubscribe@openmrs.org
Manage your OpenMRS subscriptions: http://om.rs/id

*** FINAL WARNING: This group will be moved to OpenMRS Talk effective 10 April 2015 \
at 19:00 UTC. Please visit \
https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508 for \
details and to make necessary changes.

To unsubscribe from this group and stop receiving emails from it, send an email to \
dev+unsubscribe@openmrs.org.


[Attachment #3 (text/html)]

<div dir="ltr">Hi Wyclif,<div><br></div><div>I did decompile and saw the code. Please \
refer [1]. There you can following line in init method. That is the place where it \
read the params, Content of the class is in [2].  </div>            WebXMLReader \
webConfig = new WebXMLReader(servletConfig);<div><br></div><div>Got your point and If \
so I need to implement the  <span style="font-size:13px">getInitParameter in the  \
</span><span style="font-size:13px">ModuleServlet and check. I just checked it with \
1.9.8 with modified  </span>getInitParameter method. But it still gives a blank page. \
:(. I confirmed that method is  getInitParameter in ModuleServelet is calling at \
server start. But when I request for the servelet, it&#39;s still giving blank \
page.</div><div><br></div><div>@Darius, Previously I checked defining the servelet in \
web.xml and it worked. :). But I&#39;m not sure whether swagger annotations which \
uses to describe the API will work. Because we need to give the package of servelets \
which reside the api through servelet init parameter. Even if it worked, defining \
module packages in web.xml can&#39;t be done as it add dependency from openmrs core \
to a module. For WebService rest module, I think we no need of using swagger servelet \
based approach instead we can focus on [3] which specify how swagger can integrate \
with Spring MVC.</div><div><br></div><div>AFAIR to use swagger with Spring annotated \
APIs which use request mapping annotation, the spring version must be 3.2.5 or above. \
:).   </div><div><span style="font-size:13px">  </span></div><div>[1] - <a \
href="http://pastebin.com/6fsLQ9ze" \
target="_blank">http://pastebin.com/6fsLQ9ze</a><br></div><div>[2] - <a \
href="http://pastebin.com/7Yk8HwYf" target="_blank">http://pastebin.com/7Yk8HwYf</a>  \
</div><div>[3] -  <a \
href="https://github.com/springfox/springfox">https://github.com/springfox/springfox</ \
a></div><div><br></div><div>Thanks,</div><div>Harsha</div><div><br></div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 10, 2015 at 8:56 PM, \
Wyclif Luyima <span dir="ltr">&lt;<a href="mailto:wyclif@openmrs.org" \
target="_blank">wyclif@openmrs.org</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Harsha,<br><br></div>I doubt if \
we are on the same page, i meant   init params are not read in for module servlets in \
OpenMRS, so they can&#39;t be working and that is for sure one primary reason your \
code fails when you put then in the config.xml file, can you try to run the module of \
master when you have implemented the getInitParameter..() methods in ModuleServlet \
class and see what happens? Can&#39;t you decompile the java class that was generated \
from the scala code? So you can look a the code<span class="HOEnZb"><font \
color="#888888"><br><br><br></font></span></div><span class="HOEnZb"><font \
color="#888888">Wyclif<br></font></span></div><div class="HOEnZb"><div \
class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 10, 2015 \
at 10:27 AM, Suranga Kasthurirathne <span dir="ltr">&lt;<a \
href="mailto:surangakas@gmail.com" \
target="_blank">surangakas@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><br><div>Yikes.</div><div><br></div><div>It \
seems that our efforts to get this running using the (pretty) swagger version is \
failing. Given that we&#39;re failing at getting this up, I think we should fall back \
on a sketchier (but working) front end using plan old JSP.</div><div>A better swagger \
based UI can happen later, perhaps as part of GSoC 2016 ?</div></div><div \
class="gmail_extra"><div><div><br><div class="gmail_quote">On Thu, Apr 9, 2015 at \
11:32 PM, Harsha Kumara <span dir="ltr">&lt;<a href="mailto:harsz89@gmail.com" \
target="_blank">harsz89@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi Wyclif,<div><br></div><div>I tried to \
override the init parameters from many ways and couldn&#39;t do that. Actually \
parameters are read in the init method of  DefaultServletReaderConfig. There  \
WebXMLReader webConfig = new WebXMLReader(servletConfig). But the problem is it&#39;s \
not public.I could have take the source of the servelet and done the same. But the \
problem is that code was written in Scala.  </div><div><br></div><div>So I might not \
have any option here \
:(</div><div><br></div><div>Thanks,</div><div>Harsha</div><div><br></div><div><br></div></div><div><div><div \
class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 8, 2015 at 10:39 PM, \
Wyclif Luyima <span dir="ltr">&lt;<a href="mailto:wyclif@openmrs.org" \
target="_blank">wyclif@openmrs.org</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Harsha,<br><br></div>I just \
talked with Suranga and this is what i imagine might be going wrong. Those swagger \
servlets you are configuring are written in a standard way and you expect them to be \
called in a standard way by the container but their is a variation in how openmrs \
module servlets instances are constructed and get called, therefore there are certain \
things that don&#39;t work e.g calls to   getInitParameter() and \
getInitParameterNames() are not supported as of now in our custom implementation of   \
ServletConfig class for modules which means all those init params you are defining in \
the module are not getting picked, this is why it works when you register things in \
web.xml and fail when you define them in the config.xml file.<br><br></div>One \
possible solution would be to subclass those swagger servlet classes, override \
getInitParameter(String) and getInitParameterNames() methods, and read in those \
values as constants, see if that solves the problem.<br><br></div><div>I have created \
<a href="https://issues.openmrs.org/browse/TRUNK-4673" target="_blank">TRUNK-4673</a> \
to add support for module servlet init paramaters.<span><font \
color="#888888"><br></font></span></div><span><font \
color="#888888"><div><br></div>Wyclif<br></font></span></div><div><div><div \
class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 8, 2015 at 12:04 PM, \
Harsha Kumara <span dir="ltr">&lt;<a href="mailto:harsz89@gmail.com" \
target="_blank">harsz89@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi Wyclif,<div><br></div><div>Please find code \
in branch[1]. I have follow the approach suggested in \
[2].</div><div><br></div><div>[1] -  <a \
href="https://github.com/harsha89/openmrs-module-fhir/tree/swagger" \
target="_blank">https://github.com/harsha89/openmrs-module-fhir/tree/swagger</a></div><div>[2] \
-  <a href="https://github.com/swagger-api/swagger-core/wiki/Servlet-Quickstart" \
target="_blank">https://github.com/swagger-api/swagger-core/wiki/Servlet-Quickstart</a></div><div><br></div><div>Thanks,</div><div>Harsha</div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 8, 2015 at 8:57 PM, \
Wyclif Luyima <span dir="ltr">&lt;<a href="mailto:wyclif@openmrs.org" \
target="_blank">wyclif@openmrs.org</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div>Can you share your code?<span><font \
color="#888888"><br><br></font></span></div><span><font \
color="#888888">Wyclif<br></font></span></div><div><div><div \
class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 7, 2015 at 10:52 PM, \
Harsha Kumara <span dir="ltr">&lt;<a href="mailto:harsz89@gmail.com" \
target="_blank">harsz89@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hey Wyclif,<div><br></div><div>Yeas, the \
servelet is hitting. As I mentioned earlier, I have confirm it with extending \
provided servelet with my own servelet and debuging it.  \
</div><div><br></div><div>Thanks,</div><div>Harsha</div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 8, 2015 at 12:34 AM, \
Wyclif Luyima <span dir="ltr">&lt;<a href="mailto:wyclif@openmrs.org" \
target="_blank">wyclif@openmrs.org</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Harsha,<br><br></div>What URL are \
you entering to hit the servlet? Did you read <a \
href="https://wiki.openmrs.org/display/docs/Module+Servlets" \
target="_blank">this</a>?<br><br></div>Wyclif<br></div><div \
class="gmail_extra"><div><div><br><div class="gmail_quote">On Mon, Apr 6, 2015 at \
3:44 PM, Harsha Kumara <span dir="ltr">&lt;<a href="mailto:harsz89@gmail.com" \
target="_blank">harsz89@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br clear="all"><div>I was \
following[1] to integrate swagger into the FHIR module. In[1], we have to add \
mappings as follow in web.xml</div><div><br></div><div>For finding the annotated APIs \
which uses by swagger internal  </div><pre \
style="overflow:auto;font-family:Consolas,&#39;Liberation \
Mono&#39;,Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;font \
-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;word-break:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)"><span \
style="color:rgb(150,152,150)">&lt;!-- swagger servlet reader --&gt;</span> &lt;<span \
style="color:rgb(99,163,92)">servlet</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">servlet-name</span>&gt;DefaultServletReaderConfig&lt;/<span \
style="color:rgb(99,163,92)">servlet-name</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">servlet-class</span>&gt;com.wordnik.swagger.servlet.config.DefaultServletReaderConfig&lt;/<span \
style="color:rgb(99,163,92)">servlet-class</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">load-on-startup</span>&gt;2&lt;/<span \
style="color:rgb(99,163,92)">load-on-startup</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">init-param</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">param-name</span>&gt;swagger.resource.package&lt;/<span \
style="color:rgb(99,163,92)">param-name</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">param-value</span>&gt;com.wordnik.swagger.sample.servlet&lt;/<span \
style="color:rgb(99,163,92)">param-value</span>&gt;  &lt;/<span \
style="color:rgb(99,163,92)">init-param</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">init-param</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">param-name</span>&gt;swagger.api.basepath&lt;/<span \
style="color:rgb(99,163,92)">param-name</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">param-value</span>&gt;<a href="http://localhost:8002" \
target="_blank">http://localhost:8002</a>&lt;/<span \
style="color:rgb(99,163,92)">param-value</span>&gt;  &lt;/<span \
style="color:rgb(99,163,92)">init-param</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">init-param</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">param-name</span>&gt;api.version&lt;/<span \
style="color:rgb(99,163,92)">param-name</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">param-value</span>&gt;1.0.0&lt;/<span \
style="color:rgb(99,163,92)">param-value</span>&gt;  &lt;/<span \
style="color:rgb(99,163,92)">init-param</span>&gt;  </pre><div><span \
style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation \
Mono&#39;,Menlo,Courier,monospace;font-size:14px;line-height:1.45;background-color:rgb(247,247,247)">&lt;/</span><span \
style="font-family:Consolas,&#39;Liberation \
Mono&#39;,Menlo,Courier,monospace;font-size:14px;line-height:1.45;color:rgb(99,163,92)">servlet</span><span \
style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation \
Mono&#39;,Menlo,Courier,monospace;font-size:14px;line-height:1.45;background-color:rgb(247,247,247)">&gt;</span></div><div><br></div><div>And \
swagger API servelet</div><pre \
style="overflow:auto;font-family:Consolas,&#39;Liberation \
Mono&#39;,Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;font \
-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;word-break:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)"><span \
style="color:rgb(150,152,150)">&lt;!-- swagger api declaration --&gt;</span> \
&lt;<span style="color:rgb(99,163,92)">servlet</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">servlet-name</span>&gt;ApiDeclarationServlet&lt;/<span \
style="color:rgb(99,163,92)">servlet-name</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">servlet-class</span>&gt;com.wordnik.swagger.servlet.listing.ApiDeclarationServlet&lt;/<span \
style="color:rgb(99,163,92)">servlet-class</span>&gt; &lt;/<span \
style="color:rgb(99,163,92)">servlet</span>&gt; &lt;<span \
style="color:rgb(99,163,92)">servlet-mapping</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">servlet-name</span>&gt;ApiDeclarationServlet&lt;/<span \
style="color:rgb(99,163,92)">servlet-name</span>&gt;  &lt;<span \
style="color:rgb(99,163,92)">url-pattern</span>&gt;/api-docs/*&lt;/<span \
style="color:rgb(99,163,92)">url-pattern</span>&gt;  </pre><div><span \
style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation \
Mono&#39;,Menlo,Courier,monospace;font-size:14px;line-height:1.45;background-color:rgb(247,247,247)">&lt;/</span><span \
style="font-family:Consolas,&#39;Liberation \
Mono&#39;,Menlo,Courier,monospace;font-size:14px;line-height:1.45;color:rgb(99,163,92)">servlet-mapping</span><span \
style="color:rgb(51,51,51);font-family:Consolas,&#39;Liberation \
Mono&#39;,Menlo,Courier,monospace;font-size:14px;line-height:1.45;background-color:rgb(247,247,247)">&gt;</span></div><div><br></div><div>When \
I specified that in openmrs web.xml. It will generate the api doc from selected \
servelets in http:// localhost/openmrs/api-docs.  </div><div><br></div><div>But when \
I declare the servelets in module config.xml I get no response.  \
</div><div><br></div><div>I even extend above servelet and created one by own. GET \
requests are coming to the servelet which I confirmed through debugging. But there is \
no response from the servelet declared in the module config.xml even doGet function \
is called in the servelet.</div><div><br></div><div>Any thoughts about what can be \
going wrong here?</div><div><br></div><div>Thanks,</div><div>Harsha</div><div>  \
</div><div><br></div><div>[1] -  <a \
href="https://github.com/swagger-api/swagger-core/wiki/Servlet-Quickstart" \
target="_blank">https://github.com/swagger-api/swagger-core/wiki/Servlet-Quickstart</a></div><span><font \
color="#888888">-- <br><div><div dir="ltr"><font \
style="background-color:rgb(255,255,255)" color="#666666"><i>Harsha \
Kumara</i></font><div><font color="#666666"><i>Software \
Engineer</i></font></div><div><font color="#666666"><i>WSO2 \
Inc.</i></font></div><div><font style="background-color:rgb(255,255,255)" \
color="#666666"><i>Sri Lanka.</i></font></div></div></div> </font></span></div></div>
</blockquote></div><br><br clear="all"><span><font \
color="#888888"><br></font></span></div></div><span><font color="#888888"><span><font \
color="#888888">-- <br><div><span style="background-color:rgb(51,102,255)"><span \
style="color:rgb(255,102,102)"><span \
style="font-size:7.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><span \
style="background-color:rgb(255,255,255)"><span style="color:rgb(51,102,255)">Wyclif \
Luyima<br>Regenstrief Institute Inc.<br><br> </span></span></span><span \
style="color:rgb(204,0,0)"><span \
style="font-size:7.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><span \
style="background-color:rgb(255,255,255)"><span \
style="color:rgb(51,102,255)">Confidentiality  Notice: The contents of this message \
and any files transmitted with it  may contain confidential and/or privileged \
information and are intended  solely for the
 use of the named addressee(s). Additionally, the information contained 
herein may have been disclosed to you from medical records with 
confidentiality protected by federal and state laws. Federal regulations
 and State laws prohibit you from making further
 disclosure of such information without the specific written consent of 
the person to whom the information pertains or as otherwise permitted by
 such regulations. A general authorization for the release of medical or
 other information is not sufficient for
 this purpose.<br>
<br>
If you have received this message in error, please notify the sender by 
return e-mail and delete the original message. Any retention, 
disclosure, copying, distribution or use of this information by anyone 
other than the intended recipient is strictly prohibited.
</span><span></span></span></span></span></span></span></div>
</font></span></font></span></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br><div><div dir="ltr"><font \
style="background-color:rgb(255,255,255)" color="#666666"><i>Harsha \
Kumara</i></font><div><font color="#666666"><i>Software \
Engineer</i></font></div><div><font color="#666666"><i>WSO2 \
Inc.</i></font></div><div><font style="background-color:rgb(255,255,255)" \
color="#666666"><i>Sri Lanka.</i></font></div></div></div> </font></span></div>
</blockquote></div><br><br clear="all"><span><font color="#888888"><br>-- \
<br><div><span style="background-color:rgb(51,102,255)"><span \
style="color:rgb(255,102,102)"><span \
style="font-size:7.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><span \
style="background-color:rgb(255,255,255)"><span style="color:rgb(51,102,255)">Wyclif \
Luyima<br>Regenstrief Institute Inc.<br><br> </span></span></span><span \
style="color:rgb(204,0,0)"><span \
style="font-size:7.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><span \
style="background-color:rgb(255,255,255)"><span \
style="color:rgb(51,102,255)">Confidentiality  Notice: The contents of this message \
and any files transmitted with it  may contain confidential and/or privileged \
information and are intended  solely for the
 use of the named addressee(s). Additionally, the information contained 
herein may have been disclosed to you from medical records with 
confidentiality protected by federal and state laws. Federal regulations
 and State laws prohibit you from making further
 disclosure of such information without the specific written consent of 
the person to whom the information pertains or as otherwise permitted by
 such regulations. A general authorization for the release of medical or
 other information is not sufficient for
 this purpose.<br>
<br>
If you have received this message in error, please notify the sender by 
return e-mail and delete the original message. Any retention, 
disclosure, copying, distribution or use of this information by anyone 
other than the intended recipient is strictly prohibited.
</span><span></span></span></span></span></span></span></div>
</font></span></div><span><font color="#888888">
</font></span></div></div></blockquote></div><span><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br><div><div dir="ltr"><font \
style="background-color:rgb(255,255,255)" color="#666666"><i>Harsha \
Kumara</i></font><div><font color="#666666"><i>Software \
Engineer</i></font></div><div><font color="#666666"><i>WSO2 \
Inc.</i></font></div><div><font style="background-color:rgb(255,255,255)" \
color="#666666"><i>Sri Lanka.</i></font></div></div></div> </font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div><span \
style="background-color:rgb(51,102,255)"><span style="color:rgb(255,102,102)"><span \
style="font-size:7.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><span \
style="background-color:rgb(255,255,255)"><span style="color:rgb(51,102,255)">Wyclif \
Luyima<br>Regenstrief Institute Inc.<br><br> </span></span></span><span \
style="color:rgb(204,0,0)"><span \
style="font-size:7.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><span \
style="background-color:rgb(255,255,255)"><span \
style="color:rgb(51,102,255)">Confidentiality  Notice: The contents of this message \
and any files transmitted with it  may contain confidential and/or privileged \
information and are intended  solely for the
 use of the named addressee(s). Additionally, the information contained 
herein may have been disclosed to you from medical records with 
confidentiality protected by federal and state laws. Federal regulations
 and State laws prohibit you from making further
 disclosure of such information without the specific written consent of 
the person to whom the information pertains or as otherwise permitted by
 such regulations. A general authorization for the release of medical or
 other information is not sufficient for
 this purpose.<br>
<br>
If you have received this message in error, please notify the sender by 
return e-mail and delete the original message. Any retention, 
disclosure, copying, distribution or use of this information by anyone 
other than the intended recipient is strictly prohibited.
</span><span></span></span></span></span></span></span></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div \
dir="ltr"><font style="background-color:rgb(255,255,255)" color="#666666"><i>Harsha \
Kumara</i></font><div><font color="#666666"><i>Software \
Engineer</i></font></div><div><font color="#666666"><i>WSO2 \
Inc.</i></font></div><div><font style="background-color:rgb(255,255,255)" \
color="#666666"><i>Sri Lanka.</i></font></div></div></div> </div>
</div></div></blockquote></div><br><br \
clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div><div \
dir="ltr">Best Regards,<div>Suranga</div></div></div> </font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div><span \
style="background-color:rgb(51,102,255)"><span style="color:rgb(255,102,102)"><span \
style="font-size:7.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><span \
style="background-color:rgb(255,255,255)"><span style="color:rgb(51,102,255)">Wyclif \
Luyima<br>Regenstrief Institute Inc.<br><br> </span></span></span><span \
style="color:rgb(204,0,0)"><span \
style="font-size:7.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><span \
style="background-color:rgb(255,255,255)"><span \
style="color:rgb(51,102,255)">Confidentiality  Notice: The contents of this message \
and any files transmitted with it  may contain confidential and/or privileged \
information and are intended  solely for the
 use of the named addressee(s). Additionally, the information contained 
herein may have been disclosed to you from medical records with 
confidentiality protected by federal and state laws. Federal regulations
 and State laws prohibit you from making further
 disclosure of such information without the specific written consent of 
the person to whom the information pertains or as otherwise permitted by
 such regulations. A general authorization for the release of medical or
 other information is not sufficient for
 this purpose.<br>
<br>
If you have received this message in error, please notify the sender by 
return e-mail and delete the original message. Any retention, 
disclosure, copying, distribution or use of this information by anyone 
other than the intended recipient is strictly prohibited.
</span><span></span></span></span></span></span></span></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div \
class="gmail_signature"><div dir="ltr"><font \
style="background-color:rgb(255,255,255)" color="#666666"><i>Harsha \
Kumara</i></font><div><font color="#666666"><i>Software \
Engineer</i></font></div><div><font color="#666666"><i>WSO2 \
Inc.</i></font></div><div><font style="background-color:rgb(255,255,255)" \
color="#666666"><i>Sri Lanka.</i></font></div></div></div> </div>

<p></p>

-- <br />
OpenMRS Developers: <a href="http://om.rs/dev">http://om.rs/dev</a><br />
Post: dev@openmrs.org | Unsubscribe: dev+unsubscribe@openmrs.org<br />
Manage your OpenMRS subscriptions: <a href="http://om.rs/id">http://om.rs/id</a><br \
/> &nbsp;<br />
*** FINAL WARNING: This group will be moved to OpenMRS Talk effective 10 April 2015 \
at 19:00 UTC. Please visit <a \
href="https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508">https://talk.openmrs.org/t/openmrs-developers-group-changes-2015-04-10/1508</a> \
for details and to make necessary changes.<br />

<p></p>

To unsubscribe from this group and stop receiving emails from it, send an email to <a \
href="mailto:dev+unsubscribe@openmrs.org">dev+unsubscribe@openmrs.org</a>.<br />



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic