I need help in retrieving the parameters passed when the user types in the url as http://localhost:8182/trace/abc/def?param=123 where the parameter passed is 123. How do i get the 123 displayed on the web browser.Which java classes should i change in order to retrieve and return the parameters in the web page
Here are the codes that i have:
Part05
import org.restlet.Component;
//import org.restlet.Server;
import org.restlet.data.Protocol;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
public class Part05 extends ServerResource {
public static void main(String[] args) throws Exception {
// Create the HTTP server and listen on port 8182
//new Server(Protocol.HTTP, 8182, Part05.class).start();
// TODO Auto-generated method stub
// Create a new Restlet component and add a HTTP server connector to it
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
// Then attach it to the local host
component.getDefaultHost().attach("/trace", Part05.class);
// Now, let's start the component!
// Note that the HTTP server connector is also automatically started.
component.start();
}
@Get
public String toString() {
// Print the requested URI path
return "Resource URI : " + getReference() + '\n' + "Root URI : "
+ getRootRef() + '\n' + "Routed part : "
+ getReference().getBaseRef() + '\n' + "Remaining part: "
+ getReference().getRemainingPart() ;
} }
Main
import org.restlet.Component;
import org.restlet.data.Protocol;
public class Main {
/**
* @param args
*/
public static void main(String[] args) throws Exception
{
// TODO Auto-generated method stub
// Create a new Restlet component and add a HTTP server connector to it
Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
// Then attach it to the local host
component.getDefaultHost().attach("/trace", Part05.class);
// Now, let's start the component!
// Note that the HTTP server connector is also automatically started.
component.start();
}}
Output that i got: Resource URI : http://localhost:8182/trace/abc/def?param=123 Remaining part: /abc/def?param=123
Help is needed urgently!! thanks