rest

Grails with JAX-RS vs UrlMappings for RESTful Services

I started out looking at the JAX-RS plugin for grails and thought that was the way to go mainly because it was based on JSR-311 and I figure following standards is usually the smart thing to do. However, using Grail's UrlMappings it seems I basically achieve the same thing. I figure I'm missing something, however, we aren't doing anyth...

Is it OK to return a HTTP 401 for a non existant resource instead of 404 to prevent information disclosure?

Inspired by a thought while looking at the question "Correct HTTP status code when resource is available but not accessible because of permissions", I will use the same scenario to illustrate my hypothetical question. Imagine I am building a a carpooling web service. Suppose the following GET /api/persons/angela/location retrieves t...

Scala Lift: How to wrap REST responses into an XML root element?

Hi, I'm doing a project to test Scala and Lift at my company, atm I'm implementing a REST API that shoves XML around. I saw that there is an XMLApiHelper that offers the createTag method that encapsulates the responses in a root element. So I did this object RestAPI extends RestHelper with XMLApiHelper { serve { … } … def ...

adding crossdomain.xml to tomcat 6.0.24 to access webservices with Flex

I have to deploy a webapp on Tomcat 6.0.24, serving some webservices that should be accessed with REST-style methods (not fully REST, since the used flex class HTTPService can just send GET and POST). The webservices are deployed at http://localhost:8080/-webappname-/rest/-methodname- The problem is that the policy of flex sandbox (i ...

Use cases for web application API?

Nowadays a lot of web applications are providing API for other applications to use. I am new to the usage of API so I want to understand the use cases for it. Lets take Basecamp as an example. What are the use cases for using their API in my web application? For inserting current data in my web application into a newly created Basec...

REST GET verb with parameters

Hello my fellow stackers I'm sitting reading on some REST with my fellow teammates, we are writing a RoR application that is going to expose some of its functionality to the rest of the world. My task on this team is to make a ressource that exposes journal reports. If you call http://root.com/journalreports You should get all t...

problem with JSON array as input to REST service

Hello All, I am using Apache CXF RS to produce a REST service which accepts both XML and JSON as input. I use the default JSON provider i.e. Jettison. My trouble starts when my input json has an array in it. For example, { person:{ telephone:[ { type: "mobile", number: "123" ...

http delete with REST

I am currently using Jersey Framework (JAX-RS implementation) for building RESTful Web Services. The Resource classes in the project have implemented the standard HTTP operations - GET,POST & DELETE. I am trying to figure out how to send request parameters from client to these methods. For GET it would be in the query string(extract usi...

Rails: Override RESTful paths?

Is it possible to override a RESTful path? For instance, I have photo_path(photo) which would generate /photos/12345 But I'd like for all uses of photo_path to actually generate URL's like /photos/joeschmoe/12345 (which is the photo's user and the photo id). Obviously I could just create a new route, but wanted to make sure there wasn...

Remove xml:ns tags from webservice(axis2) response

I have a webserivce deployed using axis2. The method on the service class returns a string. public String getXML(){ return "Hello..."; } and the service is configured like this <operation name="getXML"> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.rpc....

RESTful MVC Web Service and AspBufferLimit

I have a RESTful web service built on the MVC framework (ala Aaron Skonnard) where methods may return > 4MB of XHTML. I don't want to bump up against the 4MB ASPBufferLimit, and so I'm planning to use the Controller.File() method as shown below -- note the "text/html" trick. In the past, I've written a loop to pump large streams out us...

Concise XML from EntityObject through WCF?

I'm rather new to WCF and the Entity Framework, so bear with me. I'm passing objects generated by the Entity Framework through a WCF service, and I want to be able to access said objects with both SOAP and REST. What I have currently works, but the outputted XML seems far more bloated than it needs to be. Here's an example response from...

Stateless EJB JPA Error

My project is based on Netbeans 6.9 ,JEE 6 Web Application with Stateless EJB, REST Services. There is a big problem while doing the transaction. 1) Using JPA: JPA is not pushing the values to the db table after persist/flush. But entity ID is populated. I'm not able to the same db - entity in the other application. Ideally it should pu...

Pass object to WCF service using JQuery

Hi, I know there are questions on here asking exactly the same thing, but despite me reading them I'm still missing something and hopefully you can help! It's very simple, using the WCF template that is added by VS! Interface: [OperationContract] [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat...

Jersey Problem with Parsing a JSONArray

Hi, I'm trying to implement a Resource with the jersey framework. But if I call my resource, I will get a parsing exception, that the parser can't parse JSONArray datatype. Here's my resource structure: @Path("/books") @Consumes("application/json") public class BookResource { @GET @Produces("application/json") public JSONArray getAll...

how to post a json from javascript?

hi, i want to send a json string from a html webpage using javascript to a WCF.. is there any good tutorial for that? this is the code i am using <head> <title>Test</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt; <script type="text/javascript" ...

Restlet POSTing JSON to Appengine error

We have a small app with Restlet on the GAE server and GWT and Android clients. Restlet serves GWT-serialized replies to GWT clients and JSON to Android clients. All is ok with GWT-serialization both locally and on AppEngine production servers. All is ok with Android (JSON) clients talking to local dev server. Android taking to produc...

Deploy web app on a server but pointing to many database schemas

I have a web service app that has an xml file with Oracle connection properties i.e. DEVFOOBAR schema. I will create a war file of this and deploy to Tomcat on our test server - however we only have this one server but we want the ability to test the webservice against a few different schemas e.g. DEVFOOBAR TESTFOOBAR UATFOOBAR LIVE...

Forward to a static html page from Controller

My spring mvc application has one single ContentNegotiatingViewResolver that defines JsonView for rendering json resonses: <mvc:annotation-driven/> <context:component-scan base-package="world.domination.test"/> <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <property name="mediaTypes"> ...

Rails nested resources: Input vs. output format inconsistency

Given the following two models: class Company < ActiveRecord::Base has_many :departments accepts_nested_attributes_for :departments end class Department < ActiveRecord::Base belongs_to :company end I can now create a company and its departments in one go: @company = Company.create! params[:company] In this example params[:co...