Yeah, that is what I have now. I have commented out the part where I use the multipackages. When I use one package, it partially works. I get only the data within the @Info annotations but nothing from the @API annotations.
On Tuesday, 27 December 2016 17:05:29 UTC-5, Ron wrote: > > For the ‘resource scanning’ that is. > > > > > > *From: *<swagger-sw...@googlegroups.com <javascript:>> on behalf of Ron > Ratovsky <r...@swagger.io <javascript:>> > *Reply-To: *"swagger-sw...@googlegroups.com <javascript:>" < > swagger-sw...@googlegroups.com <javascript:>> > *Date: *Tuesday, 27 December 2016 at 14:04 > *To: *"swagger-sw...@googlegroups.com <javascript:>" < > swagger-sw...@googlegroups.com <javascript:>> > *Subject: *Re: Cant locate swagger.json on java + embedded jetty + > httpservlet + swagger integration > > > > Okay, since you mentioned using two packages isn’t working, what happens > if you only set com.coreservices.servlet for the resource packing? > > > > > > > > *From: *<swagger-sw...@googlegroups.com <javascript:>> on behalf of janet > vanderpuye <rhy...@gmail.com <javascript:>> > *Reply-To: *"swagger-sw...@googlegroups.com <javascript:>" < > swagger-sw...@googlegroups.com <javascript:>> > *Date: *Tuesday, 27 December 2016 at 13:06 > *To: *Swagger <swagger-sw...@googlegroups.com <javascript:>> > *Subject: *Re: Cant locate swagger.json on java + embedded jetty + > httpservlet + swagger integration > > > > Maybe. Here is what I have so far. > > > > Main.java > > import org.eclipse.jetty.server.Server; > > import org.eclipse.jetty.servlet.ServletContextHandler; > > import org.eclipse.jetty.servlet.ServletHolder; > > import io.swagger.servlet.listing.ApiDeclarationServlet; > > import io.swagger.servlet.config.DefaultServletConfig; > > > > > > Server server = new > Server(Integer.parseInt(properties.getProperty(Config.JETTY_SERVICE_PORT))); > > ServletContextHandler servletContextHandler = new > ServletContextHandler(ServletContextHandler.SESSIONS); > > servletContextHandler.setContextPath("/"); > > server.setHandler(servletContextHandler); > > > > //Custom servlet > > ServletHolder apiservlet = > servletContextHandler.addServlet(ProfileServlet.class, "/user/*"); > > apiservlet.setInitOrder(3); > > logger.info("User profile server initialized."); > > > > // Swagger servlet reader > > ServletHolder swaggerServlet = > servletContextHandler.addServlet(DefaultServletConfig.class, > "/swagger-core"); > > swaggerServlet.setInitOrder(2); > > swaggerServlet.setInitParameter("api.version", "1.0.0"); > > //swaggerServlet.setInitParameter("swagger.resource.package", > "com.coreservices.servlets,com.coreservices.datatypes"); > > > swaggerServlet.setInitParameter("swagger.resource.package","com.coreservices.servlets"); > > swaggerServlet.setInitParameter("swagger.api.basepath", " > http://localhost:7000"); > > > > // Swagger api declaration > > servletContextHandler.addServlet(ApiDeclarationServlet.class, > "/api/*"); > > server.start(); > > > > ProfileServlet.java /**custom httpservlet class**/ > > import io.swagger.annotations.*; > > import org.apache.log4j.Logger; > > > > import javax.servlet.ServletException; > > import javax.servlet.http.HttpServlet; > > import javax.servlet.http.HttpServletRequest; > > import javax.servlet.http.HttpServletResponse; > > > > /** > > * Created on 12/21/2016. > > */ > > @SwaggerDefinition( > > info = @Info( > > title = "User Profile Servlet", > > version = "1.0.0", > > description = "Servlet that handles basic CRUD operations to > the user profile data source", > > contact = @Contact(name = "XYZ", email = "XYZ", url = "XYZ"), > > termsOfService = "XYZ", > > license = @License(name = "XYZ", url = "XYZ") > > ), > > basePath = "/", > > consumes = {"application/json"}, > > produces = {"application/json"}, > > schemes = {SwaggerDefinition.Scheme.HTTP, > SwaggerDefinition.Scheme.HTTPS}, > > tags = {@Tag(name = "users", description = "CRUD operations on > user datatype")} > > ) > > @Api(value = "/user", description = "performs CRUD operations on a user > profile") > > public class ProfileServlet extends HttpServlet { > > Logger logger = Logger.getLogger(ProfileServlet.class.getSimpleName()); > > > > @ApiOperation(httpMethod = "GET", value = "Returns a [list of the] > user profile datatype", notes = "", response = UserDatatype.class, nickname > = "getUser", tags = ("User")) > > @ApiResponses(value = { > > @ApiResponse(code = 200, message = "Succssful retrieval of > user profiles", response = UserDatatype.class), > > @ApiResponse(code = 500, message = "Internal server error") > > }) > > @ApiImplicitParams({ > > @ApiImplicitParam(name = "id", value = "profile id", required > = false, dataType = "String", paramType = "query"), > > @ApiImplicitParam(name = "firstname", value = "First name of > user", required = false, dataType = "String", paramType = "query"), > > @ApiImplicitParam(name = "lastname", value = "Last name of > user", required = false, dataType = "String", paramType = "query"), > > @ApiImplicitParam(name = "phone", value = "phone number of > user", required = false, dataType = "String", paramType = "query"), > > @ApiImplicitParam(name = "signup", value = "Sign up date of > user, in dd-MM-yyyy forma", required = false, dataType = "java.sql.Date", > paramType = "query") > > }) > > @Override > > protected void doGet(HttpServletRequest req, HttpServletResponse resp) > throws ServletException, IOException { > > RpcLogTemplate logTemplate = new > RpcLogTemplate(req.getRemoteHost(),req.getParameter("client"), > req.getParameter("clientapp"), Config.localhost, Config.SERVICE_INSTANCE, > Config.SERVICE_APP, req.getParameterMap(), req.getRequestURI(), new > Date().getTime() ); > > logger.debug("Received request: GET"); > > logger.debug("Request URI: " + req.getRequestURI()); > > logger.debug("Request servlet path: " + req.getServletPath()); > > handleGet(req, resp, logTemplate); > > logTemplate.setResponseTimestamp(new Date().getTime()); > > logTemplate.setResponseCode(Integer.toString(resp.getStatus())); > > Main.loggerService.addLog(logTemplate); > > } > > } > > > Finally the dependencies in my pom file > > <?xml version="1.0" encoding="UTF-8"?> > > <project xmlns="http://maven.apache.org/POM/4.0.0" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd"> > > <modelVersion>4.0.0</modelVersion> > > > > <groupId>com.coreservice.dataservice</groupId> > > <artifactId>ServiceUserProfile</artifactId> > > <version>1.0-SNAPSHOT</version> > > <packaging>jar</packaging> > > <properties> > > <jetty.version>9.4.0.v20161208</jetty.version> > > </properties> > > <dependencies> > > <dependency> > > <groupId>log4j</groupId> > > <artifactId>log4j</artifactId> > > <version>1.2.17</version> > > </dependency> > > <!--Jetty dependencies start --> > > <dependency> > > <groupId>org.eclipse.jetty</groupId> > > <artifactId>jetty-server</artifactId> > > <version>${jetty.version}</version> > > </dependency> > > <dependency> > > <groupId>org.eclipse.jetty</groupId> > > <artifactId>jetty-servlet</artifactId> > > <version>${jetty.version}</version> > > </dependency> > > <dependency> > > <groupId>io.swagger</groupId> > > <artifactId>swagger-annotations</artifactId> > > <version>1.5.10</version> > > </dependency> > > <dependency> > > <groupId>io.swagger</groupId> > > <artifactId>swagger-servlet</artifactId> > > <version>1.5.10</version> > > <scope>compile</scope> > > </dependency> > > <dependency> > > <groupId>com.google.code.gson</groupId> > > <artifactId>gson</artifactId> > > <version>2.7</version> > > </dependency> > > <dependency> > > <groupId>com.jolbox</groupId> > > <artifactId>bonecp</artifactId> > > <version>0.8.0.RELEASE</version> > > </dependency> > > <dependency> > > <groupId>org.springframework</groupId> > > <artifactId>spring-jdbc</artifactId> > > <version>3.2.2.RELEASE</version> > > </dependency> > > > > <!--Jetty dependencies end --> > > </dependencies> > > > > <!-- Download the Swagger-UI project --> > > <build> > > <plugins> > > <plugin> > > <groupId>com.googlecode.maven-download-plugin</groupId> > > <artifactId>download-maven-plugin</artifactId> > > <version>1.2.1</version> > > <executions> > > <execution> > > <id>swagger-ui</id>< > -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.