@@ -81,7 +81,7 @@ void write() {
8181 writeHeaders ();
8282 writePaths (segments );
8383 writeQueryParams (pathSegments );
84- writeFormParams ();
84+ writeFormParams (pathSegments );
8585 writeBody ();
8686
8787 WebMethod webMethod = method .getWebMethod ();
@@ -174,20 +174,29 @@ private void writeHeaders() {
174174 }
175175 }
176176
177- private void writeFormParams () {
177+ private void writeFormParams (PathSegments segments ) {
178178 for (MethodParam param : method .getParams ()) {
179+ final String varName = param .getName ();
179180 ParamType paramType = param .getParamType ();
180- if (paramType == ParamType .FORMPARAM ) {
181- if (isMap (param )) {
182- writer .append (" .formParam(%s)" , param .getName ()).eol ();
183- } else {
184- writer .append (" .formParam(\" %s\" , %s)" , param .getParamName (), param .getName ()).eol ();
185- }
186- } else if (paramType == ParamType .FORM ) {
187- TypeElement formBeanType = ctx .getTypeElement (param .getRawType ());
188- BeanParamReader form = new BeanParamReader (ctx , formBeanType , param .getName (), param .getShortType (), ParamType .FORMPARAM );
189- form .writeFormParams (writer );
181+ PathSegments .Segment segment = segments .segment (varName );
182+ if (segment == null ) {
183+ // not a path or matrix parameter
184+ writeFormParam (param , paramType );
185+ }
186+ }
187+ }
188+
189+ private void writeFormParam (MethodParam param , ParamType paramType ) {
190+ if (paramType == ParamType .FORMPARAM ) {
191+ if (isMap (param )) {
192+ writer .append (" .formParam(%s)" , param .getName ()).eol ();
193+ } else {
194+ writer .append (" .formParam(\" %s\" , %s)" , param .getParamName (), param .getName ()).eol ();
190195 }
196+ } else if (paramType == ParamType .FORM ) {
197+ TypeElement formBeanType = ctx .getTypeElement (param .getRawType ());
198+ BeanParamReader form = new BeanParamReader (ctx , formBeanType , param .getName (), param .getShortType (), ParamType .FORMPARAM );
199+ form .writeFormParams (writer );
191200 }
192201 }
193202
0 commit comments