This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244109

Summary: package com.sun.jersey.spi.container does not exist - in affable bean application with HTML5 front-end
Product: webservices Reporter: darya <darya>
Component: RESTAssignee: Milan Kuchtiak <mkuchtiak>
Status: RESOLVED WONTFIX    
Severity: normal CC: dkonecny
Priority: P2    
Version: 8.0   
Hardware: PC   
OS: Windows 8 x64   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 227712, 227718    
Bug Blocks:    

Description darya 2014-04-27 15:28:36 UTC
Compilation error in affable-bean application with HTML5 front-end ( https://bitbucket.org/dkonecny/affable-bean/wiki/Home)

The wiki says to run this application with: NetBeans IDE 7.3 and GlassFish 3.1.2.2

Now I try to run the application with: NetBeans IDE 8.0 (Build 201403101706) and GlassFish Server Open Source Edition  4.0  (build 89)

And run into same problem similar under NetBeans 7.3 and GlassFish 4 (see Bug 227718 or https://netbeans.org/bugzilla/show_bug.cgi?id=227718) 

C:\dkonecny-affable-bean\server\src\java\rest\filter\NewCrossOriginResourceSharingFilter.java:7: error: package com.sun.jersey.spi.container does not exist
import com.sun.jersey.spi.container.ContainerRequest;

C:\dkonecny-affable-bean\server\src\java\rest\filter\NewCrossOriginResourceSharingFilter.java:8: error: package com.sun.jersey.spi.container does not exist
import com.sun.jersey.spi.container.ContainerResponse;

C:\dkonecny-affable-bean\server\src\java\rest\filter\NewCrossOriginResourceSharingFilter.java:9: error: package com.sun.jersey.spi.container does not exist
import com.sun.jersey.spi.container.ContainerResponseFilter;

Does anyone know how to correct that error?
Comment 1 Milan Kuchtiak 2014-04-28 13:12:19 UTC
Please, use the JaxRs API insted. in NewCrossOriginResourceSharingFilter :

=====================================================================
package rest.filter;

import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;

/**
 *
 * @author david
 */
public class NewCrossOriginResourceSharingFilter implements ContainerResponseFilter {

    @Override
    public void filter(ContainerRequestContext request, ContainerResponseContext response) {
        response.getHeaders().putSingle("Access-Control-Allow-Origin", "*");
        response.getHeaders().putSingle("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
        response.getHeaders().putSingle("Access-Control-Allow-Headers", "content-type, X-Requested-With");
    }
    
}

=====================================================================

Notifying also the author of the tutorial to fix the example.
David, could you pelase fix the example ?