Hi folks,

As mentioned in previous posts I'm using the REST plugin to serve
images and everything seems to work fine when the content exists.

However if I return an empty inputstream to StreamResult with a 404
response code I get the exception below.
Stepping through the code the getBufferSize() method on my controller
is definitely called and returns a legitimate value...

My struts.xml is included below the stack trace. Does anyone have any
suggestions why I'm getting this error (the calling client doesn't see
it it's just messing up my logs).

[24/07/08 14:03:40:390 NZST] 0000001c SystemErr     R
java.lang.NumberFormatException: For input string: "${bufferSize}"
[24/07/08 14:03:40:390 NZST] 0000001c SystemErr     R   at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:63)
[24/07/08 14:03:40:390 NZST] 0000001c SystemErr     R   at
java.lang.Long.parseLong(Long.java:418)
[24/07/08 14:03:40:390 NZST] 0000001c SystemErr     R   at
java.lang.Long.parseLong(Long.java:476)
[24/07/08 14:03:40:390 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.longValue(DefaultTypeConverter.java:209)
[24/07/08 14:03:40:390 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.convertValue(DefaultTypeConverter.java:122)
[24/07/08 14:03:40:390 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter.convertValue(DefaultTypeConverter.java:72)
[24/07/08 14:03:40:390 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.doConvertToNumber(XWorkBasicConverter.java:382)
[24/07/08 14:03:40:390 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter.convertValue(XWorkBasicConverter.java:118)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.conversion.impl.XWorkConverter.convertValue(XWorkConverter.java:295)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.ognl.OgnlTypeConverterWrapper.convertValue(OgnlTypeConverterWrapper.java:28)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.OgnlRuntime.getConvertedType(OgnlRuntime.java:701)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.OgnlRuntime.getConvertedTypes(OgnlRuntime.java:717)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.OgnlRuntime.getConvertedMethodAndArgs(OgnlRuntime.java:740)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.OgnlRuntime.getAppropriateMethod(OgnlRuntime.java:797)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:808)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:978)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1670)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.ASTProperty.setValueBody(ASTProperty.java:101)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.SimpleNode.setValue(SimpleNode.java:246)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
ognl.Ognl.setValue(Ognl.java:476)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:385)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.ognl.OgnlUtil.setProperties(OgnlUtil.java:84)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperties(OgnlReflectionProvider.java:54)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:218)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:201)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:258)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
org.apache.struts2.rest.RestWorkflowInterceptor.doIntercept(RestWorkflowInterceptor.java:221)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
org.apache.struts2.rest.ContentTypeInterceptor.intercept(ContentTypeInterceptor.java:67)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:179)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:140)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:225)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:179)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:406 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
org.apache.struts2.interceptor.MessageStoreInterceptor.intercept(MessageStoreInterceptor.java:204)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.opensymphony.xwork2.DefaultActionProxy.execute(DefaultActionProxy.java:129)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:449)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:768)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:676)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:691)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.wswebcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:118)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:791)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:741)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:113)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3276)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1455)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:113)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:263)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
[24/07/08 14:03:40:421 NZST] 0000001c SystemErr     R   at
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 2.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-2.0.dtd"; >
<struts>
  <constant name="struts.action.extension"
            value="xhtml,,xml,json,img,png" />
  <!-- TODO: set devMode false before releasing product!!! -->
  <constant name="struts.devMode" value="true" />

  <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper"
        name="hierarchical"
        class="net.somecompany.rest.actionmapper.HierarchicalRestActionMapper"
/>
  <constant name="struts.mapper.class"
            value="hierarchical"/>

  <!-- location in the webapp/classpath of default results -->
  <constant name="struts.codebehind.pathPrefix" value="/WEB-INF/results/"/>

  <bean name="namedVariablePatternMatcher"
        type="com.opensymphony.xwork2.util.PatternMatcher"
        class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/>
  <constant name="struts.patternMatcher" value="namedVariablePatternMatcher"/>

  <constant name="struts.codebehind.defaultPackage" value="rest-h"/>
  <constant name="struts.configuration.classpath.defaultParentPackage"
value="rest-h" />

  <!-- Our custom XML handler, based on JiBX -->
  <bean name="myXML"
        type="org.apache.struts2.rest.handler.ContentTypeHandler"
        class="net.somecompany.domain.struts.StrutsXMLHandler" />

  <!-- Our custom image handler -->
  <bean name="myImg"
        type="org.apache.struts2.rest.handler.ContentTypeHandler"
        class="net.somecompany.domain.struts.ImgHandler" />

  <package name="rest-h" extends="rest-default" namespace="/">
<!--
    <!- Global results for error and exception handling. ->
    <global-results>
      <result name="exception" type="redirect">/error.jsp</result>
    </global-results>
    <global-exception-mappings>
      <exception-mapping exception="java.lang.Throwable" result="exception"/>
    </global-exception-mappings>
 -->
  </package>

  <package name="imagePackage" extends="rest-h">
    <action name="image" class="net.somecompany.rest.action.ImageController">
      <result name="image" type="stream">
        <param name="contentType">${contentType}</param>
        <param name="inputName">image</param>
        <param name="bufferSize">${bufferSize}</param>
      </result>
    </action>
  </package>

</struts>

Cheers Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to