Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Restlets not responding even though request shows in console

965904Oct 3 2012
Restlet Code

public static void main(String[] args) {

Component component = new Component();
component.getServers().add(Protocol.HTTP, 8182);
component.getClients().add(Protocol.FILE);


Context ctx = component.getContext();
final Context childCtx = ctx.createChildContext();
Application application = new Application(childCtx) {
@Override
public Restlet createRoot() {
// Create a root router
Router router = new Router(childCtx);

public void handle(Request request, Response response) {
// Print the user name of the requested orders
String message = "Orders of user \""
+ request.getAttributes().get("users") + "\"";
response.setEntity(message, MediaType.TEXT_PLAIN);
}
};

router.attach("/users/{user}", account);
router.attach("/object/", TestServerResource.class);

return router;
}

component.getDefaultHost().attach(application);

component.start();
}
}
}

When I use the GUI test tool and submit a GET request the console logs the fact that a request was received but no data is returned. A breakpoint in the handle() method is never hit. The TestServerResource class is never accessed either. I copied this example from the Restlet user guide. I feel like I have entered everything correctly but things just aren't working. Is there an important step that I have missed?


Here's some more information

I am using WizTools.org RESTClient 3.0

I issue the following GET request

127.0.0.1:8182/users/1 through RESTClient 3.0

The java console shows

Oct 03, 2012 8:40:02 AM com.noelios.restlet.LogFilter afterHandle
INFO: 2012-10-03 08:40:02 127.0.0.1 - - 8182 GET /users/1 - 200 0 - 16 http://127.0.0.1:8182 Apache-HttpClient/4.2.1 (java 1.5)

The RESTClient output shows

Oct 03, 2012 8:40:03 AM org.wiztools.restclient.HTTPClientRequestExecuter execut
e
WARNING: Content-Type header not available in response. Using platform default e
ncoding: windows-1252

The RESTClient 3.0 GUI reports

Content-Length 0
Date: (a date value of the request)
Accept-Ranges bytes
Server Noelios-Restlet-Engine/1.1.10
Connection close

Comments

668692
When you import the data via batch script then ImportAction script will not be executed so you need to
copy all the "importaction" code to batchaction script . Since this script will be executed during the
batch process .

so you can write all your customizations as below


Sub BatchAction(strEventName, objFile)

If strEventName = "ImportAction" Then

-- copy all the code from importaction script to here


End If

End Sub

Please let me know whether the above solution work for you.
682330
Hi,

Do you still need to retain the Code in ImportAction Event as well?
user96869
Hi,

It didn't work.

Do I need to remove the path in my script? Because the Path was looking for files in the OpenBAtch folder.

This is our script:

Sub BatchAction(strEventName, objFile)
'------------------------------------------------------------------
'Hyperion FDM EVENT Script:
'
'Created By: prakuma
'Date Created: 2009-11-18-01:20:20
'
'Purpose:
'
'------------------------------------------------------------------

If strEventName="ImportAction" Then
strWorkTableName=API.State.GstrActiveWorkTableName
'Declaration of variables
Dim objfilepath,objfolderpath,objFolder,objFiles,objFileSys,objFileName,dataArray,oTextStream,i
Dim totalNoOfRecords,PreviousPositiveValue,PreviousNegativeValue,totalRowsCount
Dim totalCalculatedPositiveAmount,totalCalculatedNegativeAmount

i = 0
totalCalculatedPositiveValue = "0"
totalCalculatedNegativeValue = "0"
totalNoOfRecords = 0
PreviousPositiveValue = 0

'Creating file system object
Set objFileSys = CreateObject("Scripting.FileSystemObject")

'Specify the file path
objfolderpath = "E:\FDMShare\LCL_IFRS\Inbox\Batches\OpenBatch\"

'Get the folder contents
Set objFolder = objFileSys.GetFolder(objfolderpath)
Set objFiles = objFolder.Files

'Loop through the files
For Each folderIdx In objFiles
objfilepath = objfolderpath & folderIdx.Name

'Getting the file name
intPos = InStrRev(objfilepath,"\")
objFileName= Mid(objfilepath, intPos+1, Len(objfilepath))


'Checking the file is exists and starting of the file contains with "0L"
If objFileSys.FileExists(objfilepath) And (Left(objFileName,2)="0L") Then
Set objReadFile = objFileSys.OpenTextFile(objfilepath)

Do Until objReadFile.AtEndOfStream
sText = objReadFile.ReadLine
sText = Split(sText,",")
i = i + 1 'Calculate the total no of lines [last line - 1]

'msgbox i

If UBound(sText) = 7 Then
If Not Right(sText(7),1) = "-" Then 'all negative value contains "-" as a last character
totalCalculatedPositiveValue = CDbl(totalCalculatedPositiveValue) + CDbl(sText(7))
Else
totalCalculatedNegativeValue = CDbl(totalCalculatedNegativeValue) + CDbl(sText(7))
End If
Else
i = i - 1 'Calculate the total no of lines [last line - 1]

totalCalculatedNegativeValue = ( totalCalculatedNegativeValue * -1 ) & "-" ' to convert in the format of negative no like "1234-"

If Trim(sText(2)) = Trim(totalCalculatedPositiveValue) And Trim(sText(3)) = Trim(totalCalculatedNegativeValue) And Trim(sText(1)) = Trim(i) Then

'msgbox "Valid Data"
Else
delSQL = "DELETE FROM " & strWorkTableName
If Not API.DataWindow.DataManipulation.fexecuteDML(delsql) Then
RES.plngactiontype = 2
RES.pstractionvalue = "Import Action Error deleting data not matching pov"
Exit Sub

End If

End If
End If

Loop
objReadFile.Close
Else
'msgbox "Not Exists"
End If
Next

End If



End Sub

Edited by: user10931567 on 18-Nov-2009 5:08 AM
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 31 2012
Added on Oct 3 2012
0 comments
299 views