How can I achieve the same with embedded jetty.
{
"Instance Configuration": {
"Host": "192.168.100.50",
"Http Port(s)": "9090",
"Https Port(s)": "",
"Instance Name": "Proud-Sablefish",
"Instance Group": "MicroShoal",
"Hazelcast Member UUID": "c17b5ccd-b495-4a92-b9ff-dd1f48c6f44d",
"Deployed": [
{
"Name": "jaxrs-service-webapp",
"Type": "war",
"Context Root": "/jaxrs-service-webapp"
}
]
}
}]]
[2021-04-04T04:07:47.417+0100] [] [INFO] [] [PayaraMicro] [tid: _ThreadID=1
_ThreadName=main] [timeMillis: 1617505667417] [levelValue: 800] [[
Payara Micro URLs:
http://192.168.100.50:9090/jaxrs-service-webapp
'jaxrs-service-webapp' REST Endpoints:
GET /jaxrs-service-webapp/v1/application.wadl
GET /jaxrs-service-webapp/v1/myresource
GET /jaxrs-service-webapp/webapi/application.wadl
GET /jaxrs-service-webapp/webapi/myresource
WADL
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://wadl.dev.java.net/2009/02">
<doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey:
2.30.payara-p4 2021-02-01 14:07:34"/>
<doc xmlns:jersey="http://jersey.java.net/" jersey:hint="This is simplified
WADL with user and core resources only. To get full WADL with extended
resources use the query parameter detail. Link:
http://192.168.0.38:9090/jaxrs-service-webapp/webapi/application.wadl?detail=true
"/>
<grammars/>
<resources base="http://192.168.100.50:9090/jaxrs-service-webapp/webapi/">
<resource path="myresource">
<method id="getIt" name="GET">
<response>
<representation mediaType="text/plain"/>
</response>
</method>
</resource>
</resources>
</application>
index.jsp
Jersey RESTful Web Application!
Jersey resource
<http://192.168.0.38:9090/jaxrs-service-webapp/webapi/myresource>
Visit Project Jersey website <http://jersey.java.net/> for more information
on Jersey!
On Sat, 3 Apr 2021, 07:55 Som Lima, <[email protected]> wrote:
>
> IF I have the web.xml then localhost:8080/myresource works fine
> BUT the index.jsp is not picked with localhost:8080 or
> http://localhost/index.jsp
> I got an 404.
> URI: /
> STATUS: 404
>
> IF I remove the web.xml then the index.jsp is picked up which is what is
> meant to happen with jetty because it's built in functionality
> assumes an index.jsp file is there and will pick it and publish it.
> But the I get a 404 with localhost:8080/myresource now.
> I want both index.jsp to be picked up and have the jersey functionality
> localhost:8080/myresource with the web.xml
> but I can only have one or the other.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
> https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
> version="5.0">
>
> <servlet>
> <servlet-name>Jersey Web Application</servlet-name>
>
> <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
> <init-param>
> <param-name>jersey.config.server.provider.packages</param-name>
> <param-value>com.example</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>Jersey Web Application</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
>
> <!-- no effect -->
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
>
> </web-app>
>
>
> import jakarta.ws.rs.GET;
> import jakarta.ws.rs.Path;
> import jakarta.ws.rs.Produces;
> import jakarta.ws.rs.core.MediaType;
>
> /**
> * Root resource (exposed at "myresource" path)
> */
> @Path("myresource")
> public class MyResource {
>
> /**
> * Method handling HTTP GET requests. The returned object will be sent
> * to the client as "text/plain" media type.
> *
> * @return String that will be returned as a text/plain response.
> */
> @GET
> @Produces(MediaType.TEXT_PLAIN)
> public String getIt() {
> return "got, it!";
> }
> }
>
>
>
> Preferably I also want the Rest API Config to work as well as the
> index.jsp so that I can call the resource localhost:8080/v1/myresource
>
> import jakarta.ws.rs.ApplicationPath;
> import jakarta.ws.rs.core.Application;
>
> @ApplicationPath("v1")
> public class RestAppConfig extends Application{
> }
>
>
>
_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users