I think the code for doing the handlersFactory vs MediaTypesFactory
was just written at 2 different times. If you patched the code to
perform similar object instantiations in the media type mappers, does
it work?

On Mon, Jul 25, 2011 at 4:55 AM, vareshbe <[email protected]> wrote:
> Hi All,
>
> I am unable to register a MediaTypeFactory. It is giving me
> ClassNotFoundException.
>
> Following is the error I am receiving.
> Could you kindly assist in resolving the same?
>
> [7/25/11 14:57:19:026 IST] 0000001e DeploymentCon E
> org.apache.wink.server.internal.DeploymentConfiguration initMediaTypeMapper
> com.test.controller.handlers.MediaTypeFactory is not a class or the class
> has unresolved dependencies. Ignoring.
>                                 java.lang.ClassNotFoundException:
> com.test.controller.handlers.MediaTypeFactory
>        at java.lang.Class.forNameImpl(Native Method)
>        at java.lang.Class.forName(Class.java:130)
>        at
> org.apache.wink.server.internal.DeploymentConfiguration.initMediaTypeMapper(DeploymentConfiguration.java:334)
>        at
> org.apache.wink.server.internal.DeploymentConfiguration.init(DeploymentConfiguration.java:145)
>        at
> org.apache.wink.server.internal.servlet.RestServlet.getDeploymentConfiguration(RestServlet.java:128)
>
> *MediaTypeFactory.java*
> public class MediaTypeFactory extends MediaTypeMapperFactory{
>        public MediaTypeFactory() {
>                super();
>        }
>        @Override
>        public List<? extends MediaTypeMappingRecord> getMediaTypeMappings() {
>                ArrayList<MediaTypeMappingRecord> mediaTypeMappingRecord = new
> ArrayList<MediaTypeMappingRecord>();
>                mediaTypeMappingRecord.add(new MediaTypeRecord());
>                return mediaTypeMappingRecord;
>        }
>
> }
>
> *MediaTypeRecord.java*
> public class MediaTypeRecord implements MediaTypeMappingRecord{
>        public MediaType match(HttpHeaders requestHeaders,
>                        MediaType responseMediaType) {
>                return MediaType.APPLICATION_JSON_TYPE;
>        }
> }
>
> I am however, able to register the RequestHandlers properly.
> In the code (DeploymentConfiguration.java), I see different logic to lookup
> the class for handlersFactory and MediaTypesFactory.
> Can someone please explain the rational behind this.
>
> Regards.
>
>
> --
> View this message in context: 
> http://apache-wink-users.3471013.n2.nabble.com/Unable-to-register-MediaTypeFactory-tp6617708p6617708.html
> Sent from the Apache Wink Users mailing list archive at Nabble.com.
>

Reply via email to