I am working on a Java RESTful Web Service, and for some strange reason I am getting 3 Java markers that I am entirely unsure of.
Here is my code:
package au.com.rest; //self made package
import javax.ws.rs.*; //JaxRS
import javax.ws.rs.core.*;
import au.edu.uts.it.wsd.*; //Package containing the relevant classes
@Path("/feedlist")
public class RESTFeedService {
String name, uri, action, feedFile;
String textReply = "Feed ";
String xmlReply = "<?xml version=\"1.0\"?> \n<feeds> \n";
feedFile = "/tmp/feeds.txt";
action = request.getParameter("action");
name = request.getParameter("feedName");
uri = request.getParameter("uri");
Feed feed = new Feed(name, uri);
FeedList feedList = new FeedListImpl();
feedList.load(feedFile);
@GET
@Produces(MediaType.TEXT_PLAIN)
public String showTextFeeds()
{
for (Feed f:feedList.list()){
textReply += "[Feed Name: " + f.getName() + ", ";
textReply += "[Feed URI: " + f.getURI() + "]"; }
return textReply;
}
The errors I am getting are on the following lines:
String xmlReply = "<?xml version=\"1.0\"?> \n<feeds> \n";
Syntax error on token “;”, { expected after this token
feedFile = "/tmp/feeds.txt";
Syntax error on token “String”, @ expected
public String showTextFeeds()
Syntax error on token(s), misplaced constructs
Please point me in the right direction as to what it is I am doing wrong.
Thanks!
should be